X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=sources%2Fpoll_echod.c;h=4af8f5816c3926c82a9bf3977c9a18347c3f7d3f;hb=31f55ec58bee8b2c4993633849b7da4e30cab222;hp=bf2774e83c67e8180a8ec4bbed306919b1538823;hpb=d6c366b7f155596fb6cb3ed2dc631cc54e8b42e3;p=gapil.git diff --git a/sources/poll_echod.c b/sources/poll_echod.c index bf2774e..4af8f58 100644 --- a/sources/poll_echod.c +++ b/sources/poll_echod.c @@ -26,26 +26,24 @@ * * Usage: echod -h give all info * - * $Id: poll_echod.c,v 1.1 2004/01/02 21:32:08 piccardi Exp $ - * ****************************************************************/ /* * Include needed headers */ +#define _XOPEN_SOURCE #include /* system limits */ -#include /* predefined types */ -#include /* include unix standard library */ +#include /* primitive system data types */ +#include /* unix standard library */ #include /* IP addresses conversion utiliites */ -#include /* socket library */ -#include /* include standard I/O library */ -#include +#include /* socket constants, types and functions */ +#include /* standard I/O library */ +#include /* date and time constants, types and functions */ #include /* syslog system functions */ -#include /* signal functions */ -#include /* error code */ -#include /* error strings */ -#include -#define _XOPEN_SOURCE -#include /* poll function definition */ +#include /* signal constants, types and functions */ +#include /* error definitions and routines */ +#include /* C strings library */ +#include /* C standard library */ +#include /* poll syscall */ #include "macros.h" #include "Gapil.h" @@ -169,7 +167,7 @@ int main(int argc, char *argv[]) poll_set[max_fd].fd = list_fd; /* main loop, wait for connection and data inside a select */ while (1) { - while ( ((n = poll(poll_set, max_fd, -1)) < 0) + while ( ((n = poll(poll_set, max_fd + 1, -1)) < 0) && (errno == EINTR)); /* wait for data or connection */ if (n < 0) { /* on real error exit */ PrintErr("poll error"); @@ -236,8 +234,9 @@ void usage(void) { printf(" -h print this help\n"); printf(" -d write debug info\n"); printf(" -i use interactively\n"); - printf(" -c disable BSD semantics\n"); - printf(" -w N wait N sec. before calling accept\n"); + printf(" -c disable BSD signal semantics\n"); + printf(" -n N set max contemporary connection\n"); + printf(" -w N wait N sec. before calling poll\n"); exit(1); } /*