Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/xargs/xargs.c
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | case 'n': | ||||
nargs = strtonum(optarg, 1, INT_MAX, &errstr); | nargs = strtonum(optarg, 1, INT_MAX, &errstr); | ||||
if (errstr) | if (errstr) | ||||
errx(1, "-n %s: %s", optarg, errstr); | errx(1, "-n %s: %s", optarg, errstr); | ||||
break; | break; | ||||
case 'o': | case 'o': | ||||
oflag = 1; | oflag = 1; | ||||
break; | break; | ||||
case 'P': | case 'P': | ||||
maxprocs = strtonum(optarg, 1, INT_MAX, &errstr); | maxprocs = strtonum(optarg, 0, INT_MAX, &errstr); | ||||
if (errstr) | if (errstr) | ||||
errx(1, "-P %s: %s", optarg, errstr); | errx(1, "-P %s: %s", optarg, errstr); | ||||
if (getrlimit(RLIMIT_NPROC, &rl) != 0) | if (getrlimit(RLIMIT_NPROC, &rl) != 0) | ||||
errx(1, "getrlimit failed"); | errx(1, "getrlimit failed"); | ||||
if (*endptr != '\0') | |||||
errx(1, "invalid number for -P option"); | |||||
if (maxprocs < 0) | |||||
errx(1, "value for -P option should be >= 0"); | |||||
if (maxprocs == 0 || maxprocs > rl.rlim_cur) | if (maxprocs == 0 || maxprocs > rl.rlim_cur) | ||||
maxprocs = rl.rlim_cur; | maxprocs = rl.rlim_cur; | ||||
break; | break; | ||||
case 'p': | case 'p': | ||||
pflag = 1; | pflag = 1; | ||||
break; | break; | ||||
case 'R': | case 'R': | ||||
Rflag = strtol(optarg, &endptr, 10); | Rflag = strtol(optarg, &endptr, 10); | ||||
▲ Show 20 Lines • Show All 605 Lines • Show Last 20 Lines |