tried to fix parse_lines #5
authorpk910 <philipp@zoelle1.de>
Wed, 10 Aug 2011 00:59:33 +0000 (02:59 +0200)
committerpk910 <philipp@zoelle1.de>
Wed, 10 Aug 2011 00:59:33 +0000 (02:59 +0200)
IRCParser.c

index 40edec9f662e7077167e5b38710f70af6d67d2ed..670d2875f2a731e3e1efb8fadc04ea75e8763af1 100644 (file)
@@ -9,17 +9,18 @@ static void register_irc_function(char *command, irc_cmd_t *func);
 static void parse_raw(struct ClientSocket *client, char *from, char *cmd, char **argv, int argc);
 
 int parse_lines(struct ClientSocket *client, char *lines, int len) {
-    int i, startpos = 0;
+    int i, used = 0;
+    char *line = lines;
     printf("PARSE: %s %d\n", lines, len);
     for(i = 0; i < len; i++) {
         if(lines[i] == '\r') //just zero it out :D
             lines[i] = 0;
         if(lines[i] == '\n') {
             lines[i] = 0;
-            parse_line(client, lines);
-            lines += i-startpos+1;
-            printf("SKIP %d: %s\n", i-startpos+1, lines);
-            startpos = i+1;
+            parse_line(client, line);
+            line = lines+(i+1);
+            printf("SKIP %d: %s\n", i-startpos+1, line);
+            used = i+1;
         }
     }
     return startpos;