aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGarance A Drosehn <gad@FreeBSD.org>2004-05-23 21:21:07 +0000
committerGarance A Drosehn <gad@FreeBSD.org>2004-05-23 21:21:07 +0000
commit2631c7774f02335c775edb2e1ddb5d18d5428047 (patch)
tree417e88da5bce7f58bb917beec3254b2767d84aab /bin
parent25fbb2c38c0647f38d3227b80cdd85e4251d7410 (diff)
downloadsrc-2631c7774f02335c775edb2e1ddb5d18d5428047.tar.gz
src-2631c7774f02335c775edb2e1ddb5d18d5428047.zip
Fix the kludge-old-options processing so `ps tpt' will be treated the
same as `ps -tpt', instead of being changed into `ps -tpT'. PR: bin/52489 Submitted by: Jilles Tjoelker MFC after: 1 week
Notes
Notes: svn path=/head/; revision=129634
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/ps.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 5a65aa4db37c..b2b7b27c8177 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1104,11 +1104,12 @@ kludge_oldps_options(char *s)
* of the oldps options -- option string NOT starting with a '-' --
* then convert to 'T' (meaning *this* terminal, i.e. ttyname(0)).
*
- * However, if a flag accepting a string argument is found in the
- * option string, the remainder of the string is the argument to
- * that flag; do not modify that argument.
+ * However, if a flag accepting a string argument is found earlier
+ * in the option string (including a possible `t' flag), then the
+ * remainder of the string must be the argument to that flag; so
+ * do not modify that argument.
*/
- if (strcspn(s, "MNOoU") == len && *cp == 't' && *s != '-')
+ if (*cp == 't' && *s != '-' && strcspn(s, "MNOoUt") == len - 1)
*cp = 'T';
else {
/*