For review: Patch to ps(1) old-style option parsing.

2001-08-15 Thread Chris Costello

   This is pretty low-priority and I don't think it needs to be
MFC'd for the 4.4 release, but there is a small error in ps's
old-style option handling.  An outstanding example of this is
when one runs `ps Uroot':

$ ps Uroot
ps: rooT: no such user
ps: No users specified

   The problem is that the function ps.c:kludge_oldps_options()
capitalizes any 't' at the end of the option string, regardless
of whether it's a flag or an option argument.  The patch attached
to this message should fix the problem.

-- 
+---++
| Chris Costello| The cost of living hasn't affected its popularity. |
| [EMAIL PROTECTED] ||
+---++


Index: ps.c
===
RCS file: /home/ncvs/src/bin/ps/ps.c,v
retrieving revision 1.40
diff -u -r1.40 ps.c
--- ps.c2001/05/30 03:27:07 1.40
+++ ps.c2001/08/15 20:55:04
@@ -599,8 +599,12 @@
 * if last letter is a 't' flag with no argument (in the context
 * 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.
 */
-   if (*cp == 't' && *s != '-')
+   if (strcspn(s, "MNOoUW") == len && *cp == 't' && *s != '-')
*cp = 'T';
else {
/*



Re: For review: Patch to ps(1) old-style option parsing.

2001-08-15 Thread Brian Somers

>This is pretty low-priority and I don't think it needs to be
> MFC'd for the 4.4 release, but there is a small error in ps's
> old-style option handling.  An outstanding example of this is
> when one runs `ps Uroot':

This has irritated me in the past too :*)  I've applied your patch to 
-current.  Thanks.
-- 
Brian <[EMAIL PROTECTED]><[EMAIL PROTECTED]>
  http://www.freebsd-services.com/
Don't _EVER_ lose your sense of humour !  



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message