~vcs-imports/make/master

« back to all changes in this revision

Viewing changes to src/main.c

  • Committer: Paul Smith
  • Date: 2022-06-04 22:34:15 UTC
  • Revision ID: git-v1:e4b7ac21dc1663de1d901cda0b395d819b5c08ab
* src/misc.c (make_toui): Parse a string into an unsigned int

* src/makeint.h: Declare it.
* src/arscan.c (ar_scan): Replace atoi() calls with make_toui().
Modify some integral types to be more correct.
* src/job.c (load_too_high): Replace atoi() calls with make_toui().
* src/main.c (main): Ditto.
(decode_switches): Ditto.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1411
1411
                OUTPUT_TRACED ();
1412
1412
                ++ep;
1413
1413
              }
1414
 
            restarts = (unsigned int) atoi (ep);
 
1414
            restarts = make_toui (ep, NULL);
1415
1415
            export = v_noexport;
1416
1416
          }
1417
1417
 
1536
1536
  {
1537
1537
    struct variable *v = lookup_variable (STRING_SIZE_TUPLE (MAKELEVEL_NAME));
1538
1538
    if (v && v->value[0] != '\0' && v->value[0] != '-')
1539
 
      makelevel = (unsigned int) atoi (v->value);
 
1539
      makelevel = make_toui (v->value, NULL);
1540
1540
    else
1541
1541
      makelevel = 0;
1542
1542
  }
3187
3187
 
3188
3188
                  if (coptarg)
3189
3189
                    {
3190
 
                      int i = atoi (coptarg);
3191
 
                      const char *cp;
3192
 
 
3193
 
                      /* Yes, I realize we're repeating this in some cases.  */
3194
 
                      for (cp = coptarg; ISDIGIT (cp[0]); ++cp)
3195
 
                        ;
3196
 
 
3197
 
                      if (i < 1 || cp[0] != '\0')
 
3190
                      const char *err;
 
3191
                      unsigned int i = make_toui (coptarg, &err);
 
3192
 
 
3193
                      if (err || i == 0)
3198
3194
                        {
3199
3195
                          error (NILF, 0,
3200
3196
                                 _("the '-%c' option requires a positive integer argument"),