diff options
author | Garance A Drosehn <gad@FreeBSD.org> | 2006-03-08 08:58:44 +0000 |
---|---|---|
committer | Garance A Drosehn <gad@FreeBSD.org> | 2006-03-08 08:58:44 +0000 |
commit | ec7164873715b69a0d5dfb911496094afbb658a9 (patch) | |
tree | 3e30f2e26d73c5f1e49adb336a7fe359518489e9 /bin | |
parent | 67bcd646706e32d58ae9ffbcbd0cf0addaf5fdfe (diff) | |
download | src-test2-ec7164873715b69a0d5dfb911496094afbb658a9.tar.gz src-test2-ec7164873715b69a0d5dfb911496094afbb658a9.zip |
Notes
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ps/keyword.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 564bb31e1222..a80b8ed3dcbb 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -295,8 +295,9 @@ parsefmt(const char *p, int user) static VAR * findvar(char *p, int user, char **header) { + size_t rflen; VAR *v, key; - char *hp; + char *hp, *realfmt; hp = strchr(p, '='); if (hp) @@ -306,11 +307,17 @@ findvar(char *p, int user, char **header) 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, user); + /* + * XXX - This processing will not be correct for any alias + * which expands into a list of format keywords. Presently + * there are no aliases which do that. + */ + rflen = strlen(v->alias) + strlen(hp) + 2; + realfmt = malloc(rflen); + strlcpy(realfmt, v->alias, rflen); + strlcat(realfmt, "=", rflen); + strlcat(realfmt, hp, rflen); + parsefmt(realfmt, user); return ((VAR *)NULL); } if (!v) { |