minor style changes

This commit is contained in:
dwts 2014-04-22 13:43:01 +03:00 committed by sin
parent 59d0b5cd97
commit b700d5a8ed
3 changed files with 24 additions and 19 deletions

15
cat.c
View File

@ -25,14 +25,15 @@ main(int argc, char *argv[])
if(argc == 0) { if(argc == 0) {
concat(stdin, "<stdin>", stdout, "<stdout>"); concat(stdin, "<stdin>", stdout, "<stdout>");
} else for(i = 0; i < argc; i++) { } else {
if(!(fp = fopen(argv[i], "r"))) { for(i = 0; i < argc; i++) {
weprintf("fopen %s:", argv[i]); if(!(fp = fopen(argv[i], "r"))) {
continue; 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; return EXIT_SUCCESS;
} }

14
fold.c
View File

@ -44,13 +44,15 @@ main(int argc, char *argv[])
if(argc == 0) { if(argc == 0) {
fold(stdin, width); fold(stdin, width);
} else for(; argc > 0; argc--, argv++) { } else {
if(!(fp = fopen(argv[0], "r"))) { for(; argc > 0; argc--, argv++) {
weprintf("fopen %s:", argv[0]); if(!(fp = fopen(argv[0], "r"))) {
continue; weprintf("fopen %s:", argv[0]);
continue;
}
fold(fp, width);
fclose(fp);
} }
fold(fp, width);
fclose(fp);
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;

14
head.c
View File

@ -32,13 +32,15 @@ main(int argc, char *argv[])
if(argc == 0) { if(argc == 0) {
head(stdin, "<stdin>", n); head(stdin, "<stdin>", n);
} else for(; argc > 0; argc--, argv++) { } else {
if(!(fp = fopen(argv[0], "r"))) { for(; argc > 0; argc--, argv++) {
weprintf("fopen %s:", argv[0]); if(!(fp = fopen(argv[0], "r"))) {
continue; weprintf("fopen %s:", argv[0]);
continue;
}
head(fp, argv[0], n);
fclose(fp);
} }
head(fp, argv[0], n);
fclose(fp);
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;