mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
all numeric args now check the validity of their arg (that it's a number)
This commit is contained in:
parent
bf89a486a8
commit
deb6b2e3a7
1 changed files with 14 additions and 5 deletions
|
@ -99,7 +99,8 @@ usage (int status)
|
|||
int
|
||||
DecodeArgs (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int c;
|
||||
char *eptr;
|
||||
|
||||
memset (&options, 0, sizeof (options));
|
||||
options.verbosity = 0;
|
||||
|
@ -129,17 +130,25 @@ DecodeArgs (int argc, char **argv)
|
|||
exit (0);
|
||||
break;
|
||||
case 't': // threads
|
||||
options.threads = atoi (optarg);
|
||||
options.threads = strtol (optarg, &eptr, 10);
|
||||
if (eptr == optarg || *eptr)
|
||||
usage (1);
|
||||
break;
|
||||
case 'e': // extra
|
||||
options.extrabit = atoi (optarg);
|
||||
options.extrabit = strtol (optarg, &eptr, 10);
|
||||
if (eptr == optarg || *eptr)
|
||||
usage (1);
|
||||
options.extrabit = bound (0, options.extrabit, 2);
|
||||
break;
|
||||
case 'd': // scale distance
|
||||
options.distance = atof (optarg);
|
||||
options.distance = strtod (optarg, &eptr);
|
||||
if (eptr == optarg || *eptr)
|
||||
usage (1);
|
||||
break;
|
||||
case 'r': // scale range
|
||||
options.range = atof (optarg);
|
||||
options.range = strtod (optarg, &eptr);
|
||||
if (eptr == optarg || *eptr)
|
||||
usage (1);
|
||||
break;
|
||||
case 'f':
|
||||
bspfile = strdup (optarg);
|
||||
|
|
Loading…
Reference in a new issue