src/main.c
changeset 17 9a32b5242320
parent 16 33245bf7873a
child 18 4435146391ae
equal deleted inserted replaced
16:33245bf7873a 17:9a32b5242320
    92             fprintf (message.stream, "TOPIC %s :%s\r\n", uc.channel, uc.topic);
    92             fprintf (message.stream, "TOPIC %s :%s\r\n", uc.channel, uc.topic);
    93     }
    93     }
    94 
    94 
    95     while (!feof (message.stream)) {
    95     while (!feof (message.stream)) {
    96         *buf = '\0';
    96         *buf = '\0';
       
    97         fgets (buf, 512, message.stream);
    97 
    98 
    98         if (active)             /* SIGPROC */
    99         if (!active)            /* the bot was killed with SIGTERM */
    99             fgets (buf, 512, message.stream);
       
   100         else
       
   101             break;
   100             break;
   102 
   101 
   103         if ((command = irc_parsemessage (buf, &message))) {
   102         if ((command = irc_parsemessage (buf, &message))) {
   104             printf ("%10s %s %s\n", command, message.channel, message.line);
   103             printf ("%10s %s %s\n", command, message.channel, message.line);
   105             if (!strcmp (command, "ERROR") || !strcmp (command, "ENOMEM"))
   104             if (!strcmp (command, "ERROR") || !strcmp (command, "ENOMEM"))
   115     fclose (message.stream);
   114     fclose (message.stream);
   116 
   115 
   117     /*
   116     /*
   118      * cleanup
   117      * cleanup
   119      */
   118      */
   120 
       
   121     if (uc.nick)
   119     if (uc.nick)
   122         free (uc.nick);
   120         free (uc.nick);
   123     if (uc.pass)
   121     if (uc.pass)
   124         free (uc.pass);
   122         free (uc.pass);
   125     if (uc.server)
   123     if (uc.server)