From: Karel Zak Date: Thu, 26 Jul 2012 07:26:34 +0000 (+0200) Subject: prlimit: use err_exclusive_options() X-Git-Tag: v2.22-rc1~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2dac37dd68ab17c73e4ed1a7cd2d065c1be20e39;p=thirdparty%2Futil-linux.git prlimit: use err_exclusive_options() Signed-off-by: Karel Zak --- diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c index cd9a96c623..c21542144a 100644 --- a/sys-utils/prlimit.c +++ b/sys-utils/prlimit.c @@ -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;