From 63f1c8153389d97305625a41d3f5df1a1b0bb738 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 15 Jun 2023 07:01:27 +0530 Subject: 5.11: clean up, 80 char limit --- 5.11.c | 77 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/5.11.c b/5.11.c index 2677df7..4834d1b 100644 --- a/5.11.c +++ b/5.11.c @@ -21,27 +21,27 @@ int main(int argc, char **argv) while (--argc > 0 && **++argv == '-') { while (*++*argv) { switch (**argv) { - case 'e' : - entab_bool = TRUE; - break; - case 'd' : - detab_bool = TRUE; - break; - case 's' : - if (*++*argv != '=') - break; - - while (*++*argv && stop_position < MAXSTOPS) { - stops[stop_position++] = atoi(*argv); - printf("loooop -- %d\n", stop_position); - - while (isdigit(**argv)) - ++*argv; - - if (**argv == '\0') - --*argv; - } - break; + case 'e' : + entab_bool = TRUE; + break; + case 'd' : + detab_bool = TRUE; + break; + case 's' : + if (*++*argv != '=') + break; + + while (*++*argv && stop_position < MAXSTOPS) { + stops[stop_position++] = atoi(*argv); + printf("loooop -- %d\n", stop_position); + + while (isdigit(**argv)) + ++*argv; + + if (**argv == '\0') + --*argv; + } + break; } } } @@ -67,23 +67,24 @@ void detab(int *stops, int limit) while((input = getchar()) != EOF) { switch (input) { - case '\t' : - for (space = count%stops[stop_position]; space < stops[stop_position]; space++) - putchar(' '); - count = 0; - - if (stop_position < limit) - stop_position++; - - break; - case '\n' : - count = 0; - break; - default : - putchar(input); - count++; - break; - + case '\t' : + for (space = count%stops[stop_position]; space < + stops[stop_position]; space++) + putchar(' '); + count = 0; + + if (stop_position < limit) + stop_position++; + + break; + case '\n' : + count = 0; + break; + default : + putchar(input); + count++; + break; + } } } -- cgit v1.2.3