projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
whatnow2: remove get_attachmentheader()
[mmh]
/
sbr
/
dtimep.lex
diff --git
a/sbr/dtimep.lex
b/sbr/dtimep.lex
index
0581736
..
4f07aac
100644
(file)
--- a/
sbr/dtimep.lex
+++ b/
sbr/dtimep.lex
@@
-56,16
+56,6
@@
*/
int europeandate = 0;
*/
int europeandate = 0;
-static char *monthnames[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- NULL
-};
-
-static char *daynames[] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL
-};
-
static int
name2num(char *name, char *names[])
{
static int
name2num(char *name, char *names[])
{
@@
-91,9
+81,9
@@
name2num(char *name, char *names[])
*/
#define INIT() { cp = yytext;}
*/
#define INIT() { cp = yytext;}
-#define SETWDAY() { tw.tw_wday = name2num(cp, daynames); \
+#define SETWDAY() { tw.tw_wday = name2num(cp, tw_dotw); \
tw.tw_flags &= ~TW_SDAY; tw.tw_flags |= TW_SEXP; SKIPA(); }
tw.tw_flags &= ~TW_SDAY; tw.tw_flags |= TW_SEXP; SKIPA(); }
-#define SETMON() { tw.tw_mon = name2num(cp, monthnames); SKIPA(); }
+#define SETMON() { tw.tw_mon = name2num(cp, tw_moty); SKIPA(); }
#define SETMON_NUM() { tw.tw_mon = atoi(cp)-1; SKIPD(); }
#define SETYEAR() { tw.tw_year = atoi(cp); SKIPD(); }
#define SETDAY() { tw.tw_mday = atoi(cp); tw.tw_flags |= TW_YES; SKIPD(); }
#define SETMON_NUM() { tw.tw_mon = atoi(cp)-1; SKIPD(); }
#define SETYEAR() { tw.tw_year = atoi(cp); SKIPD(); }
#define SETDAY() { tw.tw_mday = atoi(cp); tw.tw_flags |= TW_YES; SKIPD(); }
@@
-102,6
+92,8
@@
name2num(char *name, char *names[])
tw.tw_sec = atoi(++cp); SKIPD(); } }
#define SETZONE(x) { tw.tw_zone = ((x)/100)*60+(x)%100; \
tw.tw_flags |= TW_SZEXP; SKIPD(); }
tw.tw_sec = atoi(++cp); SKIPD(); } }
#define SETZONE(x) { tw.tw_zone = ((x)/100)*60+(x)%100; \
tw.tw_flags |= TW_SZEXP; SKIPD(); }
+#define SETZONEC(h, m) { tw.tw_zone = (h)*60+(m); \
+ tw.tw_flags |= TW_SZEXP; SKIPD(); }
#define SETDST() { tw.tw_flags |= TW_DST; }
#define SKIPD() { while ( isdigit(*cp++) ) ; --cp; }
#define SKIPTOD() { while ( !isdigit(*cp++) ) ; --cp; }
#define SETDST() { tw.tw_flags |= TW_DST; }
#define SKIPD() { while ( isdigit(*cp++) ) ; --cp; }
#define SKIPTOD() { while ( !isdigit(*cp++) ) ; --cp; }
@@
-266,7
+258,29
@@
nl [ \t\n()]
SKIPTOD();
SETYEAR();
}
SKIPTOD();
SETYEAR();
}
-{D}("-"|"/"){D}("-"|"/"){YEAR}{W}{TIME} {
+{d}{4}"-"{d}{2}"-"{d}{2}(" "|"T"){TIME} {
+ INIT();
+ SETYEAR();
+ SKIPTOD();
+ SETMON_NUM();
+ SKIPTOD();
+ SETDAY();
+ SKIPTOD();
+ SETTIME();
+}
+{d}{4}"-"{d}{2}"-"{d}{2} {
+ INIT();
+ SETYEAR();
+ SKIPTOD();
+ SETMON_NUM();
+ SKIPTOD();
+ SETDAY();
+}
+{d}{2}"-"{d}{2}"-"{d}{2} {
+ fprintf(stderr, "the highly ambiguous date format XX-XX-XX..."
+ " is no longer supported\n");
+}
+{D}"/"{D}"/"{YEAR}{W}{TIME} {
INIT();
if(europeandate) {
/* DD/MM/YY */
INIT();
if(europeandate) {
/* DD/MM/YY */
@@
-284,7
+298,7
@@
nl [ \t\n()]
SKIPTOD();
SETTIME();
}
SKIPTOD();
SETTIME();
}
-{D}("-"|"/"){D}("-"|"/"){YEAR} {
+{D}"/"{D}"/"{YEAR} {
INIT();
if(europeandate) {
/* DD/MM/YY */
INIT();
if(europeandate) {
/* DD/MM/YY */
@@
-323,6
+337,25
@@
nl [ \t\n()]
yyterminate();
}
yyterminate();
}
+"+"{d}{d}":"{d}{d} {
+ INIT();
+ SKIPTOD();
+ SETZONEC(atoi(cp), atoi(cp+3));
+#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST
+ zonehack (&tw);
+#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */
+ yyterminate();
+}
+"-"{d}{d}":"{d}{d} {
+ INIT();
+ SKIPTOD();
+ SETZONEC(-atoi(cp), -atoi(cp+3));
+#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST
+ zonehack (&tw);
+#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */
+ yyterminate();
+
+}
{nl}("ut"|"UT") INIT(); SETZONE(0); yyterminate();
{nl}("gmt"|"GMT") INIT(); SETZONE(0); yyterminate();
{nl}("est"|"EST") INIT(); SETZONE(-500); yyterminate();
{nl}("ut"|"UT") INIT(); SETZONE(0); yyterminate();
{nl}("gmt"|"GMT") INIT(); SETZONE(0); yyterminate();
{nl}("est"|"EST") INIT(); SETZONE(-500); yyterminate();