diff options
author | sinanmohd <sinan@firemail.cc> | 2023-06-15 07:01:27 +0530 |
---|---|---|
committer | sinanmohd <sinan@firemail.cc> | 2023-06-15 07:02:19 +0530 |
commit | 63f1c8153389d97305625a41d3f5df1a1b0bb738 (patch) | |
tree | 373f5ec015cae86d6e013edcaecf901badf921d8 /5.11.c | |
parent | 746ea2a4ed3d395a7460ce627c64a2e1a222bc7e (diff) |
Diffstat (limited to '5.11.c')
-rw-r--r-- | 5.11.c | 77 |
1 files changed, 39 insertions, 38 deletions
@@ -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; + } } } |