diff options
author | Rob Landley <rob@landley.net> | 2019-04-21 02:36:49 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-04-21 02:36:49 -0500 |
commit | 9ecdc22a66cc3614b2274fd91000aafce7a5f549 (patch) | |
tree | 3d65687dafcde6bf25ad52640b629f7e0531c08d /toys | |
parent | 5a1a668ce924a9a94c4c4fec5df734070325eeb2 (diff) | |
download | toybox-9ecdc22a66cc3614b2274fd91000aafce7a5f549.tar.gz |
man: Whitespace
Diffstat (limited to 'toys')
-rw-r--r-- | toys/pending/man.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/toys/pending/man.c b/toys/pending/man.c index 57f77c61..912be8b5 100644 --- a/toys/pending/man.c +++ b/toys/pending/man.c @@ -29,18 +29,31 @@ static void newln() if (TT.any && TT.cell != 2) putchar('\n'); // gawk alias TT.any = TT.cell = 0; } -static void put(char *x) { while (*x && *x != '\n') TT.any = putchar(*x++); } +static void put(char *x) +{ + while (*x && *x != '\n') TT.any = putchar(*x++); +} -static void s(char *x, char *y) { // Substitute with same length or shorter. +// Substitute with same length or shorter. +static void s(char *x, char *y) +{ int i = strlen(x), j = strlen(y), k, l; + for (k = 0; TT.line[k]; k++) if (!strncmp(x, &TT.line[k], i)) { memmove(&TT.line[k], y, j); for (l = k += j; TT.line[l]; l++) TT.line[l] = TT.line[l + i - j]; } } -static char start(char *x) { return !strncmp(x, TT.line, strlen(x)); } -static void trim(char *x) { if (start(x)) while (*x++) TT.line++; } +static char start(char *x) +{ + return !strncmp(x, TT.line, strlen(x)); +} + +static void trim(char *x) +{ + if (start(x)) while (*x++) TT.line++; +} static void do_man(FILE *fp) { |