summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-06-08 18:11:52 +0000
committerjmallett <jmallett@FreeBSD.org>2002-06-08 18:11:52 +0000
commitef26e821fbc754fe3feb2d5003839df34f51d353 (patch)
tree3bebaf3d611884556818aa1597fd122d74ad370a /bin
parent82e04d4006b123c1ae720bee4f37d972c50b335a (diff)
downloadFreeBSD-src-ef26e821fbc754fe3feb2d5003839df34f51d353.zip
FreeBSD-src-ef26e821fbc754fe3feb2d5003839df34f51d353.tar.gz
Allow whitespace to act as a delimiter in the keywords list given to the -o,
again, but also allow it in the user-specified header, too. This is far more backwards compatible and SUSv3-happy than allowing only comma to seperate the keywords list. Submitted by: tjr
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/keyword.c15
-rw-r--r--bin/ps/ps.14
2 files changed, 14 insertions, 5 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 17cdc78..e27a09d 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)
diff --git a/bin/ps/ps.1 b/bin/ps/ps.1
index dca9055..bfccf6e 100644
--- a/bin/ps/ps.1
+++ b/bin/ps/ps.1
@@ -130,8 +130,8 @@ Keywords may be appended with an equals (``='') sign and a string.
This causes the printed header to use the specified string instead of
the standard header.
.It Fl o
-Display information associated with the comma separated list of keywords
-specified.
+Display information associated with the space or comma separated
+list of keywords specified.
Multiple keywords may also be given in the form of more than one
.Fl o
option.
OpenPOWER on IntegriCloud