]> granicus.if.org Git - procps-ng/commitdiff
pgrep: distinguish between invalid commandline parameters and '-?'
authorJan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
Tue, 24 Nov 2009 00:00:49 +0000 (11:00 +1100)
committerCraig Small <csmall@enc.com.au>
Sun, 18 Dec 2011 11:38:03 +0000 (22:38 +1100)
A patch from Debian.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=413383
Backported-by: Sami Kerola <kerolasa@iki.fi>
pgrep.c

diff --git a/pgrep.c b/pgrep.c
index 7a2ffb807c7dec3d300fdb24643ee7789380b805..c8cd0cac3c8ae35c8cdb75ce49f9ae182b18bae6 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -684,7 +684,7 @@ static void parse_opts (int argc, char **argv)
 //             case 'z':   // Solaris: match by zone ID
 //                     break;
                case '?':
-                       usage (opt);
+                       usage (optopt ? optopt : opt);
                        break;
                }
        }