diff options
author | michaels <michaels@cvs.openbsd.org> | 1996-08-01 00:29:11 +0000 |
---|---|---|
committer | michaels <michaels@cvs.openbsd.org> | 1996-08-01 00:29:11 +0000 |
commit | 6edefdb68777d682eb395900b8905a95bd3cac7d (patch) | |
tree | c71eb60354e571270373f813eadcdf7eb42d6422 /usr.bin | |
parent | ed0a4a5b416702a8495a7c48eff8598b3c31eddf (diff) |
whoops, goofed on the last one, this should be correct.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cmp/cmp.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 1ac921d9068..9df77c0736c 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmp.c,v 1.3 1996/08/01 00:01:38 michaels Exp $ */ +/* $OpenBSD: cmp.c,v 1.4 1996/08/01 00:29:10 michaels Exp $ */ /* $NetBSD: cmp.c,v 1.7 1995/09/08 03:22:56 tls Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cmp.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: cmp.c,v 1.3 1996/08/01 00:01:38 michaels Exp $"; +static char rcsid[] = "$OpenBSD: cmp.c,v 1.4 1996/08/01 00:29:10 michaels Exp $"; #endif #endif /* not lint */ @@ -114,26 +114,38 @@ endargs: } if (strcmp(file2 = argv[1], "-") == 0) { if (special) - errx(ERR_EXIT, - "standard input may only be specified once"); + if (sflag) + exit(ERR_EXIT); + else + errx(ERR_EXIT, + "standard input may only be specified once"); special = 1; fd2 = 0; file2 = "stdin"; } else if ((fd2 = open(file2, O_RDONLY, 0)) < 0) - err(ERR_EXIT, "%s", file2); + if (sflag) + exit(ERR_EXIT); + else + err(ERR_EXIT, "%s", file2); skip1 = argc > 2 ? strtoq(argv[2], NULL, 10) : 0; skip2 = argc == 4 ? strtoq(argv[3], NULL, 10) : 0; if (!special) { if (fstat(fd1, &sb1)) - err(ERR_EXIT, "%s", file1); + if (sflag) + exit(ERR_EXIT); + else + err(ERR_EXIT, "%s", file1); if (!S_ISREG(sb1.st_mode)) special = 1; else { if (fstat(fd2, &sb2)) - err(ERR_EXIT, "%s", file2); + if (sflag) + exit(ERR_EXIT); + else + err(ERR_EXIT, "%s", file2); if (!S_ISREG(sb2.st_mode)) special = 1; } |