diff options
author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-05-24 06:00:47 +0000 |
---|---|---|
committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-05-24 06:00:47 +0000 |
commit | 5069e2716c082d52d4f861969686eb54685fc7e1 (patch) | |
tree | 0571a8f5b8e9120e2f99912d819a0854864d1d30 /usr.bin | |
parent | 7d05a3831403d0ae3e5392a93c254320a5da4fc9 (diff) | |
download | src-5069e2716c082d52d4f861969686eb54685fc7e1.tar.gz src-5069e2716c082d52d4f861969686eb54685fc7e1.zip |
If processing of one file fails, try to process the remaining files and
exit non-zero instead of immediately exiting (SUSv3).
Notes
Notes:
svn path=/head/; revision=97216
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/expand/expand.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/expand/expand.c b/usr.bin/expand/expand.c index ec2a20dafe95..f83419df6bbd 100644 --- a/usr.bin/expand/expand.c +++ b/usr.bin/expand/expand.c @@ -67,6 +67,7 @@ main(argc, argv) { register int c, column; register int n; + int rval; /* handle obsolete syntax */ while (argc > 1 && argv[1][0] == '-' && isdigit(argv[1][1])) { @@ -88,10 +89,15 @@ main(argc, argv) argc -= optind; argv += optind; + rval = 0; do { if (argc > 0) { - if (freopen(argv[0], "r", stdin) == NULL) - errx(1, "%s", argv[0]); + if (freopen(argv[0], "r", stdin) == NULL) { + warn("%s", argv[0]); + rval = 1; + argc--, argv++; + continue; + } argc--, argv++; } column = 0; @@ -144,7 +150,7 @@ main(argc, argv) } } } while (argc > 0); - exit(0); + exit(rval); } static void |