(recursive): Return rp to caller.
authordrepper <drepper>
Sun, 16 Mar 1997 20:15:09 +0000 (20:15 +0000)
committerdrepper <drepper>
Sun, 16 Mar 1997 20:15:09 +0000 (20:15 +0000)
(strptime_internal): First check for long names, then abbreviated
(month & weekday).
(strptime_internal) [case 'Y']: Always subtract
1900 from year, regardless of century.

time/strptime.c

index 3340b43..89cfa8e 100644 (file)
@@ -129,7 +129,7 @@ localtime_r (t, tp)
 #endif
 #define recursive(new_fmt) \
   (*(new_fmt) != '\0'                                                        \
-   && strptime_internal (rp, (new_fmt), tm, decided) != NULL)
+   && (rp = strptime_internal (rp, (new_fmt), tm, decided)) != NULL)
 
 
 #ifdef _LIBC
@@ -239,27 +239,27 @@ strptime_internal (buf, format, tm, decided)
 #ifdef _NL_CURRENT
              if (*decided !=raw)
                {
-                 if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
+                 if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
                    {
                      if (*decided == not
-                         && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
-                                    ab_weekday_name[cnt]))
+                         && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
+                                    weekday_name[cnt]))
                        *decided = loc;
                      break;
                    }
-                 if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
+                 if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
                    {
                      if (*decided == not
-                         && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
-                                    weekday_name[cnt]))
+                         && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
+                                    ab_weekday_name[cnt]))
                        *decided = loc;
                      break;
                    }
                }
 #endif
              if (*decided != loc
-                 && (match_string (ab_weekday_name[cnt], rp)
-                     || match_string (weekday_name[cnt], rp)))
+                 && (match_string (weekday_name[cnt], rp)
+                     || match_string (ab_weekday_name[cnt], rp)))
                {
                  *decided = raw;
                  break;
@@ -279,26 +279,26 @@ strptime_internal (buf, format, tm, decided)
 #ifdef _NL_CURRENT
              if (*decided !=raw)
                {
-                 if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
+                 if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
                    {
                      if (*decided == not
-                         && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
-                                    ab_month_name[cnt]))
+                         && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
+                                    month_name[cnt]))
                        *decided = loc;
                      break;
                    }
-                 if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
+                 if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
                    {
                      if (*decided == not
-                         && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
-                                    month_name[cnt]))
+                         && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
+                                    ab_month_name[cnt]))
                        *decided = loc;
                      break;
                    }
                }
 #endif
-             if (match_string (ab_month_name[cnt], rp)
-                 || match_string (month_name[cnt], rp))
+             if (match_string (month_name[cnt], rp)
+                 || match_string (ab_month_name[cnt], rp))
                {
                  *decided = raw;
                  break;
@@ -542,7 +542,7 @@ strptime_internal (buf, format, tm, decided)
        case 'Y':
          /* Match year including century number.  */
          get_number (0, INT_MAX);
-         tm->tm_year = val - (val >= 2000 ? 2000 : 1900);
+         tm->tm_year = val - 1900;
          break;
        case 'Z':
          /* XXX How to handle this?  */