aboutsummaryrefslogtreecommitdiff
path: root/bin/ps/keyword.c
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2002-06-08 18:11:52 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2002-06-08 18:11:52 +0000
commit2dda9fe910b32db7f56985176457987928cfbfdb (patch)
tree3bebaf3d611884556818aa1597fd122d74ad370a /bin/ps/keyword.c
parente8d027642611a87a65dfb5bdcf7d271d1597859a (diff)
downloadsrc-2dda9fe910b32db7f56985176457987928cfbfdb.tar.gz
src-2dda9fe910b32db7f56985176457987928cfbfdb.zip
Notes
Diffstat (limited to 'bin/ps/keyword.c')
-rw-r--r--bin/ps/keyword.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 17cdc780d046..e27a09d538ca 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -240,6 +240,7 @@ parsefmt(const char *p)
static struct varent *vtail;
char *tempstr, *tempstr1;
+#define FMTSEP " \t,\n"
tempstr1 = tempstr = strdup(p);
while (tempstr && *tempstr) {
char *cp;
@@ -247,10 +248,18 @@ parsefmt(const char *p)
struct varent *vent;
/*
- * Seperate the format by commas.
+ * If an item contains an equals sign, it specifies a column
+ * header, may contain embedded separator characters and
+ * is always the last item.
*/
- while ((cp = strsep(&tempstr, ",")) != NULL && *cp == '\0')
- /* void */;
+ if (tempstr[strcspn(tempstr, "="FMTSEP)] != '=')
+ while ((cp = strsep(&tempstr, FMTSEP)) != NULL &&
+ *cp == '\0')
+ /* void */;
+ else {
+ cp = tempstr;
+ tempstr = NULL;
+ }
if (cp == NULL || !(v = findvar(cp)))
continue;
if ((vent = malloc(sizeof(struct varent))) == NULL)