From: Jim Meyering Date: Fri, 27 Jan 1995 05:22:23 +0000 (+0000) Subject: . X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd6a92931bd9aa252d353d585b10357fd73214ca;p=pspp . --- diff --git a/lib/getdate.y b/lib/getdate.y index 77d63a9e9e..8f0872d721 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -585,10 +585,14 @@ ToSeconds (Hours, Minutes, Seconds, Meridian) case MERam: if (Hours < 1 || Hours > 12) return -1; + if (Hours == 12) + Hours = 0; return (Hours * 60L + Minutes) * 60L + Seconds; case MERpm: if (Hours < 1 || Hours > 12) return -1; + if (Hours == 12) + Hours = 0; return ((Hours + 12) * 60L + Minutes) * 60L + Seconds; default: abort (); diff --git a/lib/strtod.c b/lib/strtod.c index 2f6b894cfa..0d364f2384 100644 --- a/lib/strtod.c +++ b/lib/strtod.c @@ -19,6 +19,10 @@ #endif #include +#ifndef errno +extern int errno; +#endif + #include #include @@ -34,7 +38,6 @@ #include #else #define NULL 0 -extern int errno; #ifndef HUGE_VAL #define HUGE_VAL HUGE #endif diff --git a/lib/xstrtol.c b/lib/xstrtol.c index a7386343f6..383225233e 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -98,6 +98,7 @@ __xstrtol (s, ptr, base, val, valid_suffixes) ++(*p); break; + case 'B': case 'k': BKM_SCALE (tmp, 1024, LONGINT_OVERFLOW); ++(*p); diff --git a/lib/xstrtol.h b/lib/xstrtol.h index 45043d01df..ff44d6becb 100644 --- a/lib/xstrtol.h +++ b/lib/xstrtol.h @@ -27,9 +27,9 @@ typedef enum strtol_error strtol_error; strtol_error __xstrtol __P ((const char *s, char **ptr, int base, - __unsigned long int *val, int allow_bkm_suffix)); + __unsigned long int *val, const char *valid_suffixes)); -#define STRTOL_FATAL_ERROR(str, argument_type_string, err) \ +#define _STRTOL_ERROR(exit_code, str, argument_type_string, err) \ do \ { \ switch ((err)) \ @@ -38,20 +38,27 @@ strtol_error abort (); \ \ case LONGINT_INVALID: \ - error (2, 0, "invalid %s `%s'", (argument_type_string), (str));\ + error ((exit_code), 0, "invalid %s `%s'", \ + (argument_type_string), (str)); \ break; \ \ case LONGINT_INVALID_SUFFIX_CHAR: \ - error (2, 0, "invalid character following %s `%s'", \ + error ((exit_code), 0, "invalid character following %s `%s'", \ (argument_type_string), (str)); \ break; \ \ case LONGINT_OVERFLOW: \ - error (2, 0, "%s `%s' larger than maximum long int", \ + error ((exit_code), 0, "%s `%s' larger than maximum long int",\ (argument_type_string), (str)); \ break; \ } \ } \ while (0) +#define STRTOL_FATAL_ERROR(str, argument_type_string, err) \ + _STRTOL_ERROR (2, str, argument_type_string, err) + +#define STRTOL_FAIL_WARN(str, argument_type_string, err) \ + _STRTOL_ERROR (0, str, argument_type_string, err) + #endif /* _xstrtol_h_ */