.
authorJim Meyering <jim@meyering.net>
Fri, 27 Jan 1995 05:22:23 +0000 (05:22 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 27 Jan 1995 05:22:23 +0000 (05:22 +0000)
lib/getdate.y
lib/strtod.c
lib/xstrtol.c
lib/xstrtol.h

index 77d63a9..8f0872d 100644 (file)
@@ -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 ();
index 2f6b894..0d364f2 100644 (file)
 #endif
 
 #include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
 #include <ctype.h>
 #include <math.h>
 
@@ -34,7 +38,6 @@
 #include <string.h>
 #else
 #define NULL 0
-extern int errno;
 #ifndef HUGE_VAL
 #define HUGE_VAL HUGE
 #endif
index a738634..3832252 100644 (file)
@@ -98,6 +98,7 @@ __xstrtol (s, ptr, base, val, valid_suffixes)
          ++(*p);
          break;
 
+       case 'B':
        case 'k':
          BKM_SCALE (tmp, 1024, LONGINT_OVERFLOW);
          ++(*p);
index 45043d0..ff44d6b 100644 (file)
@@ -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_ */