X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fgetdate.y;h=40fd4e0fe4c969bb83237d380072216a6988a8ba;hb=265465e1145409720be48d30b6277a59151d293a;hp=3525295bb39854409c3dd3f4e5db46bd823f5711;hpb=edde45606f249fb3c56a4dca41da4d7dbdb61f9b;p=gnulib.git diff --git a/lib/getdate.y b/lib/getdate.y index 3525295bb..40fd4e0fe 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -1,6 +1,6 @@ %{ /* Parse a string into an internal time stamp. - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,11 +27,10 @@ #ifdef HAVE_CONFIG_H # include -# ifdef HAVE_ALLOCA_H -# include -# endif #endif +#include + /* Since the code of getdate.y is not included in the Emacs executable itself, there is no need to #define static in this file. Even if the code were included in the Emacs executable, it probably @@ -44,9 +43,7 @@ #include -#if HAVE_STDLIB_H -# include /* for `free'; used by Bison 1.27 */ -#endif +#include /* for `free'; used by Bison 1.27 */ #if STDC_HEADERS || (! defined isascii && ! HAVE_ISASCII) # define IN_CTYPE_DOMAIN(c) 1 @@ -63,15 +60,12 @@ - Its arg may be any int or unsigned int; it need not be an unsigned char. - It's guaranteed to evaluate its argument exactly once. - It's typically faster. - Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that - only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless - it's important to use the locale's definition of `digit' even when the - host does not conform to Posix. */ + POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to + ISDIGIT_LOCALE unless it's important to use the locale's definition + of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) -#if STDC_HEADERS || HAVE_STRING_H -# include -#endif +#include #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ # define __attribute__(x) @@ -323,6 +317,14 @@ date: PC.year.value = -$3.value; PC.year.digits = $3.digits; } + | tMONTH tSNUMBER tSNUMBER + { + /* e.g. JUN-17-1992. */ + PC.month = $1; + PC.day = -$2.value; + PC.year.value = -$3.value; + PC.year.digits = $3.digits; + } | tMONTH tUNUMBER { PC.month = $1; @@ -378,19 +380,19 @@ relunit: | tSNUMBER tDAY_UNIT { PC.rel_day += $1.value * $2; } | tDAY_UNIT - { PC.rel_day += $1 } + { PC.rel_day += $1; } | tUNUMBER tHOUR_UNIT { PC.rel_hour += $1.value * $2; } | tSNUMBER tHOUR_UNIT { PC.rel_hour += $1.value * $2; } | tHOUR_UNIT - { PC.rel_hour += $1 } + { PC.rel_hour += $1; } | tUNUMBER tMINUTE_UNIT { PC.rel_minutes += $1.value * $2; } | tSNUMBER tMINUTE_UNIT { PC.rel_minutes += $1.value * $2; } | tMINUTE_UNIT - { PC.rel_minutes += $1 } + { PC.rel_minutes += $1; } | tUNUMBER tSEC_UNIT { PC.rel_seconds += $1.value * $2; } | tSNUMBER tSEC_UNIT @@ -448,6 +450,7 @@ o_merid: may define-away `const'. We want the prototype for get_date to have the same signature as the function definition. */ #include "getdate.h" +#include "unlocked-io.h" #ifndef gmtime struct tm *gmtime (); @@ -520,10 +523,10 @@ static table const time_units_table[] = /* Assorted relative-time words. */ static table const relative_time_table[] = { - { "TOMORROW", tMINUTE_UNIT, 24 * 60 }, - { "YESTERDAY",tMINUTE_UNIT, - (24 * 60) }, - { "TODAY", tMINUTE_UNIT, 0 }, - { "NOW", tMINUTE_UNIT, 0 }, + { "TOMORROW", tDAY_UNIT, 1 }, + { "YESTERDAY",tDAY_UNIT, -1 }, + { "TODAY", tDAY_UNIT, 0 }, + { "NOW", tDAY_UNIT, 0 }, { "LAST", tUNUMBER, -1 }, { "THIS", tUNUMBER, 0 }, { "NEXT", tUNUMBER, 1 }, @@ -908,7 +911,7 @@ get_date (const char *p, const time_t *now) pc.local_zones_seen = 0; pc.zones_seen = 0; -#if HAVE_TM_ZONE +#if HAVE_STRUCT_TM_TM_ZONE pc.local_time_zone_table[0].name = tmp->tm_zone; pc.local_time_zone_table[0].type = tLOCAL_ZONE; pc.local_time_zone_table[0].value = tmp->tm_isdst;