int audio_init(t_audio *audio) {
- fprintf(stderr,"[audio] initializing audio ...");
+ fprintf(stderr,"[audio] initializing audio ...\n");
if((audio->dsp_fd=open(audio->dsp_dev,O_RDWR))==-1) {
perror("[audio] open call");
}
if(!(audio->dsp_cap&DSP_CAP_DUPLEX)) {
- fprintf(stderr,"[audio] no duplex support");
+ fprintf(stderr,"[audio] no duplex support\n");
return A_ERROR;
}
int tmp;
- fprintf(stderr,"[audio] setting up sound device & allocating record/playback buffer");
+ fprintf(stderr,"[audio] setting up sound device & allocating record/playback buffer\n");
tmp=audio->fmt;
if(ioctl(audio->dsp_fd,SNDCTL_DSP_SETFMT,&tmp)==-1) {
return A_ERROR;
}
if(tmp!=audio->fmt) {
- fprintf(stderr,"[audio] FMT not supported");
+ fprintf(stderr,"[audio] FMT not supported\n");
return A_ERROR;
}
return A_ERROR;
}
if(tmp!=audio->speed) {
- fprintf(stderr,"[audio] SPEED not supported");
+ fprintf(stderr,"[audio] SPEED not supported\n");
return A_ERROR;
}
int audio_shutdown(t_audio *audio) {
- fprintf(stderr,"[audio] shutdown");
+ fprintf(stderr,"[audio] shutdown\n");
free(audio->play_data);
free(audio->rec_data);
,ws.ws_col,ws.ws_row);
/* allocating 'screen' buffer */
- if((display->screen=(unsigned char *)malloc(display->max_x*display->max_y))
+ if((display->screen=(char *)malloc(display->max_x*display->max_y))
==NULL) {
perror("[display] malloc call");
return D_ERROR;
free(display->screen);
- fprintf(stderr,"[display] shutdown");
+ fprintf(stderr,"[display] shutdown\n");
return D_SUCCESS;
}
typedef struct s_display {
int max_x;
int max_y;
- unsigned char *screen;
+ char *screen;
} t_display;
/* function prototypes */
int event_init(t_event *event) {
- fprintf(stderr,"[event] initializing event system ...");
+ fprintf(stderr,"[event] initializing event system ...\n");
event->maxfd=0;
if(s_ret) {
/* 1+ fd(s) available for reading/writing */
if(callback0(event,ptr)==CALLBACK_ERROR) {
- fprintf(stderr,"[event] callback0 returned error");
+ fprintf(stderr,"[event] callback0 returned error\n");
return E_ERROR;
}
}
/* usual stuff to be executed */
if(callback1(event,ptr)==CALLBACK_ERROR) {
- fprintf(stderr,"[event] callback returned error");
+ fprintf(stderr,"[event] callback returned error\n");
return E_ERROR;
}
int event_stop(t_event *event) {
- fprintf(stderr,"[event] shutdown");
+ fprintf(stderr,"[event] shutdown\n");
event->status=DISABLED;
return E_SUCCESS;
struct termios tios;
int size;
- fprintf(stderr,"[input] initializing input system ...");
+ fprintf(stderr,"[input] initializing input system ...\n");
size=((input->mode&CONTENT_BUFFER)?MAX_CONTENT:1);
free(input->content);
tcsetattr(0,TCSANOW,&(input->tios));
- fprintf(stderr,"[input] shutdown");
+ fprintf(stderr,"[input] shutdown\n");
return I_SUCCESS;
}
}
if(input->c_count>=MAX_CONTENT) {
- fprintf(stderr,"[input] max input length reached");
+ fprintf(stderr,"[input] max input length reached\n");
return I_ERROR;
}
struct sockaddr_in addr;
int true;
- fprintf(stderr,"[network] initializing network ...");
+ fprintf(stderr,"[network] initializing network ...\n");
memset(net->connection,0,MAX_CONNECTIONS*sizeof(t_connection));
net->c_count=0;
perror("[network] setsockopt call");
return N_ERROR;
}
- fprintf(stderr,"[network] reused address");
+ fprintf(stderr,"[network] reused address\n");
}
if(listen(net->l_fd,MAX_LISTEN_QUEUE)==-1) {
return N_ERROR;
}
- fprintf(stderr,"[network] shutdown");
+ fprintf(stderr,"[network] shutdown\n");
return N_SUCCESS;
}
}
}
- fprintf(stderr,"[network] maximum connections reached");
+ fprintf(stderr,"[network] maximum connections reached\n");
return N_E_MAXC;
}
perror("[network] setsockopt call (udp)");
return N_ERROR;
}
- fprintf(stderr,"[network] reused address (udp)");
+ fprintf(stderr,"[network] reused address (udp)\n");
}
fprintf(stderr,"[network] listening on port %d (udp)\n",net->l_udp_port);