sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit b700d5a8ed5090ccd3454485805111357c326daf
parent 59d0b5cd978dca938c487fb0975d93b7f1f40bcc
Author: dwts <mr.dwts@gmail.com>
Date:   Tue, 22 Apr 2014 13:43:01 +0300

minor style changes

Diffstat:
Mcat.c | 15++++++++-------
Mfold.c | 14++++++++------
Mhead.c | 14++++++++------
3 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/cat.c b/cat.c @@ -25,14 +25,15 @@ main(int argc, char *argv[]) if(argc == 0) { concat(stdin, "<stdin>", stdout, "<stdout>"); - } else for(i = 0; i < argc; i++) { - if(!(fp = fopen(argv[i], "r"))) { - weprintf("fopen %s:", argv[i]); - continue; + } else { + for(i = 0; i < argc; i++) { + if(!(fp = fopen(argv[i], "r"))) { + weprintf("fopen %s:", argv[i]); + continue; + } + concat(fp, argv[i], stdout, "<stdout>"); + fclose(fp); } - concat(fp, argv[i], stdout, "<stdout>"); - fclose(fp); } - return EXIT_SUCCESS; } diff --git a/fold.c b/fold.c @@ -44,13 +44,15 @@ main(int argc, char *argv[]) if(argc == 0) { fold(stdin, width); - } else for(; argc > 0; argc--, argv++) { - if(!(fp = fopen(argv[0], "r"))) { - weprintf("fopen %s:", argv[0]); - continue; + } else { + for(; argc > 0; argc--, argv++) { + if(!(fp = fopen(argv[0], "r"))) { + weprintf("fopen %s:", argv[0]); + continue; + } + fold(fp, width); + fclose(fp); } - fold(fp, width); - fclose(fp); } return EXIT_SUCCESS; diff --git a/head.c b/head.c @@ -32,13 +32,15 @@ main(int argc, char *argv[]) if(argc == 0) { head(stdin, "<stdin>", n); - } else for(; argc > 0; argc--, argv++) { - if(!(fp = fopen(argv[0], "r"))) { - weprintf("fopen %s:", argv[0]); - continue; + } else { + for(; argc > 0; argc--, argv++) { + if(!(fp = fopen(argv[0], "r"))) { + weprintf("fopen %s:", argv[0]); + continue; + } + head(fp, argv[0], n); + fclose(fp); } - head(fp, argv[0], n); - fclose(fp); } return EXIT_SUCCESS;