Varie correzioni, completata revisione capitolo sull'I/O su file
[gapil.git] / sources / FortuneServer.c
index 69e3b3413962faf3059c58fe0d1dd91d4f5dde88..4cb65cac20e3fea98cff688b0b0e5e9ab0f3ce86 100644 (file)
  *
  * Usage: fortuned -h give all info
  *
- * $Id: FortuneServer.c,v 1.4 2002/08/19 17:34:23 piccardi Exp $
- *
  ****************************************************************/
 /* 
  * Include needed headers
  */
-#include <sys/types.h>   /* predefined types */
-#include <sys/stat.h>    /*  */
-#include <unistd.h>      /* include unix standard library */
-#include <stdio.h>       /* include standard I/O library */
-#include <stdlib.h>     /* standard library */
-#include <string.h>     /* ANSI C standard string */
-#include <errno.h>      /* errorstring */
-#include <signal.h>     /* signals */
-#include <fcntl.h>      /*  */
+#include <sys/types.h>   /* primitive system data types */
+#include <sys/stat.h>    /* file characteristics constants and functions */
+#include <unistd.h>      /* unix standard library */
+#include <stdio.h>       /* standard I/O library */
+#include <stdlib.h>     /* standard library */
+#include <string.h>     /* C strings library */
+#include <errno.h>      /* error definitions and routines */
+#include <signal.h>     /* signal constants, types and functions */
+#include <fcntl.h>      /* file control functions */
 
 #include "macros.h"
-#include "wrappers.h"
+#include "Gapil.h"
 
 /* Subroutines declaration */
 void usage(void);
@@ -56,7 +54,7 @@ int main(int argc, char *argv[])
 {
 /* Variables definition */
     int i, n = 0;
-    char *fortunefilename = "/usr/share/games/fortunes/italia";
+    char *fortunefilename = "/usr/share/games/fortunes/linux";
     char **fortune;
     char line[80];
     int fifo_server, fifo_client;
@@ -112,6 +110,7 @@ int main(int argc, char *argv[])
            exit(1);
        }
     }
+    daemon(0, 0);
     /* open fifo two times to avoid EOF */
     fifo_server = open(fifoname, O_RDONLY);
     if (fifo_server < 0) {