version 1.16, 2005/09/25 21:05:04 |
version 1.17, 2005/12/07 12:31:05 |
|
|
int v; |
int v; |
|
|
v = (int)strtol(s, &cp, 10); |
v = (int)strtol(s, &cp, 10); |
if (cp != s) |
if (*cp != '\0') { /* s wasn't purely numeric */ |
; |
v = 0; |
else if (strptime(s, "%B", &tm) != NULL) |
if ((cp = strptime(s, "%b", &tm)) != NULL && *cp == '\0') |
v = tm.tm_mon + 1; |
v = tm.tm_mon + 1; |
else if (strptime(s, "%b", &tm) != NULL) |
} |
v = tm.tm_mon + 1; |
|
if (v <= 0 || v > 12) |
if (v <= 0 || v > 12) |
errx(1, "illegal month value: use 1-12"); |
errx(1, "invalid month: use 1-12 or a name"); |
return (v); |
return (v); |
} |
} |