diff options
| author | Garance A Drosehn <gad@FreeBSD.org> | 2006-04-06 03:24:31 +0000 |
|---|---|---|
| committer | Garance A Drosehn <gad@FreeBSD.org> | 2006-04-06 03:24:31 +0000 |
| commit | 6331f11ecaa1b65c844bfe5f72474f1128fa2cf8 (patch) | |
| tree | 30e2d3810c5f15561c9d2fae5205a03375efe504 /bin/ps | |
| parent | c0a1b804a74d6ab1905c89c8da35c778fa602efe (diff) | |
Notes
Diffstat (limited to 'bin/ps')
| -rw-r--r-- | bin/ps/keyword.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 0c0f4c5535fa..b7a887bcb88b 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -302,22 +302,31 @@ findvar(char *p, int user, char **header) hp = strchr(p, '='); if (hp) *hp++ = '\0'; - else - hp = p; key.name = p; v = bsearch(&key, var, sizeof(var)/sizeof(VAR) - 1, sizeof(VAR), vcmp); if (v && v->alias) { /* - * 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. + * If the user specified an alternate-header for this + * (aliased) format-name, then we need to copy that + * alternate-header when making the recursive call to + * process the alias. */ - rflen = strlen(v->alias) + strlen(hp) + 2; - realfmt = malloc(rflen); - snprintf(realfmt, rflen, "%s=%s", v->alias, hp); - parsefmt(realfmt, user); + if (hp == NULL) + parsefmt(v->alias, user); + else { + /* + * 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); + snprintf(realfmt, rflen, "%s=%s", v->alias, hp); + parsefmt(realfmt, user); + } return ((VAR *)NULL); } if (!v) { |
