Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/indent Use errx(3).
details: https://anonhg.NetBSD.org/src/rev/44f9e6fdcb34
branches: trunk
changeset: 813852:44f9e6fdcb34
user: ginsbach <ginsbach%NetBSD.org@localhost>
date: Mon Feb 22 19:04:18 2016 +0000
description:
Use errx(3).
diffstat:
usr.bin/indent/args.c | 22 +++++++++-------------
usr.bin/indent/indent.c | 10 ++++------
usr.bin/indent/io.c | 7 +++----
3 files changed, 16 insertions(+), 23 deletions(-)
diffs (136 lines):
diff -r 2eff5e6ecf50 -r 44f9e6fdcb34 usr.bin/indent/args.c
--- a/usr.bin/indent/args.c Mon Feb 22 10:10:15 2016 +0000
+++ b/usr.bin/indent/args.c Mon Feb 22 19:04:18 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: args.c,v 1.11 2014/09/04 04:06:07 mrg Exp $ */
+/* $NetBSD: args.c,v 1.12 2016/02/22 19:04:18 ginsbach Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -68,7 +68,7 @@
#if 0
static char sccsid[] = "@(#)args.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: args.c,v 1.11 2014/09/04 04:06:07 mrg Exp $");
+__RCSID("$NetBSD: args.c,v 1.12 2016/02/22 19:04:18 ginsbach Exp $");
#endif
#endif /* not lint */
@@ -78,6 +78,7 @@
*/
#include <ctype.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -396,8 +397,7 @@
for (p = pro; p->p_name; p++)
if (*p->p_name == *arg && eqin(p->p_name, arg))
goto found;
- fprintf(stderr, "indent: %s: unknown parameter \"%s\"\n", option_source, arg - 1);
- exit(1);
+ errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1);
found:
switch (p->p_type) {
@@ -432,9 +432,8 @@
break;
default:
- fprintf(stderr, "\
-indent: set_option: internal error: p_special %d\n", p->p_special);
- exit(1);
+ errx(1, "set_option: internal error: p_special %d\n",
+ p->p_special);
}
break;
@@ -448,9 +447,8 @@
case PRO_INT:
if (!isdigit((unsigned char)*param_start)) {
need_param:
- fprintf(stderr, "indent: %s: ``%s'' requires a parameter\n",
- option_source, arg - 1);
- exit(1);
+ errx(1, "%s: ``%s'' requires a parameter",
+ option_source, arg - 1);
}
*p->p_obj = atoi(param_start);
break;
@@ -460,8 +458,6 @@
break;
default:
- fprintf(stderr, "indent: set_option: internal error: p_type %d\n",
- p->p_type);
- exit(1);
+ errx(1, "set_option: internal error: p_type %d", p->p_type);
}
}
diff -r 2eff5e6ecf50 -r 44f9e6fdcb34 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Mon Feb 22 10:10:15 2016 +0000
+++ b/usr.bin/indent/indent.c Mon Feb 22 19:04:18 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.19 2014/09/04 04:06:07 mrg Exp $ */
+/* $NetBSD: indent.c,v 1.20 2016/02/22 19:04:18 ginsbach Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -75,7 +75,7 @@
#if 0
static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93";
#else
-__RCSID("$NetBSD: indent.c,v 1.19 2014/09/04 04:06:07 mrg Exp $");
+__RCSID("$NetBSD: indent.c,v 1.20 2016/02/22 19:04:18 ginsbach Exp $");
#endif
#endif /* not lint */
@@ -236,8 +236,7 @@
* output file */
if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite
* the file */
- fprintf(stderr, "indent: input and output files must be different\n");
- exit(1);
+ errx(1, "input and output files must be different");
}
output = fopen(out_name, "w");
if (output == 0) /* check for create
@@ -245,8 +244,7 @@
err(1, "%s", out_name);
continue;
}
- fprintf(stderr, "indent: unknown parameter: %s\n", argv[i]);
- exit(1);
+ errx(1, "unknown parameter: %s", argv[i]);
} else
set_option(argv[i]);
} /* end of for */
diff -r 2eff5e6ecf50 -r 44f9e6fdcb34 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c Mon Feb 22 10:10:15 2016 +0000
+++ b/usr.bin/indent/io.c Mon Feb 22 19:04:18 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.15 2014/09/04 04:06:07 mrg Exp $ */
+/* $NetBSD: io.c,v 1.16 2016/02/22 19:04:18 ginsbach Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -68,7 +68,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: io.c,v 1.15 2014/09/04 04:06:07 mrg Exp $");
+__RCSID("$NetBSD: io.c,v 1.16 2016/02/22 19:04:18 ginsbach Exp $");
#endif
#endif /* not lint */
@@ -668,8 +668,7 @@
if (*s == '-')
sizedelta--;
else {
- fprintf(stderr, "indent: bad font specification: %s\n", s0);
- exit(1);
+ errx(1, "bad font specification: %s", s0);
}
s++;
}
Home |
Main Index |
Thread Index |
Old Index