summaryrefslogtreecommitdiffstats
path: root/bin/ps
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2006-04-06 03:24:31 +0000
committergad <gad@FreeBSD.org>2006-04-06 03:24:31 +0000
commit20f9416a8ff9bdc789b849a3e29ff8e728e81472 (patch)
tree30e2d3810c5f15561c9d2fae5205a03375efe504 /bin/ps
parentd2dc014de0d2ed21eccdaf1c899a05a42610b65a (diff)
downloadFreeBSD-src-20f9416a8ff9bdc789b849a3e29ff8e728e81472.zip
FreeBSD-src-20f9416a8ff9bdc789b849a3e29ff8e728e81472.tar.gz
Re-correct commit 1.73, but this time in a way that does not cause
all column-headers to print in lowercase by default. I was in too much of a rush in committing 1.75, and didn't notice that the case had changed. This time I did considerably more testing, and used 'diff' instead of just quickly eyeballing the results... Apologies. I expect this means the dunce cap is mine for awhile. If this doesn't work, I'll just drop back to 1.72 and hide under my desk for awhile.
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/keyword.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 0c0f4c5..b7a887bc 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) {
OpenPOWER on IntegriCloud