[hackers] [sbase] cmp: suppress file open error with sflag || Hiltjo Posthuma
commit 6dd138613e501f2dfb7735c93ead9b681b96e96d
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Wed Apr 9 15:28:16 2014 +0200
cmp: suppress file open error with sflag
Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
diff --git a/cmp.c b/cmp.c
index c130429..8a51a66 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -38,13 +38,19 @@ main(int argc, char *argv[])
usage();
fp[0] = fopen(argv[0], "r");
- if (!fp[0])
- enprintf(Error, "fopen %s:", argv[0]);
+ if (!fp[0]) {
+ if(!sflag)
+ weprintf("fopen %s:", argv[0]);
+ exit(Error);
+ }
fp[1] = stdin;
if (argc == 2) {
- if(!(fp[1] = fopen(argv[1], "r")))
- enprintf(Error, "fopen %s:", argv[1]);
+ if(!(fp[1] = fopen(argv[1], "r"))) {
+ if(!sflag)
+ weprintf("fopen %s:", argv[1]);
+ exit(Error);
+ }
}
for(n = 1; ; n++) {
Received on Wed Apr 09 2014 - 16:40:48 CEST
This archive was generated by hypermail 2.3.0
: Wed Apr 09 2014 - 16:48:30 CEST