summaryrefslogtreecommitdiffstats
path: root/chpass/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'chpass/util.c')
-rw-r--r--chpass/util.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/chpass/util.c b/chpass/util.c
index fe89d79..605a484 100644
--- a/chpass/util.c
+++ b/chpass/util.c
@@ -91,12 +91,16 @@ atot(p, store)
}
if (!(t = strtok(p, " \t")))
goto bad;
- for (mp = months;; ++mp) {
- if (!*mp)
- goto bad;
- if (!strncasecmp(*mp, t, 3)) {
- month = mp - months + 1;
- break;
+ if (isdigit(*t)) {
+ month = atoi(t);
+ } else {
+ for (mp = months;; ++mp) {
+ if (!*mp)
+ goto bad;
+ if (!strncasecmp(*mp, t, 3)) {
+ month = mp - months + 1;
+ break;
+ }
}
}
if (!(t = strtok((char *)NULL, " \t,")) || !isdigit(*t))