From d451ac30382ae398b9a2242a4f82b3438affc8a7 Mon Sep 17 00:00:00 2001 From: Simone Piccardi Date: Sat, 11 Aug 2007 16:33:59 +0000 Subject: [PATCH] Seconda parte della risistemazione delle dichiarazioni di inclusione. --- sources/AcctCtrl.c | 12 ++--- sources/BarCode.c | 4 +- sources/BarCodePage.c | 4 +- sources/DirMonitor.c | 12 +++-- sources/DirScan.c | 14 +++--- sources/ErrCode.c | 2 +- sources/Flock.c | 78 ++++++++++++++++----------------- sources/ForkTest.c | 2 - sources/FortuneClient.c | 27 ++++++------ sources/FortuneParse.c | 2 +- sources/FullRead.c | 6 +-- sources/FullWrite.c | 6 +-- sources/LockFile.c | 8 ++-- sources/Mutex.c | 10 ++--- sources/PXDirMonitor.c | 12 +++-- sources/ReadMonitor.c | 12 +++-- sources/SetTermAttr.c | 8 ++-- sources/SharedMem.c | 18 ++++---- sources/SigHand.c | 13 +++--- sources/Sleep.c | 2 +- sources/SockUtil.c | 5 +-- sources/TCP_countd.c | 2 +- sources/TCP_cunc_daytimed.c | 2 +- sources/TCP_daytime.c | 2 +- sources/TCP_echo.c | 2 +- sources/TCP_echo_fifth.c | 2 +- sources/TCP_echo_first.c | 2 +- sources/TCP_echo_fourth.c | 2 +- sources/TCP_echo_second.c | 2 +- sources/TCP_echo_third.c | 2 +- sources/TCP_echod.c | 2 +- sources/TCP_echod_fifth.c | 2 +- sources/TCP_echod_first.c | 4 +- sources/TCP_echod_fourth.c | 2 +- sources/TCP_echod_second.c | 2 +- sources/TCP_echod_third.c | 2 +- sources/TCP_iter_daytimed.c | 2 +- sources/UDP_daytime.c | 2 +- sources/WriteShm.c | 29 ++++++------ sources/cap_print.c | 6 +-- sources/endian.c | 2 - sources/endtest.c | 30 ++++++++++++- sources/epoll_inotify_monitor.c | 4 +- sources/full_fread.c | 8 ++-- sources/full_fwrite.c | 8 ++-- sources/gethost.c | 20 ++++++--- sources/getparam.c | 2 +- sources/iflist.c | 19 ++++---- sources/inotify_monitor.c | 4 +- sources/is_closing.c | 10 ++--- sources/mygetaddr.c | 8 ++-- sources/mygethost.c | 6 +-- sources/myls.c | 12 +++-- sources/mylschroot.c | 34 +++++++------- sources/poll_echod.c | 4 +- sources/select_echod.c | 4 +- sources/wwwd.c | 21 +++++---- 57 files changed, 263 insertions(+), 261 deletions(-) diff --git a/sources/AcctCtrl.c b/sources/AcctCtrl.c index 705cc7a..6ea5716 100644 --- a/sources/AcctCtrl.c +++ b/sources/AcctCtrl.c @@ -16,12 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ +#include /* standard I/O library */ /* * Program AcctCtrl diff --git a/sources/BarCode.c b/sources/BarCode.c index 7248d2d..872eace 100644 --- a/sources/BarCode.c +++ b/sources/BarCode.c @@ -39,9 +39,9 @@ #include /* standard I/O library */ #include /* C standard library */ #include /* C strings library */ -#include +#include /* process termination constants and functions */ #include /* file control functions */ -#include +#include /* C assertion functions */ #include /* date and time constants, types and functions */ #include"macros.h" diff --git a/sources/BarCodePage.c b/sources/BarCodePage.c index 4abd29a..6895a87 100644 --- a/sources/BarCodePage.c +++ b/sources/BarCodePage.c @@ -39,9 +39,9 @@ #include /* standard I/O library */ #include /* C standard library */ #include /* C strings library */ -#include /* */ +#include /* process termination constants and functions */ #include /* file control functions */ -#include +#include /* C assertion functions */ #include /* date and time constants, types and functions */ diff --git a/sources/DirMonitor.c b/sources/DirMonitor.c index e4c3dc5..91198d4 100644 --- a/sources/DirMonitor.c +++ b/sources/DirMonitor.c @@ -25,14 +25,12 @@ * * Author: S. Piccardi Jan. 2003 * - * $Id: DirMonitor.c,v 1.8 2003/05/02 09:55:13 piccardi Exp $ - * *****************************************************************************/ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ #include "Gapil.h" #include "macros.h" diff --git a/sources/DirScan.c b/sources/DirScan.c index f18b9e6..a439d1a 100644 --- a/sources/DirScan.c +++ b/sources/DirScan.c @@ -22,15 +22,13 @@ * * Author: S. Piccardi Jan. 2003 * - * $Id: DirScan.c,v 1.4 2003/05/02 09:55:13 piccardi Exp $ - * *****************************************************************************/ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* standard I/O library */ +#include /* unix standard library */ /* * Function DirScan: diff --git a/sources/ErrCode.c b/sources/ErrCode.c index 23ff956..daa09cc 100644 --- a/sources/ErrCode.c +++ b/sources/ErrCode.c @@ -35,7 +35,7 @@ #include /* unix standard library */ #include /* standard I/O library */ #include /* C strings library */ -#include /* system limits values */ +#include /* system limits constants, types and functions */ /* Help printing routine */ void usage(void); diff --git a/sources/Flock.c b/sources/Flock.c index f20f6df..82790ec 100644 --- a/sources/Flock.c +++ b/sources/Flock.c @@ -26,8 +26,6 @@ * * Usage: flock -h give all info's * - * $Id: Flock.c,v 1.5 2003/05/02 09:55:13 piccardi Exp $ - * *****************************************************************************/ /* * Include needed headers @@ -51,13 +49,13 @@ int main(int argc, char *argv[]) /* * Variables definition */ - int type = F_UNLCK; /* lock type: default to unlock (invalid) */ - off_t start = 0; /* start of the locked region: default to 0 */ - off_t len = 0; /* length of the locked region: default to 0 */ - int fd, res, i; /* internal variables */ - int bsd = 0; /* semantic type: default to POSIX */ - int cmd = F_SETLK; /* lock command: default to non-blocking */ - struct flock lock; /* file lock structure */ + int type = F_UNLCK; /* lock type: default to unlock (invalid) */ + off_t start = 0; /* start of the locked region: default to 0 */ + off_t len = 0; /* length of the locked region: default to 0 */ + int fd, res, i; /* internal variables */ + int bsd = 0; /* semantic type: default to POSIX */ + int cmd = F_SETLK; /* lock command: default to non-blocking */ + struct flock lock; /* file lock structure */ /* * Input section: decode command line parameters * Use getopt function @@ -68,33 +66,33 @@ int main(int argc, char *argv[]) /* * Handling options */ - case 'h': /* help option */ + case 'h': /* help option */ printf("Wrong -h option use\n"); usage(); return -1; break; - case 's': /* take start point of the lock */ - start = strtol(optarg, NULL, 10); /* convert input */ + case 's': /* take start point of the lock */ + start = strtol(optarg, NULL, 10); /* convert input */ break; - case 'l': /* take length of the lock */ - len = strtol(optarg, NULL, 10); /* convert input */ + case 'l': /* take length of the lock */ + len = strtol(optarg, NULL, 10); /* convert input */ break; - case 'w': /* set type to write lock */ + case 'w': /* set type to write lock */ type = F_WRLCK; break; - case 'r': /* set type to read lock */ + case 'r': /* set type to read lock */ type = F_RDLCK; break; - case 'b': /* set lock to blocking */ + case 'b': /* set lock to blocking */ cmd = F_SETLKW; break; - case 'f': /* enable BSD semantic */ + case 'f': /* enable BSD semantic */ bsd = 1; break; - case '?': /* unrecognized options */ + case '?': /* unrecognized options */ printf("Unrecognized options -%c\n",optopt); usage(); - default: /* should not reached */ + default: /* should not reached */ usage(); } } @@ -105,46 +103,46 @@ int main(int argc, char *argv[]) * Main code beginning * * ***********************************************************/ - if ((argc - optind) != 1) { /* There must be remaing parameters */ + if ((argc - optind) != 1) { /* There must be remaing parameters */ printf("Wrong number of arguments %d\n", argc - optind); usage(); } - if (type == F_UNLCK) { /* There must be a -w or -r option set */ + if (type == F_UNLCK) { /* There must be a -w or -r option set */ printf("You should set a read or a write lock\n"); usage(); } - fd = open(argv[optind], O_RDONLY); /* open the file to be locked */ - if (fd < 0) { /* on error exit */ + fd = open(argv[optind], O_RDONLY); /* open the file to be locked */ + if (fd < 0) { /* on error exit */ perror("Wrong filename"); exit(1); } /* do lock */ - if (bsd) { /* if BSD locking */ + if (bsd) { /* BSD locking */ /* rewrite cmd for suitables flock operation values */ - if (cmd == F_SETLK) { /* if no-blocking */ - cmd = LOCK_NB; /* set the value for flock operation */ - } else { /* else */ - cmd = 0; /* default is null */ + if (cmd == F_SETLK) { /* if no-blocking set for flock operation */ + cmd = LOCK_NB; + } else { /* else default is null */ + cmd = 0; } - if (type == F_RDLCK) cmd |= LOCK_SH; /* set for shared lock */ - if (type == F_WRLCK) cmd |= LOCK_EX; /* set for exclusive lock */ - res = flock(fd, cmd); /* esecute lock */ - } else { /* if POSIX locking */ + if (type == F_RDLCK) cmd |= LOCK_SH; /* set for shared lock */ + if (type == F_WRLCK) cmd |= LOCK_EX; /* set for exclusive lock */ + res = flock(fd, cmd); /* esecute lock */ + } else { /* POSIX locking */ /* setting flock structure */ - lock.l_type = type; /* set type: read or write */ + lock.l_type = type; /* set type: read or write */ lock.l_whence = SEEK_SET; /* start from the beginning of the file */ - lock.l_start = start; /* set the start of the locked region */ - lock.l_len = len; /* set the length of the locked region */ - res = fcntl(fd, cmd, &lock); /* do lock */ + lock.l_start = start; /* set the start of the locked region */ + lock.l_len = len; /* set the length of the locked region */ + res = fcntl(fd, cmd, &lock); /* do lock */ } /* check lock results */ - if (res) { /* on error exit */ + if (res) { /* on error exit */ perror("Failed lock"); exit(1); - } else { /* else write message */ + } else { /* else write message */ printf("Lock acquired\n"); } - pause(); /* stop the process, use a signal to exit */ + pause(); /* stop the process, use a signal to exit */ return 0; } /* diff --git a/sources/ForkTest.c b/sources/ForkTest.c index 0561b59..1965ec8 100644 --- a/sources/ForkTest.c +++ b/sources/ForkTest.c @@ -26,8 +26,6 @@ * * Usage: forktest -h give all info's * - * $Id: ForkTest.c,v 1.10 2003/05/02 09:55:13 piccardi Exp $ - * ****************************************************************/ /* * Include needed headers diff --git a/sources/FortuneClient.c b/sources/FortuneClient.c index caf3002..5d8ba0a 100644 --- a/sources/FortuneClient.c +++ b/sources/FortuneClient.c @@ -32,10 +32,12 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ #include /* standard I/O library */ -#include > /* error definitions and routines */ +#include /* C standard library */ +#include /* error definitions and routines */ #include /* file control functions */ +#include /* C strings library */ +#include /* system limits constants, types and functions */ #include "macros.h" @@ -85,39 +87,38 @@ int main(int argc, char *argv[]) * Main code beginning * * ***********************************************************/ - snprintf(fifoname, 80, "/tmp/fortune.%d", getpid()); /* compose name */ - if (mkfifo(fifoname, 0622)) { /* open client fifo */ + snprintf(fifoname, 80, "/tmp/fortune.%d", getpid()); /* compose name */ + if (mkfifo(fifoname, 0622)) { /* open client fifo */ if (errno!=EEXIST) { perror("Cannot create well known fifo"); exit(-1); } } - fifo_server = open(fortunefilename, O_WRONLY); /* open server fifo */ + fifo_server = open(fortunefilename, O_WRONLY); /* open server fifo */ if (fifo_server < 0) { perror("Cannot open well known fifo"); exit(-1); } debug("%s\n", fifoname); nread = write(fifo_server, fifoname, strlen(fifoname)+1); /* write name */ - close(fifo_server); /* close server fifo */ - fifo_client = open(fifoname, O_RDONLY); /* open client fifo */ + close(fifo_server); /* close server fifo */ + fifo_client = open(fifoname, O_RDONLY); /* open client fifo */ if (fifo_client < 0) { perror("Cannot open well known fifo"); exit(-1); } - nread = read(fifo_client, buffer, sizeof(buffer)); /* read answer */ - printf("%s", buffer); /* print fortune */ - close(fifo_client); /* close client */ + nread = read(fifo_client, buffer, sizeof(buffer)); /* read answer */ + printf("%s", buffer); /* print fortune */ + close(fifo_client); /* close client */ unlink(fifoname); /* remove client fifo */ } /* * routine to print usage info and exit */ void usage(void) { - printf("Elementary fortune server\n"); + printf("Elementary fortune client\n"); printf("Usage:\n"); - printf(" fortune [-h] [-f] \n"); + printf(" fortune [-h] \n"); printf(" -h print this help\n"); - printf(" -f filename set file for fortunes\n"); exit(1); } diff --git a/sources/FortuneParse.c b/sources/FortuneParse.c index b6a4531..2312167 100644 --- a/sources/FortuneParse.c +++ b/sources/FortuneParse.c @@ -32,7 +32,7 @@ /* * Include needed headers */ -#include /* predefined types */ +#include /* primitive system data types */ #include /* file characteristics constants and functions */ #include /* unix standard library */ #include /* standard I/O library */ diff --git a/sources/FullRead.c b/sources/FullRead.c index 6338c52..e08298e 100644 --- a/sources/FullRead.c +++ b/sources/FullRead.c @@ -24,11 +24,9 @@ * Author: Simone Piccardi * Jun. 2001 * - * $Id: FullRead.c,v 1.4 2003/07/27 23:41:04 piccardi Exp $ - * ****************************************************************/ -#include -#include +#include /* unix standard library */ +#include /* error definitions and routines */ ssize_t FullRead(int fd, void *buf, size_t count) { diff --git a/sources/FullWrite.c b/sources/FullWrite.c index f90e91a..f2ab384 100644 --- a/sources/FullWrite.c +++ b/sources/FullWrite.c @@ -24,11 +24,9 @@ * Author: Simone Piccardi * Jun. 2001 * - * $Id: FullWrite.c,v 1.4 2003/07/27 23:41:04 piccardi Exp $ - * ****************************************************************/ -#include -#include +#include /* unix standard library */ +#include /* error definitions and routines */ ssize_t FullWrite(int fd, const void *buf, size_t count) { diff --git a/sources/LockFile.c b/sources/LockFile.c index 432ec27..87c02a1 100644 --- a/sources/LockFile.c +++ b/sources/LockFile.c @@ -23,12 +23,10 @@ * * Author: S. Piccardi, Dec 2002 * - * $Id: LockFile.c,v 1.4 2003/05/02 09:55:14 piccardi Exp $ - * *****************************************************************************/ -#include -#include -#include /* unix standard functions */ +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* unix standard library */ #include /* file control functions */ /* * Function LockFile: diff --git a/sources/Mutex.c b/sources/Mutex.c index 2e2736e..55c5582 100644 --- a/sources/Mutex.c +++ b/sources/Mutex.c @@ -22,14 +22,12 @@ * * Author: S. Piccardi Dec. 2002 * - * $Id: Mutex.c,v 1.7 2003/05/02 09:55:14 piccardi Exp $ - * *****************************************************************************/ -#include /* IPC semaphore declarations */ -#include -#include +#include /* SysV semaphores */ +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ #include /* file control functions */ -#include /* signal handling declarations */ +#include /* signal constants, types and functions */ #include "Gapil.h" /* diff --git a/sources/PXDirMonitor.c b/sources/PXDirMonitor.c index 4c14abb..5f001fe 100644 --- a/sources/PXDirMonitor.c +++ b/sources/PXDirMonitor.c @@ -26,14 +26,12 @@ * * Author: S. Piccardi Jan. 2003 * - * $Id: PXDirMonitor.c,v 1.1 2003/05/02 09:50:55 piccardi Exp $ - * *****************************************************************************/ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ #include "Gapil.h" #include "macros.h" diff --git a/sources/ReadMonitor.c b/sources/ReadMonitor.c index 5165b81..6695f2a 100644 --- a/sources/ReadMonitor.c +++ b/sources/ReadMonitor.c @@ -25,14 +25,12 @@ * * Author: S. Piccardi Jan. 2003 * - * $Id: ReadMonitor.c,v 1.5 2003/05/02 09:55:14 piccardi Exp $ - * *****************************************************************************/ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ #include "Gapil.h" #include "macros.h" diff --git a/sources/SetTermAttr.c b/sources/SetTermAttr.c index 96aef88..d509d26 100644 --- a/sources/SetTermAttr.c +++ b/sources/SetTermAttr.c @@ -24,12 +24,10 @@ * Author: Simone Piccardi * Jun. 2001 * - * $Id: SetTermAttr.c,v 1.3 2003/05/02 09:55:14 piccardi Exp $ - * ****************************************************************/ -#include -#include -#include +#include /* unix standard library */ +#include /* terminals constants, types and functions */ +#include /* error definitions and routines */ int SetTermAttr(int fd, tcflag_t flag) { diff --git a/sources/SharedMem.c b/sources/SharedMem.c index 63282d0..16cae77 100644 --- a/sources/SharedMem.c +++ b/sources/SharedMem.c @@ -27,16 +27,16 @@ * Author: S. Piccardi * ***************************************************************/ -#include /* SysV IPC shared memory */ -#include /* primitive system data types */ -#include -#include /* standard I/O functions */ -#include /* file control functions */ -#include /* signal constants, types and functions */ -#include /* unix standard library */ +#include /* SysV shared memory */ +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* standard I/O library */ +#include /* file control functions */ +#include /* signal constants, types and functions */ +#include /* unix standard library */ #include -#include /* C strings library */ -#include /* error definitions and routines */ +#include /* C strings library */ +#include /* error definitions and routines */ #include "macros.h" /* ************************************************************************* diff --git a/sources/SigHand.c b/sources/SigHand.c index b5d6c7b..a37fac5 100644 --- a/sources/SigHand.c +++ b/sources/SigHand.c @@ -22,14 +22,12 @@ * * Author: S. Piccardi Dec. 2002 * - * $Id: SigHand.c,v 1.7 2003/05/06 14:05:12 piccardi Exp $ - * *****************************************************************************/ -#include /* error simbol definitions */ -#include /* standard I/O functions */ -#include /* signal handling declarations */ -#include -#include +#include /* error definitions and routines */ +#include /* standard I/O library */ +#include /* signal constants, types and functions */ +#include /* primitive system data types */ +#include /* process termination constants and functions */ #include "Gapil.h" #include "macros.h" @@ -97,7 +95,6 @@ inline SigFunc * SignalRestart(int signo, SigFunc *func) * Generic handler for SIGCHLD signal * * Simone Piccardi Dec. 2002 - * $Id: SigHand.c,v 1.7 2003/05/06 14:05:12 piccardi Exp $ */ void HandSigCHLD(int sig) { diff --git a/sources/Sleep.c b/sources/Sleep.c index ce5e416..09d9dbf 100644 --- a/sources/Sleep.c +++ b/sources/Sleep.c @@ -29,7 +29,7 @@ * Include needed headers */ #include /* unix standard library */ -#include /* POSIX signal library */ +#include /* signal constants, types and functions */ void alarm_hand(int); diff --git a/sources/SockUtil.c b/sources/SockUtil.c index 421919c..af3a3f7 100644 --- a/sources/SockUtil.c +++ b/sources/SockUtil.c @@ -32,9 +32,8 @@ #include /* C strings library */ #include /* error definitions and routines */ #include /* socket constants, types and functions */ -#include -#include -#include +#include /* IP addresses conversion utilities */ +#include /* C resolver library */ #include "macros.h" /************************************************************************** diff --git a/sources/TCP_countd.c b/sources/TCP_countd.c index d5c6021..8c4c0b3 100644 --- a/sources/TCP_countd.c +++ b/sources/TCP_countd.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/TCP_cunc_daytimed.c b/sources/TCP_cunc_daytimed.c index 5da2288..1b748de 100644 --- a/sources/TCP_cunc_daytimed.c +++ b/sources/TCP_cunc_daytimed.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/TCP_daytime.c b/sources/TCP_daytime.c index 80e2c38..ba6874f 100644 --- a/sources/TCP_daytime.c +++ b/sources/TCP_daytime.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ diff --git a/sources/TCP_echo.c b/sources/TCP_echo.c index 45bd7b8..879d900 100644 --- a/sources/TCP_echo.c +++ b/sources/TCP_echo.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* error definitions and routines */ diff --git a/sources/TCP_echo_fifth.c b/sources/TCP_echo_fifth.c index e29fe33..a40bbe9 100644 --- a/sources/TCP_echo_fifth.c +++ b/sources/TCP_echo_fifth.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* error definitions and routines */ diff --git a/sources/TCP_echo_first.c b/sources/TCP_echo_first.c index ce085ea..c064c04 100644 --- a/sources/TCP_echo_first.c +++ b/sources/TCP_echo_first.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ diff --git a/sources/TCP_echo_fourth.c b/sources/TCP_echo_fourth.c index 3a1aed6..d0ff8a6 100644 --- a/sources/TCP_echo_fourth.c +++ b/sources/TCP_echo_fourth.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* error definitions and routines */ diff --git a/sources/TCP_echo_second.c b/sources/TCP_echo_second.c index b9d932a..7fe3e20 100644 --- a/sources/TCP_echo_second.c +++ b/sources/TCP_echo_second.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* error definitions and routines */ diff --git a/sources/TCP_echo_third.c b/sources/TCP_echo_third.c index 952344f..fde406d 100644 --- a/sources/TCP_echo_third.c +++ b/sources/TCP_echo_third.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* error definitions and routines */ diff --git a/sources/TCP_echod.c b/sources/TCP_echod.c index a7f0d29..333a545 100644 --- a/sources/TCP_echod.c +++ b/sources/TCP_echod.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/TCP_echod_fifth.c b/sources/TCP_echod_fifth.c index 0f55072..de8464d 100644 --- a/sources/TCP_echod_fifth.c +++ b/sources/TCP_echod_fifth.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/TCP_echod_first.c b/sources/TCP_echod_first.c index 31e3c16..9cc1f8d 100644 --- a/sources/TCP_echod_first.c +++ b/sources/TCP_echod_first.c @@ -33,12 +33,12 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #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 /* signal constants, types and functions */ #include /* error definitions and routines */ #include /* C strings library */ #include /* C standard library */ diff --git a/sources/TCP_echod_fourth.c b/sources/TCP_echod_fourth.c index 394cd30..8847afb 100644 --- a/sources/TCP_echod_fourth.c +++ b/sources/TCP_echod_fourth.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/TCP_echod_second.c b/sources/TCP_echod_second.c index de9d2f2..283d28e 100644 --- a/sources/TCP_echod_second.c +++ b/sources/TCP_echod_second.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/TCP_echod_third.c b/sources/TCP_echod_third.c index 7fb35bb..a0ed4f9 100644 --- a/sources/TCP_echod_third.c +++ b/sources/TCP_echod_third.c @@ -33,7 +33,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/TCP_iter_daytimed.c b/sources/TCP_iter_daytimed.c index 2917b2d..d124ec9 100644 --- a/sources/TCP_iter_daytimed.c +++ b/sources/TCP_iter_daytimed.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/UDP_daytime.c b/sources/UDP_daytime.c index f99ff64..4298f9f 100644 --- a/sources/UDP_daytime.c +++ b/sources/UDP_daytime.c @@ -32,7 +32,7 @@ */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ diff --git a/sources/WriteShm.c b/sources/WriteShm.c index db5b132..ce5ea49 100644 --- a/sources/WriteShm.c +++ b/sources/WriteShm.c @@ -20,18 +20,18 @@ * * File WriteShm.c: * - * An example of POSIX shared memory use: wwrite some content to a + * An example of POSIX shared memory use: write some content to a * shared memory segment * * Author: S. Piccardi Jan. 2003 * *****************************************************************************/ -#include /* primitive system data types */ -#include -#include /* directory */ -#include /* C standard library */ -#include /* unix standard library */ -#include /* standard I/O library */ +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ +#include /* standard I/O library */ #include "Gapil.h" #include "macros.h" @@ -58,21 +58,21 @@ int main(int argc, char *argv[]) /* * Handling options */ - case 's': /* set pause (in sec.) */ + case 's': /* set pause (in sec.) */ size = strtol(optarg, NULL, 10); break; - case 'f': /* set pause (in sec.) */ + case 'f': /* set pause (in sec.) */ file_name = optarg; break; - case 'h': /* help option */ + case 'h': /* help option */ printf("Wrong -h option use\n"); usage(); return -1; break; - case '?': /* unrecognized options */ + case '?': /* unrecognized options */ printf("Unrecognized options -%c\n",optopt); usage(); - default: /* should not reached */ + default: /* should not reached */ usage(); } } @@ -83,12 +83,13 @@ int main(int argc, char *argv[]) * Main code beginning * * ***********************************************************/ - if ((argc - optind) != 1) { /* There must be remaing parameters */ + if ((argc - optind) != 1) { /* There must be remaing parameters */ printf("Wrong number of arguments %d\n", argc - optind); usage(); } + /* get a Mutex */ mutex_file = tempnam("/tmp","mutex"); - if ((mutex = CreateMutex(mutex_file)) == -1) { /* get a Mutex */ + if ((mutex = CreateMutex(mutex_file)) == -1) { perror("Cannot create mutex"); goto errmutex; } diff --git a/sources/cap_print.c b/sources/cap_print.c index 4d6e708..4e33061 100644 --- a/sources/cap_print.c +++ b/sources/cap_print.c @@ -23,9 +23,9 @@ * Author: S. Piccardi Dec. 2005 * *****************************************************************************/ -#include /* C standard library */ -#include /* I/O standard library */ -#include +#include /* C standard library */ +#include /* standard I/O library */ +#include /* unix standard library */ #include /* diff --git a/sources/endian.c b/sources/endian.c index d375d97..e7dbe0f 100644 --- a/sources/endian.c +++ b/sources/endian.c @@ -23,8 +23,6 @@ * Author: S. Piccardi * May. 2003 * - * $Id: endian.c,v 1.5 2003/08/16 18:30:21 piccardi Exp $ - * ***************************************************************/ int endian(void) diff --git a/sources/endtest.c b/sources/endtest.c index ffeca88..09dded4 100644 --- a/sources/endtest.c +++ b/sources/endtest.c @@ -1,4 +1,32 @@ -#include +/* endtest.c + * + * Copyright (C) 2003 Simone Piccardi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/*************************************************************** + * + * program endtest: program to detect endianess + * + * Author: S. Piccardi + * May. 2003 + * + ***************************************************************/ + +#include /* standard I/O library */ + int main(int argc, char *argv[]) { int i, val = 0xABCDEF01; diff --git a/sources/epoll_inotify_monitor.c b/sources/epoll_inotify_monitor.c index d6cf1cf..b6e07c2 100644 --- a/sources/epoll_inotify_monitor.c +++ b/sources/epoll_inotify_monitor.c @@ -31,12 +31,12 @@ #include /* Linux inotify interface */ #include /* Linux epoll interface */ #include /* C standard library */ -#include /* Unix standard library */ +#include /* unix standard library */ #include /* error definitions and routines */ #include /* standard I/O library */ #include /* C strings library */ #include /* file control function */ -#include /* ioctl function */ +#include /* ioctl syscall and constants */ #include "macros.h" diff --git a/sources/full_fread.c b/sources/full_fread.c index 329d7e4..6278f33 100644 --- a/sources/full_fread.c +++ b/sources/full_fread.c @@ -24,12 +24,10 @@ * Author: Simone Piccardi * Mar. 2005 * - * $Id$ - * ****************************************************************/ -#include -#include -#include /* include standard I/O library */ +#include /* unix standard library */ +#include /* error definitions and routines */ +#include /* standard I/O library */ size_t full_fread(FILE *file, void *buf, size_t count) { diff --git a/sources/full_fwrite.c b/sources/full_fwrite.c index d626b32..fc0d6c8 100644 --- a/sources/full_fwrite.c +++ b/sources/full_fwrite.c @@ -24,12 +24,10 @@ * Author: Simone Piccardi * Mar. 2005 * - * $Id$ - * ****************************************************************/ -#include -#include -#include /* include standard I/O library */ +#include /* unix standard library */ +#include /* error definitions and routines */ +#include /* standard I/O library */ size_t full_fwrite(FILE *file, const void *buf, size_t count) { diff --git a/sources/gethost.c b/sources/gethost.c index e949713..c269def 100644 --- a/sources/gethost.c +++ b/sources/gethost.c @@ -1,6 +1,6 @@ /* gethost.c * - * Copyright (C) 2001 Simone Piccardi + * Copyright (C) 2005 Simone Piccardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,16 +38,22 @@ #include /* C strings library */ #include /* primitive system data types */ #include /* socket constants, types and functions */ -#include +#include /* C resolver library */ -/* Help printing routine */ -void usage(void); -int main(int argc, char *argv[]) -{ /* - * Variables definition + * Function and globals definitions + */ +void usage(void); /* Help printing routine */ + +/* + * Main program */ +int main(int argc, char *argv[]) +{ + /* + * Variables definition + */ int i; int use = 0; struct hostent *host; diff --git a/sources/getparam.c b/sources/getparam.c index 521b0df..f44f51d 100644 --- a/sources/getparam.c +++ b/sources/getparam.c @@ -35,7 +35,7 @@ #include /* C standard library */ #include /* unix standard library */ #include /* C strings library */ -#include +#include /* system limits constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/iflist.c b/sources/iflist.c index 371714f..3cdc0f3 100644 --- a/sources/iflist.c +++ b/sources/iflist.c @@ -23,16 +23,15 @@ * Author: S. Piccardi Sep. 2006 * *****************************************************************************/ -#include -#include -#include /* C standard library */ -#include /* I/O standard library */ -#include -#include -#include -#include -#include -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* C standard library */ +#include /* standard I/O library */ +#include /* unix standard library */ +#include /* socket constants, types and functions */ +#include /* IP addresses conversion utilities */ +#include /* ioctl syscall and constants */ +#include /* network interfaces constants and types */ /* * Program iflist diff --git a/sources/inotify_monitor.c b/sources/inotify_monitor.c index db3e6b2..60fa103 100644 --- a/sources/inotify_monitor.c +++ b/sources/inotify_monitor.c @@ -30,12 +30,12 @@ #include /* file characteristics constants and functions */ #include /* Linux inotify interface */ #include /* C standard library */ -#include /* Unix standard library */ +#include /* unix standard library */ #include /* error definitions and routines */ #include /* standard I/O library */ #include /* C strings library */ #include /* file control functions */ -#include /* ioctl function */ +#include /* ioctl syscall and constants */ #include "macros.h" diff --git a/sources/is_closing.c b/sources/is_closing.c index e8ad3a3..ac3477a 100644 --- a/sources/is_closing.c +++ b/sources/is_closing.c @@ -27,13 +27,11 @@ * Author: Simone Piccardi * Sep. 2006 * - * $Id$ - * ****************************************************************/ -#include -#include -#include -#include /* error code */ +#include /* socket constants, types and functions */ +#include /* IPv4 and IPv6 constants and types */ +#include /* TCP constants and types */ +#include /* error definitions and routines */ # int is_closing(int sock) { diff --git a/sources/mygetaddr.c b/sources/mygetaddr.c index d3eb9d8..a6e9ecd 100644 --- a/sources/mygetaddr.c +++ b/sources/mygetaddr.c @@ -28,11 +28,11 @@ #include /* file characteristics constants and functions */ #include /* unix standard library */ #include /* C standard library */ -#include /* I/O standard library */ -#include +#include /* standard I/O library */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ -#include -#include +#include /* IPv4 and IPv6 constants and types */ +#include /* C resolver library */ #include "Gapil.h" /* diff --git a/sources/mygethost.c b/sources/mygethost.c index d5ee811..c585eb8 100644 --- a/sources/mygethost.c +++ b/sources/mygethost.c @@ -26,10 +26,10 @@ #include /* primitive system data types */ #include /* file characteristics constants and functions */ #include /* C standard library */ -#include /* I/O standard library */ +#include /* standard I/O library */ #include /* unix standard library */ -#include -#include +#include /* IP addresses conversion utilities */ +#include /* C resolver library */ diff --git a/sources/myls.c b/sources/myls.c index ffcaaef..9d900fd 100644 --- a/sources/myls.c +++ b/sources/myls.c @@ -22,14 +22,12 @@ * * Author: S. Piccardi Jan. 2003 * - * $Id: myls.c,v 1.4 2003/05/02 09:55:14 piccardi Exp $ - * *****************************************************************************/ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ #include "Gapil.h" /* diff --git a/sources/mylschroot.c b/sources/mylschroot.c index 7be3dbb..56b3d63 100644 --- a/sources/mylschroot.c +++ b/sources/mylschroot.c @@ -18,30 +18,32 @@ */ /***************************************************************************** * - * File myls.c: An example ls done after a chroot + * File mylschroot.c: An example ls done after a chroot + * List files and their size inside a given directory inside a chroot * * Author: S. Piccardi Mar. 2005 * - * $Id$ - * *****************************************************************************/ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include +/* + * Include needed headers + */ +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ #include "Gapil.h" -/* - * Program myls - * - * List files and their size inside a given directory + +/* + * Function and globals definitions */ -/* Help printing routine */ -void usage(void); -/* computation function for DirScan */ -int do_ls(struct dirent * direntry); +void usage(void); /* Help printing routine */ +int do_ls(struct dirent * direntry); /* computation function for DirScan */ +/* + * Main program + */ int main(int argc, char *argv[]) { int i; diff --git a/sources/poll_echod.c b/sources/poll_echod.c index 4af8f58..22bb9dd 100644 --- a/sources/poll_echod.c +++ b/sources/poll_echod.c @@ -31,10 +31,10 @@ * Include needed headers */ #define _XOPEN_SOURCE -#include /* system limits */ +#include /* system limits constants, types and functions */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/select_echod.c b/sources/select_echod.c index 49b8175..6c859cf 100644 --- a/sources/select_echod.c +++ b/sources/select_echod.c @@ -26,15 +26,13 @@ * * Usage: echod -h give all info * - * $Id: select_echod.c,v 1.2 2003/12/25 22:16:06 piccardi Exp $ - * ****************************************************************/ /* * Include needed headers */ #include /* primitive system data types */ #include /* unix standard library */ -#include /* IP addresses conversion utiliites */ +#include /* IP addresses conversion utilities */ #include /* socket constants, types and functions */ #include /* standard I/O library */ #include /* date and time constants, types and functions */ diff --git a/sources/wwwd.c b/sources/wwwd.c index db81af4..0b6dfde 100644 --- a/sources/wwwd.c +++ b/sources/wwwd.c @@ -33,25 +33,27 @@ #define _GNU_SOURCE #include /* primitive system data types */ #include /* file characteristics constants and functions */ -#include /* unix standard library */ #include /* C standard library */ +#include /* standard I/O library */ +#include /* unix standard library */ #include /* IP addresses conversion utilities */ #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 constants, types and functions */ #include /* error definitions and routines */ #include /* C strings library */ +#include /* directory operation constants and functions */ #include "Gapil.h" +/* + * Function and globals definitions + */ #define BACKLOG 10 #define MAXLINE 256 int demonize = 1; /* daemon use option: default is daemon */ int debugging = 0; /* debug info printing option: default is no debug */ - -/* Subroutines declaration */ struct code_page { char * code; char * name; @@ -64,12 +66,13 @@ void PrintErr(char * error); void print_headers(FILE *file, struct code_page code); void print_error(FILE *file, struct code_page page, char * string); -/* Program beginning */ -int main(int argc, char *argv[]) +/* + * Main program + */int main(int argc, char *argv[]) { -/* - * Variables definition - */ + /* + * Variables definition + */ int list_fd, conn_fd; int compat = 0; int reroot = 0; -- 2.30.2