Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
src: use EXIT_FAILURE instead of 1
details: https://anonhg.NetBSD.org/src/rev/c152471ea7a6
branches: trunk
changeset: 318076:c152471ea7a6
user: christos <christos%NetBSD.org@localhost>
date: Wed Apr 11 18:52:05 2018 +0000
description:
use EXIT_FAILURE instead of 1
diffstat:
bin/ps/keyword.c | 12 ++++++------
bin/ps/print.c | 8 ++++----
bin/ps/ps.c | 24 ++++++++++++------------
3 files changed, 22 insertions(+), 22 deletions(-)
diffs (182 lines):
diff -r 5029925c00e2 -r c152471ea7a6 bin/ps/keyword.c
--- a/bin/ps/keyword.c Wed Apr 11 18:51:22 2018 +0000
+++ b/bin/ps/keyword.c Wed Apr 11 18:52:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: keyword.c,v 1.55 2017/12/09 14:56:54 kamil Exp $ */
+/* $NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: keyword.c,v 1.55 2017/12/09 14:56:54 kamil Exp $");
+__RCSID("$NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $");
#endif
#endif /* not lint */
@@ -308,7 +308,7 @@
if ((v = findvar(cp)) == NULL)
continue;
if ((vent = malloc(sizeof(struct varent))) == NULL)
- err(1, NULL);
+ err(EXIT_FAILURE, NULL);
vent->var = v;
if (pos && *pos)
SIMPLEQ_INSERT_AFTER(listptr, *pos, vent, next);
@@ -320,7 +320,7 @@
}
free(sp);
if (SIMPLEQ_EMPTY(listptr))
- errx(1, "no valid keywords");
+ errx(EXIT_FAILURE, "no valid keywords");
}
void
@@ -389,9 +389,9 @@
char *newheader;
if ((newvar = malloc(sizeof(struct var))) == NULL)
- err(1, NULL);
+ err(EXIT_FAILURE, NULL);
if ((newheader = strdup(hp)) == NULL)
- err(1, NULL);
+ err(EXIT_FAILURE, NULL);
memcpy(newvar, v, sizeof(struct var));
newvar->header = newheader;
diff -r 5029925c00e2 -r c152471ea7a6 bin/ps/print.c
--- a/bin/ps/print.c Wed Apr 11 18:51:22 2018 +0000
+++ b/bin/ps/print.c Wed Apr 11 18:52:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.128 2017/12/09 14:56:54 kamil Exp $ */
+/* $NetBSD: print.c,v 1.129 2018/04/11 18:52:05 christos Exp $ */
/*
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-__RCSID("$NetBSD: print.c,v 1.128 2017/12/09 14:56:54 kamil Exp $");
+__RCSID("$NetBSD: print.c,v 1.129 2018/04/11 18:52:05 christos Exp $");
#endif
#endif /* not lint */
@@ -938,7 +938,7 @@
(void)asprintf(&buf, "%-*" PRIx64, v->width,
l->l_wchan);
if (buf == NULL)
- err(1, "%s", "");
+ err(EXIT_FAILURE, "%s", "");
strprintorsetwidth(v, buf, mode);
v->width = min(v->width, KI_WMESGLEN);
free(buf);
@@ -1333,7 +1333,7 @@
(void)printf(ofmt, width, CHK_INF127(GET(u_int64_t)));
return;
default:
- errx(1, "unknown type %d", v->type);
+ errx(EXIT_FAILURE, "unknown type %d", v->type);
}
#undef GET
#undef CHK_INF127
diff -r 5029925c00e2 -r c152471ea7a6 bin/ps/ps.c
--- a/bin/ps/ps.c Wed Apr 11 18:51:22 2018 +0000
+++ b/bin/ps/ps.c Wed Apr 11 18:52:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ps.c,v 1.89 2018/01/12 23:01:14 kamil Exp $ */
+/* $NetBSD: ps.c,v 1.90 2018/04/11 18:52:05 christos Exp $ */
/*
* Copyright (c) 2000-2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: ps.c,v 1.89 2018/01/12 23:01:14 kamil Exp $");
+__RCSID("$NetBSD: ps.c,v 1.90 2018/04/11 18:52:05 christos Exp $");
#endif
#endif /* not lint */
@@ -189,10 +189,10 @@
return makedev(pts, ptsminor);
}
errno = serrno;
- err(1, "%s", ttypath);
+ err(EXIT_FAILURE, "%s", ttypath);
}
if (!S_ISCHR(sb.st_mode))
- errx(1, "%s: not a terminal", ttypath);
+ errx(EXIT_FAILURE, "%s: not a terminal", ttypath);
return sb.st_rdev;
}
@@ -325,7 +325,7 @@
break;
case 'T':
if ((ttname = ttyname(STDIN_FILENO)) == NULL)
- errx(1, "stdin: not a terminal");
+ errx(EXIT_FAILURE, "stdin: not a terminal");
flag = ttyname2dev(ttname, &xflg, &what);
break;
case 't':
@@ -394,7 +394,7 @@
kd = kvm_openfiles(nlistf, memf, swapf, O_RDONLY, errbuf);
if (kd == NULL)
- errx(1, "%s", errbuf);
+ errx(EXIT_FAILURE, "%s", errbuf);
if (!fmt)
parsefmt(default_fmt);
@@ -425,7 +425,7 @@
* select procs
*/
if (!(kinfo = getkinfo_kvm(kd, what, flag, &nentries)))
- err(1, "%s", kvm_geterr(kd));
+ err(EXIT_FAILURE, "%s", kvm_geterr(kd));
if (nentries == 0) {
printheader();
return 1;
@@ -602,7 +602,7 @@
pi = calloc(nentries, sizeof(*pi));
if (pi == NULL)
- err(1, "calloc");
+ err(EXIT_FAILURE, "calloc");
if (calc_pcpu && !nlistread)
donlist();
@@ -763,7 +763,7 @@
len = strlen(s);
if ((newopts = ns = malloc(len + 3)) == NULL)
- err(1, NULL);
+ err(EXIT_FAILURE, NULL);
/*
* options begin with '-'
*/
@@ -815,10 +815,10 @@
ul = strtoul(str, &ep, 0);
if (*str == '\0' || *ep != '\0')
- errx(1, "Invalid %s: `%s'", msg, str);
+ errx(EXIT_FAILURE, "Invalid %s: `%s'", msg, str);
if (ul > INT_MAX)
- errx(1, "Out of range %s: `%s'", msg, str);
+ errx(EXIT_FAILURE, "Out of range %s: `%s'", msg, str);
return (int)ul;
}
@@ -904,7 +904,7 @@
continue;
}
if ((ki[src].prefix = malloc(lvl * 2 + 1)) == NULL)
- errx(1, "malloc failed");
+ errx(EXIT_FAILURE, "malloc failed");
for (n = 0; n < lvl - 2; n++) {
ki[src].prefix[n * 2] =
path[n / 8] & 1 << (n % 8) ? '|' : ' ';
Home |
Main Index |
Thread Index |
Old Index