David Gwynne(da...@gwynne.id.au) on 2017.04.19 11:41:40 +1000:
> i cant remember why i was looking at this, but strtoll annoys me.
> 
> ok?

ok, especially since the old code fails on

$ make -j a5 all

but not on

$ make -j 5a all

:-)
 
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/make/main.c,v
> retrieving revision 1.119
> diff -u -p -r1.119 main.c
> --- main.c    4 Jan 2016 10:59:23 -0000       1.119
> +++ main.c    19 Apr 2017 01:39:22 -0000
> @@ -310,14 +310,14 @@ MainParseArgs(int argc, char **argv)
>                       Lst_AtEnd(&makefiles, optarg);
>                       break;
>               case 'j': {
> -                char *endptr;
> +                     const char *errstr;
>  
>                       forceJobs = true;
> -                     maxJobs = strtol(optarg, &endptr, 0);
> -                     if (endptr == optarg) {
> +                     maxJobs = strtonum(optarg, 1, INT_MAX, &errstr);
> +                     if (errstr != NULL) {
>                               fprintf(stderr,
> -                                     "make: illegal argument to -j option -- 
> %s -- not a number\n",
> -                                     optarg);
> +                                 "make: illegal argument to -j option"
> +                                 " -- %s -- %s\n", optarg, errstr);
>                               usage();
>                       }
>                       record_option(c, optarg);
> 

Reply via email to