int i, w, neg, adj, min, range, *dest, dummy;
const char *ex;
size_t len;
+ int want_century = 0, century = 0;
while (*f) {
if (*f != '%') {
if (isspace(*f)) for (; *s && isspace(*s); s++);
if (!s) return 0;
break;
case 'C':
- /* FIXME */
- dest = &dummy;
+ dest = ¢ury;
if (w<0) w=2;
+ want_century |= 2;
goto numeric_digits;
case 'd': case 'e':
dest = &tm->tm_mday;
if (!s) return 0;
break;
case 'y':
- /* FIXME */
- dest = &dummy;
+ dest = &tm->tm_year;
w = 2;
+ want_century |= 1;
goto numeric_digits;
case 'Y':
dest = &tm->tm_year;
if (w<0) w=4;
adj = 1900;
+ want_century = 0;
goto numeric_digits;
case '%':
if (*s++ != '%') return 0;
;
}
}
+ if (want_century) {
+ if (want_century & 2) tm->tm_year += century * 100 - 1900;
+ else if (tm->tm_year <= 68) tm->tm_year += 100;
+ }
return (char *)s;
}