From 2dac37dd68ab17c73e4ed1a7cd2d065c1be20e39 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 26 Jul 2012 09:26:34 +0200 Subject: prlimit: use err_exclusive_options() Signed-off-by: Karel Zak --- sys-utils/prlimit.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'sys-utils/prlimit.c') diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c index cd9a96c62..c21542144 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; -- cgit v1.2.3-55-g7522