# HG changeset patch # User Markus Bröker # Date 1229179246 -3600 # Node ID 33245bf7873a6fb78f0daaf2d10c4830b59c5f34 # Parent f19c1f9b4cd3383200fabff02f80443c150f4bbc The active = 0|1 thingy is essential for a networking application -> re-activated committer: Markus Bröker diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -23,9 +23,12 @@ #define LOCALE_PATH "/var/lib/nobody/data/locale" #endif +short active = 1; /* needed for a safe shutdown */ + void sigproc () { signal (SIGTERM, sigproc); + active = 0; } int main (int argc, char **argv) @@ -91,7 +94,11 @@ while (!feof (message.stream)) { *buf = '\0'; - fgets (buf, 512, message.stream); + + if (active) /* SIGPROC */ + fgets (buf, 512, message.stream); + else + break; if ((command = irc_parsemessage (buf, &message))) { printf ("%10s %s %s\n", command, message.channel, message.line); diff --git a/src/parse.c b/src/parse.c --- a/src/parse.c +++ b/src/parse.c @@ -61,6 +61,7 @@ "!debug: prints some debug infos\r\n", "!vaccuum: reorganizes the database\r\n", "!logout: Protected logout function\r\n", + NULL, }; const