From fcdda3c7edcabfbacb007613fcad03a4d97b745f Mon Sep 17 00:00:00 2001 From: tjr Date: Fri, 24 May 2002 06:00:47 +0000 Subject: If processing of one file fails, try to process the remaining files and exit non-zero instead of immediately exiting (SUSv3). --- usr.bin/expand/expand.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/usr.bin/expand/expand.c b/usr.bin/expand/expand.c index ec2a20d..f83419d 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 -- cgit v1.1