diff options
author | Michael Czigler <michaelczigler@icloud.com> | 2020-08-21 12:40:16 -0400 |
---|---|---|
committer | mcpcpc <michaelczigler@icloud.com> | 2020-08-21 21:50:42 -0400 |
commit | 113075e58d9f93b9c5a569f9bf7d439866103fbb (patch) | |
tree | db3e581a721de25a18debe98c95caf103c680996 | |
parent | add -o argument option for irc chat logging (diff) | |
download | kirc-113075e58d9f93b9c5a569f9bf7d439866103fbb.tar.gz kirc-113075e58d9f93b9c5a569f9bf7d439866103fbb.tar.bz2 kirc-113075e58d9f93b9c5a569f9bf7d439866103fbb.tar.xz kirc-113075e58d9f93b9c5a569f9bf7d439866103fbb.tar.zst kirc-113075e58d9f93b9c5a569f9bf7d439866103fbb.zip |
print formatted text (pre wordwrap) instead of raw to log
add new parser2 function for testing
removing unusable parser2 function
remove test log file
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | kirc.c | 11 |
2 files changed, 7 insertions, 5 deletions
@@ -1,3 +1,4 @@ kirc *.a *.o +*.txt @@ -30,9 +30,9 @@ static char * olog = NULL; /* log irc stream parh */ /* append string to specified file path */ static void -append_to_file(char *str) { - FILE *out = fopen(olog, "a"); - fprintf(out, "%s", str); +printa(char *str) { + FILE *out = fopen(olog, "a"); + fprintf(out, "%s", str); fclose(out); } @@ -85,7 +85,7 @@ raw(char *cmd_str, char *fmt, ...) { va_end(ap); if (verb) printf("<< %s", cmd_str); - if (olog) append_to_file(cmd_str); + if (olog) printa(cmd_str); write(conn, cmd_str, strlen(cmd_str)); } @@ -125,6 +125,8 @@ printw(const char *format, ...) { vsnprintf(line, IRC_MSG_MAX + 1, format, argptr); va_end(argptr); + if (olog) printa(line); + for (i = 0; isspace(line[i]); i++) printf("%c", line[i]); spaceleft = cmax + gutl - (i - 1); @@ -159,7 +161,6 @@ parser(int sl, char *s) { o = -1; if (verb) printf(">> %s", buf_c); - if (olog) append_to_file(buf_c); if (!strncmp(buf_c, "PING", 4)) { buf_c[1] = 'O'; |