diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-06-29 16:59:47 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-06-29 16:59:47 +0000 |
commit | f2ac9b2f4bfd75998283230e2591502f55524427 (patch) | |
tree | 58f7a24102f420542d67dd8711a11db77bb80ab4 /usr.bin | |
parent | dc8c3cb58f4192a1cfe70e8cfd1e828996751359 (diff) |
use warn() instead of perror; err*() are used already
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/fmt/fmt.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c index 65a1b1ee416..99bb899dba5 100644 --- a/usr.bin/fmt/fmt.c +++ b/usr.bin/fmt/fmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fmt.c,v 1.21 2004/04/01 23:14:19 tedu Exp $ */ +/* $OpenBSD: fmt.c,v 1.22 2004/06/29 16:59:46 mickey Exp $ */ /* Sensible version of fmt * @@ -170,7 +170,7 @@ #ifndef lint static const char rcsid[] = - "$OpenBSD: fmt.c,v 1.21 2004/04/01 23:14:19 tedu Exp $"; + "$OpenBSD: fmt.c,v 1.22 2004/06/29 16:59:46 mickey Exp $"; static const char copyright[] = "Copyright (c) 1997 Gareth McCaughan. All rights reserved.\n"; #endif /* not lint */ @@ -359,7 +359,7 @@ process_named_file(const char *name) FILE *f; if ((f = fopen(name, "r")) == NULL) { - perror(name); + warn(name); ++n_errors; } else { process_stream(f, name); @@ -468,7 +468,7 @@ process_stream(FILE *stream, const char *name) new_paragraph(output_in_paragraph ? last_indent : first_indent, 0); if (ferror(stream)) { - perror(name); + warn(name); ++n_errors; } } @@ -633,7 +633,7 @@ center_stream(FILE *stream, const char *name) } if (ferror(stream)) { - perror(name); + warn(name); ++n_errors; } } @@ -708,9 +708,10 @@ xrealloc(void *ptr, size_t nbytes) void usage(void) { + extern char *__progname; fprintf(stderr, - "Usage: fmt [-cmps] [-d chars] [-l num] [-t num]\n" + "Usage: %s [-cmps] [-d chars] [-l num] [-t num]\n" " [-w width | -width | goal [maximum]] [file ...]\n" "Options: -c center each line instead of formatting\n" " -d <chars> double-space after <chars> at line end\n" @@ -721,7 +722,6 @@ usage(void) " -s coalesce whitespace inside lines\n" " -t <n> have tabs every <n> columns\n" " -w <n> set maximum width to <n>\n" - " goal set target width to goal\n"); - exit (0); + " goal set target width to goal\n", __progname); + exit (1); } - |