diff options
Diffstat (limited to 'center.c')
-rw-r--r-- | center.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -61,7 +61,7 @@ main(int argc, char **argv) char *endptr; void (*centerfunc)(FILE *) = center; - while ((opt = getopt(argc, argv, ":ew:")) != -1) { + while ((opt = getopt(argc, argv, ":elw:")) != -1) { switch (opt) { case 'e': lenfunc = utf8len; @@ -127,7 +127,7 @@ center(FILE *fp) } len = lenfunc(line) + tabs * 8 - tabs; - for (int i = (width - len) / 2; i; i--) + for (int i = (width - len) / 2; i >= 0; i--) putchar(' '); fputs(line, stdout); } @@ -183,7 +183,7 @@ center_by_longest(FILE *fp) line = STAILQ_FIRST(&list_head); while (line != NULL) { int len = longest; - for (int i = ((width - len) / 2); i; i--) + for (int i = ((width - len) / 2); i >= 0; i--) putchar(' '); fputs(line->buffer, stdout); |