diff options
author | mcpcpc <michaelczigler@icloud.com> | 2020-09-23 07:41:36 -0400 |
---|---|---|
committer | mcpcpc <michaelczigler@icloud.com> | 2020-09-23 07:41:36 -0400 |
commit | ded0e5839d469195a493ccafe7ad4d063c9fcf87 (patch) | |
tree | a05ea6d1a639daf9fe67f16e985056af675787f9 | |
parent | remove for loop variable declaration (diff) | |
download | kirc-ded0e5839d469195a493ccafe7ad4d063c9fcf87.tar.gz kirc-ded0e5839d469195a493ccafe7ad4d063c9fcf87.tar.bz2 kirc-ded0e5839d469195a493ccafe7ad4d063c9fcf87.tar.xz kirc-ded0e5839d469195a493ccafe7ad4d063c9fcf87.tar.zst kirc-ded0e5839d469195a493ccafe7ad4d063c9fcf87.zip |
fix printw behavior, new gutl=20
-rw-r--r-- | kirc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -23,7 +23,7 @@ static int conn; /* connection socket */ static int verb = 0; /* verbose output (e.g. raw stream) */ static size_t cmax = 80; /* max number of chars per line */ -static size_t gutl = 10; /* max char width of left column */ +static size_t gutl = 20; /* max char width of left column */ static char chan[CHA_MAX] = "kirc"; /* channel */ static char * host = "irc.freenode.org"; /* irc host address */ static char * port = "6667"; /* server port */ @@ -131,14 +131,14 @@ printw(const char *format, ...) { for (i = 0; line[i] == ' '; ++i) putchar(line[i]); - spaceleft = cmax + gutl - (i - 1); + spaceleft = cmax - (i - 1); for(tok = strtok(&line[i], " "); tok != NULL; tok = strtok(NULL, " ")) { - wordwidth = strlen(tok); + wordwidth = strlen(tok) - 1; if ((wordwidth + spacewidth) > spaceleft) { - printf("\n%*.s%s ", (int) gutl + 1, "", tok); - spaceleft = cmax - (gutl + 1 + wordwidth); + printf("\n%*.s%s ", (int) gutl + 1, " ", tok); + spaceleft = cmax - (gutl + 1 + wordwidth + spacewidth); } else { printf("%s ", tok); spaceleft = spaceleft - (wordwidth + spacewidth); |