Module Name:    src
Committed By:   christos
Date:           Wed Apr 11 18:52:05 UTC 2018

Modified Files:
        src/bin/ps: keyword.c print.c ps.c

Log Message:
use EXIT_FAILURE instead of 1


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/ps/keyword.c
cvs rdiff -u -r1.128 -r1.129 src/bin/ps/print.c
cvs rdiff -u -r1.89 -r1.90 src/bin/ps/ps.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ps/keyword.c
diff -u src/bin/ps/keyword.c:1.55 src/bin/ps/keyword.c:1.56
--- src/bin/ps/keyword.c:1.55	Sat Dec  9 09:56:54 2017
+++ src/bin/ps/keyword.c	Wed Apr 11 14:52:05 2018
@@ -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 @@ parsevarlist(const char *pp, struct varl
 		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 @@ parsevarlist(const char *pp, struct varl
 	}
  	free(sp);
 	if (SIMPLEQ_EMPTY(listptr))
-		errx(1, "no valid keywords");
+		errx(EXIT_FAILURE, "no valid keywords");
 }
 
 void
@@ -389,9 +389,9 @@ findvar(const char *p)
 		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;
 

Index: src/bin/ps/print.c
diff -u src/bin/ps/print.c:1.128 src/bin/ps/print.c:1.129
--- src/bin/ps/print.c:1.128	Sat Dec  9 09:56:54 2017
+++ src/bin/ps/print.c	Wed Apr 11 14:52:05 2018
@@ -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 @@ wchan(struct pinfo *pi, VARENT *ve, enum
 			(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 @@ printval(void *bp, VAR *v, enum mode mod
 		(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

Index: src/bin/ps/ps.c
diff -u src/bin/ps/ps.c:1.89 src/bin/ps/ps.c:1.90
--- src/bin/ps/ps.c:1.89	Fri Jan 12 18:01:14 2018
+++ src/bin/ps/ps.c	Wed Apr 11 14:52:05 2018
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19
 #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 @@ ttyname2dev(const char *ttname, int *xfl
 				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 @@ main(int argc, char *argv[])
 			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 @@ main(int argc, char *argv[])
 		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 @@ main(int argc, char *argv[])
 	 * 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 @@ setpinfo(struct kinfo_proc2 *ki, int nen
 
 	pi = calloc(nentries, sizeof(*pi));
 	if (pi == NULL)
-		err(1, "calloc");
+		err(EXIT_FAILURE, "calloc");
 
 	if (calc_pcpu && !nlistread)
 		donlist();
@@ -763,7 +763,7 @@ kludge_oldps_options(char *s)
 
 	len = strlen(s);
 	if ((newopts = ns = malloc(len + 3)) == NULL)
-		err(1, NULL);
+		err(EXIT_FAILURE, NULL);
 	/*
 	 * options begin with '-'
 	 */
@@ -815,10 +815,10 @@ parsenum(const char *str, const char *ms
 	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 @@ descendant_sort(struct pinfo *ki, int it
 			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) ? '|' : ' ';

Reply via email to