summaryrefslogtreecommitdiffstats
path: root/bin/ps/keyword.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2004-06-23 23:48:09 +0000
committergad <gad@FreeBSD.org>2004-06-23 23:48:09 +0000
commit30666d1f0f431b581eeacc45735ff41d85d27c23 (patch)
tree42f4c0ba023a1c380ef10b9c78d4a46eb691734d /bin/ps/keyword.c
parent8ab36c09a858cbd52cbf9795162660a1ff1a423c (diff)
downloadFreeBSD-src-30666d1f0f431b581eeacc45735ff41d85d27c23.zip
FreeBSD-src-30666d1f0f431b581eeacc45735ff41d85d27c23.tar.gz
Change "struct varent" to use the standard queue(8) macros, instead of
using it's own version of the same basic algorithm. Submitted by: part by Cyrille Lefevre, part of it done by me
Diffstat (limited to 'bin/ps/keyword.c')
-rw-r--r--bin/ps/keyword.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 8a1726a..60e9e2e 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -235,7 +235,6 @@ showkey(void)
void
parsefmt(const char *p, int user)
{
- static struct varent *vtail;
char *tempstr, *tempstr1;
#define FMTSEP " \t,\n"
@@ -282,16 +281,10 @@ parsefmt(const char *p, int user)
if (vent->var == NULL)
errx(1, "malloc failed");
memcpy(vent->var, v, sizeof(*vent->var));
- vent->next = NULL;
- if (vhead == NULL)
- vhead = vtail = vent;
- else {
- vtail->next = vent;
- vtail = vent;
- }
+ STAILQ_INSERT_TAIL(&varlist, vent, next_ve);
}
free(tempstr1);
- if (!vhead) {
+ if (STAILQ_EMPTY(&varlist)) {
warnx("no valid keywords; valid keywords:");
showkey();
exit(1);
OpenPOWER on IntegriCloud