X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FMQFortuneServer.c;h=cac9e3ad80a0425727139d352231488f67c73367;hp=cae21ea717d30b6e91d864c9fea968364b5f1fb1;hb=26f7a8bb19c6cb198c213757a97b6ac79e40db4b;hpb=6483a787322c614bc6282a0bf0ee001f1bf54b44 diff --git a/sources/MQFortuneServer.c b/sources/MQFortuneServer.c index cae21ea..cac9e3a 100644 --- a/sources/MQFortuneServer.c +++ b/sources/MQFortuneServer.c @@ -26,22 +26,20 @@ * * Usage: fortuned -h give all info * - * $Id: MQFortuneServer.c,v 1.3 2002/12/03 11:06:05 piccardi Exp $ - * ****************************************************************/ /* * Include needed headers */ -#include /* predefined types */ -#include /* */ -#include /* include unix standard library */ -#include /* include standard I/O library */ -#include /* standard library */ -#include /* ANSI C standard string */ -#include /* errorstring */ -#include /* signals */ -#include -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* unix standard library */ +#include /* standard I/O library */ +#include /* C standard library */ +#include /* C strings library */ +#include /* error definitions and routines */ +#include /* signal constants, types and functions */ +#include /* SysV IPC functions */ +#include /* SysV message queues */ #include "macros.h" #include "Gapil.h" @@ -60,7 +58,7 @@ int main(int argc, char *argv[]) /* Variables definition */ int i, n = 0; char **fortune; /* array of fortune message string */ - char *fortunefilename; /* fortune file name */ + char *fortunefilename = "/usr/share/games/fortunes/linux"; /* file name */ struct msgbuf_read { /* message struct to read request from clients */ long mtype; /* message type, must be 1 */ long pid; /* message data, must be the pid of the client */ @@ -123,6 +121,7 @@ int main(int argc, char *argv[]) } /* Main body: loop over requests */ + daemon(0, 0); while (1) { msgrcv(msgid, &msg_read, sizeof(int), 1, MSG_NOERROR); debug("received request from %d\n", msg_read.pid);