I needed more functionality from pgrep/pkill, so I decided to add -s and -P 
and similar, and make a new config option for 'em.

Adding -s went just fine, but when I added a second option getopt32() wouldn't 
use it.

I.E. this does what I expect:

diff --git a/procps/pgrep.c b/procps/pgrep.c
index 0e8e529..b63539f 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -77,7 +77,9 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
                }
                first_arg_idx++;
        }
-       opt = getopt32(argv, "vlfxon");
+char *temp = NULL;
+       opt = getopt32(argv, "vlfxons:", &temp);
+printf("temp=%s\n",temp);
        argv[first_arg_idx] = first_arg;
 
        argv += optind;

Although I note it only works if I call "./busybox pgrep -s42" and not with 
"./busybox pgrep -s 42".

This does not work at all:

diff --git a/procps/pgrep.c b/procps/pgrep.c
index 0e8e529..38ff088 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -77,7 +77,9 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
                }
                first_arg_idx++;
        }
-       opt = getopt32(argv, "vlfxon");
+char *temp = NULL, *temp2 = NULL;
+       opt = getopt32(argv, "vlfxons:P:", &temp, &temp2);
+printf("temp=%s temp2=%s\n",temp, temp2);
        argv[first_arg_idx] = first_arg;
 
        argv += optind;

Using the second patch, -P never sets temp2.

Can anyone tell me what I'm doing wrong?  I seem to have missed a curve 
somewhere...

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to