From 4680df73af087d5d9a4c31114f623245da99ec77 Mon Sep 17 00:00:00 2001 From: gad Date: Sun, 23 May 2004 21:21:07 +0000 Subject: 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 --- bin/ps/ps.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 5a65aa4..b2b7b27 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 { /* -- cgit v1.1