The active = 0|1 thingy is essential for a networking application -> re-activated
committer: Markus Bröker <mbroeker@largo.homelinux.org>
--- 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);
--- 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