]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
prlimit: use err_exclusive_options()
authorKarel Zak <kzak@redhat.com>
Thu, 26 Jul 2012 07:26:34 +0000 (09:26 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 26 Jul 2012 07:26:34 +0000 (09:26 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/prlimit.c

index cd9a96c623e7f800781021cb0c79a6bf14390970..c21542144aa5ebc1c3701c327d5e9f23fbdb2a13 100644 (file)
@@ -34,7 +34,6 @@
 #include "strutils.h"
 #include "list.h"
 #include "closestream.h"
-#include "optutils.h"
 
 #ifndef RLIMIT_RTTIME
 # define RLIMIT_RTTIME 15
@@ -484,12 +483,6 @@ int main(int argc, char **argv)
                RAW_OPTION,
                NOHEADINGS_OPTION
        };
-       enum {
-               EXCL_NONE,
-               EXCL_COMMAND,
-               EXCL_PID
-       };
-       int excl_pcom = EXCL_NONE;
 
        static const struct option longopts[] = {
                { "pid",        required_argument, NULL, 'p' },
@@ -585,7 +578,8 @@ int main(int argc, char **argv)
                        break;
 
                case 'p':
-                       exclusive_option(&excl_pcom, EXCL_PID + optind, _("--pid and --pid"));
+                       if (pid)
+                               errx(EXIT_FAILURE, _("only one --pid option may be specified."));
                        pid = strtos32_or_err(optarg, _("invalid PID argument"));
                        break;
                case 'h':
@@ -616,8 +610,7 @@ int main(int argc, char **argv)
                }
        }
        if (argc > optind && pid)
-               exclusive_option(&excl_pcom, EXCL_COMMAND,
-                                _("--pid and COMMAND"));
+               errx(EXIT_FAILURE, _("options --pid and COMMAND are mutually exclusive."));
        if (!ncolumns) {
                /* default columns */
                columns[ncolumns++] = COL_RES;