mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-30 16:51:41 +00:00
Print an error message on illegal numerical arguments.
Submitted by: bin/9349 (slightly modified) Assar Westerlund <assar@sics.se>
This commit is contained in:
parent
3a1c425259
commit
97f8cf3b7f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=49331
@ -47,7 +47,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: main.c,v 1.29 1998/11/15 05:55:58 bde Exp $";
|
||||
"$Id: main.c,v 1.30 1999/03/01 06:01:05 imp Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*-
|
||||
@ -95,6 +95,7 @@ static const char rcsid[] =
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sysexits.h>
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
@ -204,11 +205,18 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
|
||||
Var_Append(MAKEFLAGS, "-B", VAR_GLOBAL);
|
||||
break;
|
||||
#ifdef REMOTE
|
||||
case 'L':
|
||||
maxLocal = atoi(optarg);
|
||||
case 'L': {
|
||||
char *endptr;
|
||||
|
||||
maxLocal = strtol(optarg, &endptr, 10);
|
||||
if (maxLocal < 0 || *endptr != '\0') {
|
||||
errx(EX_USAGE,
|
||||
"illegal argument to -L -- %s", optarg);
|
||||
}
|
||||
Var_Append(MAKEFLAGS, "-L", VAR_GLOBAL);
|
||||
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case 'P':
|
||||
usePipes = FALSE;
|
||||
@ -282,15 +290,22 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
|
||||
ignoreErrors = TRUE;
|
||||
Var_Append(MAKEFLAGS, "-i", VAR_GLOBAL);
|
||||
break;
|
||||
case 'j':
|
||||
case 'j': {
|
||||
char *endptr;
|
||||
|
||||
forceJobs = TRUE;
|
||||
maxJobs = atoi(optarg);
|
||||
maxJobs = strtol(optarg, &endptr, 10);
|
||||
if (maxJobs <= 0 || *endptr != '\0') {
|
||||
errx(EX_USAGE,
|
||||
"illegal argument to -j -- %s", optarg);
|
||||
}
|
||||
#ifndef REMOTE
|
||||
maxLocal = maxJobs;
|
||||
#endif
|
||||
Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
|
||||
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
|
||||
break;
|
||||
}
|
||||
case 'k':
|
||||
keepgoing = TRUE;
|
||||
Var_Append(MAKEFLAGS, "-k", VAR_GLOBAL);
|
||||
|
Loading…
Reference in New Issue
Block a user