X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fparsedate.y;h=f3e94ef7654fd3b8e28d52b038318650bc119d1f;hb=ef347e598ab670b87e178af7fc6b00795494303a;hp=382f6cc22b4723efd14612647237dfb22de7f5a8;hpb=0f7eb8cc58d1a092b296335eb694a525b9cdf357;p=citadel.git diff --git a/citadel/parsedate.y b/citadel/parsedate.y index 382f6cc22..f3e94ef76 100644 --- a/citadel/parsedate.y +++ b/citadel/parsedate.y @@ -7,7 +7,7 @@ ** and Jim Berets in August, 1990. ** Further revised (removed obsolete constructs and cleaned up timezone ** names) in August, 1991, by Rich. Paul Eggert -** helped in September, 1992. Art Cancro cleaned +** helped in September, 1992. Art Cancro cleaned ** it up for ANSI C in December, 1999. ** ** This grammar has six shift/reduce conflicts. @@ -18,11 +18,35 @@ /* SUPPRESS 593 on yyerrlab *//* Label was not used */ /* SUPPRESS 593 on yynewstate *//* Label was not used */ /* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */ + +#include "sysdep.h" + #include #include #include #include -#include + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif + #include "parsedate.h" int date_lex(void); @@ -78,7 +102,7 @@ typedef enum _MERIDIAN { ** union, but this is more efficient. (This routine predates the ** yacc %union construct.) */ -static char *yyInput; +static const char *yyInput; static DSTMODE yyDSTmode; static int yyHaveDate; static int yyHaveRel; @@ -706,12 +730,12 @@ date_lex(void) time_t -parsedate(char *p) +parsedate(const char *p) { extern int date_parse(void); time_t Start; - yyInput = p; + yyInput = p; /* well, its supposed to be const... */ yyYear = 0; yyMonth = 0; @@ -771,7 +795,7 @@ main(int ac, char *av[]) for ( ; ; ) { (void)printf("\t> "); (void)fflush(stdout); - if (gets(buff) == NULL || buff[0] == '\n') + if (fgets(buff, sizeof buff, stdin) == NULL || buff[0] == '\n') break; #if YYDEBUG if (strcmp(buff, "yydebug") == 0) {