From 2bb92a933b5d336b879d13ccb35a31617ff9cf68 Mon Sep 17 00:00:00 2001 From: Peeter Must Date: Sun, 13 Mar 2016 17:04:40 +0200 Subject: [PATCH] Include alias "args" in /bin/ps. Include alias "args" required by SUSv3. Improve argument handling of aliases: allows specification of different heading as in "ps -o args=MOM". This will make some ports happier. Changes obtained from OpenBSD. --- bin/ps/keyword.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 2b77ac8..f3e005a 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -79,6 +79,7 @@ static const VAR var[] = { {"acflag", "ACFLG", NULL, 0, pvar, NULL, 3, POFF(acflag), USHORT, "x", NULL}, {"acflg", "", "acflag", 0, NULL, NULL, 0, 0, 0, NULL, NULL}, + {"args", "", "command", 0, NULL, NULL, 0, 0, 0, NULL, NULL}, {"batch", "BAT", NULL, 0, lpest, NULL, 3, LPOFF(origcpu), UINT, "d", NULL}, {"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, 0, NULL, NULL}, {"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, 0, NULL, NULL}, @@ -286,16 +287,15 @@ makevarent(const char *p) if (hp) *hp++ = '\0'; +aliased: key.name = p; v = bsearch(&key, var, sizeof(var)/sizeof(VAR) - 1, sizeof(VAR), vcmp); if (v && v->alias) { - if (hp) { - warnx("%s: illegal keyword specification", p); - eval = 1; - } - parsefmt(v->alias); - return(NULL); + p = v->alias; + if (hp == NULL && v->header[0] != '\0') + hp = strdup(v->header); + goto aliased; } if (!v) { warnx("%s: keyword not found", p); -- 2.7.0