prlimit: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
51a37c1906
commit
2dac37dd68
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue