projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use err/warn from the C library
[unix-history]
/
usr
/
src
/
bin
/
ps
/
keyword.c
diff --git
a/usr/src/bin/ps/keyword.c
b/usr/src/bin/ps/keyword.c
index
5445d40
..
b41794e
100644
(file)
--- a/
usr/src/bin/ps/keyword.c
+++ b/
usr/src/bin/ps/keyword.c
@@
-6,7
+6,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)keyword.c 5.1
5
(Berkeley) %G%";
+static char sccsid[] = "@(#)keyword.c 5.1
6
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-14,6
+14,7
@@
static char sccsid[] = "@(#)keyword.c 5.15 (Berkeley) %G%";
#include <sys/resource.h>
#include <sys/proc.h>
#include <sys/resource.h>
#include <sys/proc.h>
+#include <err.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
@@
-271,7
+272,7
@@
parsefmt(p)
if (!(v = findvar(cp)))
continue;
if ((vent = malloc(sizeof(struct varent))) == NULL)
if (!(v = findvar(cp)))
continue;
if ((vent = malloc(sizeof(struct varent))) == NULL)
- err(
"%s", strerror(errno)
);
+ err(
1, NULL
);
vent->var = v;
vent->next = NULL;
if (vhead == NULL)
vent->var = v;
vent->next = NULL;
if (vhead == NULL)
@@
-282,7
+283,7
@@
parsefmt(p)
}
}
if (!vhead)
}
}
if (!vhead)
- err
("no valid keywords\n
");
+ err
x(1, "no valid keywords
");
}
static VAR *
}
static VAR *
@@
-296,7
+297,7
@@
findvar(p)
key.name = p;
key.name = p;
- hp =
index
(p, '=');
+ hp =
strchr
(p, '=');
if (hp)
*hp++ = '\0';
if (hp)
*hp++ = '\0';
@@
-305,15
+306,14
@@
findvar(p)
if (v && v->alias) {
if (hp) {
if (v && v->alias) {
if (hp) {
- (void)fprintf(stderr,
- "ps: %s: illegal keyword specification\n", p);
+ warnx("%s: illegal keyword specification", p);
eval = 1;
}
parsefmt(v->alias);
return((VAR *)NULL);
}
if (!v) {
eval = 1;
}
parsefmt(v->alias);
return((VAR *)NULL);
}
if (!v) {
-
(void)fprintf(stderr, "ps: keyword %s not found\n
", p);
+
warnx("%s: keyword not found
", p);
eval = 1;
}
if (hp)
eval = 1;
}
if (hp)