]> granicus.if.org Git - procps-ng/commitdiff
sort cmd args and document OpenBSD differences
authoralbert <>
Wed, 21 Jul 2004 14:27:56 +0000 (14:27 +0000)
committeralbert <>
Wed, 21 Jul 2004 14:27:56 +0000 (14:27 +0000)
pgrep.c

diff --git a/pgrep.c b/pgrep.c
index 13e6768d1f31cc07453d4aa350faba8c10468241..681b962640ef5c489b42db3360fd586b87402be5 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -505,67 +505,62 @@ parse_opts (int argc, char **argv)
        
        while ((opt = getopt (argc, argv, opts)) != -1) {
                switch (opt) {
-               case 'f':
-                       opt_full = 1;
-                       break;
-               case 'l':
-                       opt_long = 1;
-                       break;
-               case 'n':
-                       if (opt_oldest|opt_negate|opt_newest)
+               case 'G':
+                       opt_rgid = split_list (optarg, conv_gid);
+                       if (opt_rgid == NULL)
                                usage (opt);
-                       opt_newest = 1;
                        ++criteria_count;
                        break;
-               case 'o':
-                       if (opt_oldest|opt_negate|opt_newest)
+//             case 'L':   // OpenBSD: print full args along w/ PID
+//                     opt_printargs = 1;
+//                     break;
+               case 'P':
+                       opt_ppid = split_list (optarg, conv_num);
+                       if (opt_ppid == NULL)
                                usage (opt);
-                       opt_oldest = 1;
                        ++criteria_count;
                        break;
-               case 'v':
-                       if (opt_oldest|opt_negate|opt_newest)
+               case 'U':
+                       opt_ruid = split_list (optarg, conv_uid);
+                       if (opt_ruid == NULL)
                                usage (opt);
-                       opt_negate = 1;
-                       break;
-               case 'x':
-                       opt_exact = 1;
+                       ++criteria_count;
                        break;
+               case 'V':
+                       fprintf(stdout, "%s (%s)\n", progname, procps_version);
+                       exit(0);
                case 'd':
                        opt_delim = strdup (optarg);
                        break;
-               case 'P':
-                       opt_ppid = split_list (optarg, conv_num);
-                       if (opt_ppid == NULL)
-                               usage (opt);
-                       ++criteria_count;
+               case 'f':
+                       opt_full = 1;
                        break;
                case 'g':
                        opt_pgrp = split_list (optarg, conv_pgrp);
                        if (opt_pgrp == NULL)
                                usage (opt);
                        break;
-               case 's':
-                       opt_sid = split_list (optarg, conv_sid);
-                       if (opt_sid == NULL)
-                               usage (opt);
-                       ++criteria_count;
+//             case 'i':
+//                     opt_insensitive = 1;
+//                     break;
+               case 'l':
+                       opt_long = 1;
                        break;
-               case 'u':
-                       opt_euid = split_list (optarg, conv_uid);
-                       if (opt_euid == NULL)
+               case 'n':
+                       if (opt_oldest|opt_negate|opt_newest)
                                usage (opt);
+                       opt_newest = 1;
                        ++criteria_count;
                        break;
-               case 'U':
-                       opt_ruid = split_list (optarg, conv_uid);
-                       if (opt_ruid == NULL)
+               case 'o':
+                       if (opt_oldest|opt_negate|opt_newest)
                                usage (opt);
+                       opt_oldest = 1;
                        ++criteria_count;
                        break;
-               case 'G':
-                       opt_rgid = split_list (optarg, conv_gid);
-                       if (opt_rgid == NULL)
+               case 's':
+                       opt_sid = split_list (optarg, conv_sid);
+                       if (opt_sid == NULL)
                                usage (opt);
                        ++criteria_count;
                        break;
@@ -575,12 +570,25 @@ parse_opts (int argc, char **argv)
                                usage (opt);
                        ++criteria_count;
                        break;
+               case 'u':
+                       opt_euid = split_list (optarg, conv_uid);
+                       if (opt_euid == NULL)
+                               usage (opt);
+                       ++criteria_count;
+                       break;
+               case 'v':
+                       if (opt_oldest|opt_negate|opt_newest)
+                               usage (opt);
+                       opt_negate = 1;
+                       break;
+               // Solaris -x, the standard, does ^(regexp)$
+               // OpenBSD -x, being broken, does a plain string
+               case 'x':
+                       opt_exact = 1;
+                       break;
                case '?':
                        usage (opt);
                        break;
-               case 'V':
-                       fprintf(stdout, "%s (%s)\n", progname, procps_version);
-                       exit(0);
                }
        }
         if (argc - optind == 1)