-
- if (CHAR_IS_ROMAN (tolower (*i->s)))
- {
- int last = ROMAN_VALUE (tolower (*i->s));
-
- *month = 0;
- for (;;)
- {
- int value;
-
- i->s++;
- if (!have_char || !CHAR_IS_ROMAN (tolower (*i->s)))
- {
- if (last != INT_MAX)
- *month += last;
- break;
- }
-
- value = ROMAN_VALUE (tolower (*i->s));
- if (last == INT_MAX)
- *month += value;
- else if (value > last)
- {
- *month += value - last;
- last = INT_MAX;
- }
- else
- {
- *month += last;
- last = value;
- }
- }
-
- if (*month < 1 || *month > 12)
- {
- char buf[32];
-
- to_roman (*month, buf);
- dls_error (i, _("Month (%s) must be between I and XII."), buf);
- return 0;
- }
-
- return 1;
- }
-
- {
- static const char *months[12] =
- {
- "january", "february", "march", "april", "may", "june",
- "july", "august", "september", "october", "november", "december",
- };
-
- char month_buf[32];
- char *mp;
-
- int j;
-
- for (mp = month_buf;
- have_char (i) && isalpha (*i->s) && mp < &month_buf[31];
- i->s++)
- *mp++ = tolower (*i->s);
- *mp = '\0';
-
- if (have_char (i) && isalpha (*i->s))
- {
- dls_error (i, _("Month name (%s...) is too long."), month_buf);
- return 0;
- }
-
- for (j = 0; j < 12; j++)
- if (lex_id_match (months[j], month_buf))
- {
- *month = j + 1;
- return 1;
- }
-
- dls_error (i, _("Bad month name (%s)."), month_buf);
- return 0;
- }