+ if(strncmp("PRIVMSG", cmd, 7) == 0 && txt != NULL) {
+ if(!(p = strchr(cmd, ' ')))
+ return;
+ *p = '\0';
+ chan = ++p;
+ for(; *p != '\0' && *p != ' '; p++);
+ *p = '\0';
+ snprintf(bufout, sizeof bufout, "<%s> %s", usr, txt);
+ printl(chan, bufout);
+ }
+ else if(strncmp("PING", cmd, 4) == 0 && txt != NULL) {
+ snprintf(bufout, sizeof bufout, "PONG %s\r\n", txt);
+ write(srv, bufout, strlen(bufout));
+ }
+ else {
+ if (txt != NULL)
+ (void) snprintf(bufout, sizeof bufout, ">< %s: %s", cmd, txt);
+ else
+ (void) snprintf(bufout, sizeof bufout, ">< %s: ", cmd);
+ printl(usr, bufout);
+ if(strncmp("NICK", cmd, 4) == 0 && strncmp(usr, nick, sizeof nick) == 0 && txt != NULL)
+ strncpy(nick, txt, sizeof nick - 1);