src/main.c
changeset 10 311ea5fa60dd
parent 9 aff6726b8b87
child 11 a769385a59c6
equal deleted inserted replaced
9:aff6726b8b87 10:311ea5fa60dd
     5  */
     5  */
     6 
     6 
     7 #include <stdio.h>
     7 #include <stdio.h>
     8 #include <stdlib.h>
     8 #include <stdlib.h>
     9 #include <string.h>
     9 #include <string.h>
    10 
       
    11 #include <sys/types.h>
       
    12 #include <sys/socket.h>
       
    13 #include <netinet/in.h>
       
    14 #include <arpa/inet.h>
       
    15 #include <netdb.h>
       
    16 
    10 
    17 #include <signal.h>
    11 #include <signal.h>
    18 #include <locale.h>
    12 #include <locale.h>
    19 #include <libintl.h>
    13 #include <libintl.h>
    20 
    14 
    35 }
    29 }
    36 
    30 
    37 int main (int argc, char **argv)
    31 int main (int argc, char **argv)
    38 {
    32 {
    39     UC uc;
    33     UC uc;
    40     MSG message = { NULL, 0, 0, 0, 0, 0, 0 };
    34     MSG message;
    41     char buf[513];
    35     char buf[513];
    42     char *msg;
    36     char *msg;
    43     char *command;
    37     char *command;
    44     int len;
    38     int len;
    45 
    39 
    94         if (uc.topic)
    88         if (uc.topic)
    95             fprintf (message.stream, "TOPIC %s :%s\r\n", uc.channel, uc.topic);
    89             fprintf (message.stream, "TOPIC %s :%s\r\n", uc.channel, uc.topic);
    96     }
    90     }
    97 
    91 
    98     while (!feof (message.stream)) {
    92     while (!feof (message.stream)) {
    99         message.line = NULL;
       
   100         *buf = 0;
    93         *buf = 0;
   101         fgets (buf, 512, message.stream);
    94         fgets (buf, 512, message.stream);
   102 
    95 
   103         if ((command = irc_parsemessage (buf, &message))) {
    96         if ((command = irc_parsemessage (buf, &message))) {
   104             printf ("%10s %s %s\n", command, message.channel, message.line);
    97             printf ("%10s %s %s\n", command, message.channel, message.line);