Use errx(3).
This commit is contained in:
parent
06d45ff91d
commit
781408a293
@ -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 @@ __RCSID("$NetBSD: args.c,v 1.11 2014/09/04 04:06:07 mrg Exp $");
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -396,8 +397,7 @@ set_option(char *arg)
|
||||
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 @@ found:
|
||||
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 @@ indent: set_option: internal error: p_special %d\n", p->p_special);
|
||||
case PRO_INT:
|
||||
if (!isdigit((unsigned char)*param_start)) {
|
||||
need_param:
|
||||
fprintf(stderr, "indent: %s: ``%s'' requires a parameter\n",
|
||||
errx(1, "%s: ``%s'' requires a parameter",
|
||||
option_source, arg - 1);
|
||||
exit(1);
|
||||
}
|
||||
*p->p_obj = atoi(param_start);
|
||||
break;
|
||||
@ -460,8 +458,6 @@ indent: set_option: internal error: p_special %d\n", p->p_special);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1985 Sun Microsystems, Inc.\
|
||||
#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 @@ main(int argc, char **argv)
|
||||
* 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 @@ main(int argc, char **argv)
|
||||
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 */
|
||||
|
@ -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 @@ parsefont(struct fstate *f, const char *s0)
|
||||
if (*s == '-')
|
||||
sizedelta--;
|
||||
else {
|
||||
fprintf(stderr, "indent: bad font specification: %s\n", s0);
|
||||
exit(1);
|
||||
errx(1, "bad font specification: %s", s0);
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user