usage();
break;
case 'n':
- strncpy(ivac.username,argv[i+1],CHAR_USERNAME);
+ strncpy(ivac.username,argv[++i],CHAR_USERNAME);
break;
case 'p':
- ivac.net.l_port=atoi(argv[i+1]);
+ ivac.net.l_port=atoi(argv[++i]);
break;
default:
usage();
}
}
- return SUCCESS;
+ return length;
}
int ivac_event_cb(t_event *event,void *ptr) {
if(ivac->net.connection[channel].status&C_ESTABL) {
/* remote is sending info */
if(FD_ISSET(ivac->net.connection[channel].fd,&(event->rfds))) {
- ivac_receive_info(channel,ivac);
+ if(ivac_receive_info(channel,ivac)==0) {
+ event_math(ivac->net.connection[channel].fd,event,READ,REMOVE);
+ network_close(&(ivac->net),channel);
+ sprintf(c_str,"channel %02d: broken pipe - disconnected",channel);
+ ivac_add_to_monitor(ivac,c_str);
+ }
ivac_display_content(ivac);
}
}