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);