diff options
author | Raja R Harinath <harinath@src.gnome.org> | 1998-02-19 05:37:52 +0800 |
---|---|---|
committer | Raja R Harinath <harinath@src.gnome.org> | 1998-02-19 05:37:52 +0800 |
commit | 64e480b07851a56a65d391fa930b295e5c9a944b (patch) | |
tree | 4466f0eb4d4e5f4065f7144d27e1384a391e321d | |
parent | c9d932d2395aa2281fba90ad4d02bfbea03b83e1 (diff) | |
download | gsoc2013-evolution-64e480b07851a56a65d391fa930b295e5c9a944b.tar gsoc2013-evolution-64e480b07851a56a65d391fa930b295e5c9a944b.tar.gz gsoc2013-evolution-64e480b07851a56a65d391fa930b295e5c9a944b.tar.bz2 gsoc2013-evolution-64e480b07851a56a65d391fa930b295e5c9a944b.tar.lz gsoc2013-evolution-64e480b07851a56a65d391fa930b295e5c9a944b.tar.xz gsoc2013-evolution-64e480b07851a56a65d391fa930b295e5c9a944b.tar.zst gsoc2013-evolution-64e480b07851a56a65d391fa930b295e5c9a944b.zip |
Include `libsupport.a'.
* Makefile.am (gncal_LDADD): Include `libsupport.a'.
* calcs.c (month_atoi): Replace buggy explicit loop string compare
with strcasecmp.
(day_atoi): Likewise.
- Hari
svn path=/trunk/; revision=40
-rw-r--r-- | calendar/ChangeLog | 8 | ||||
-rw-r--r-- | calendar/Makefile.am | 3 | ||||
-rw-r--r-- | calendar/calcs.c | 52 | ||||
-rw-r--r-- | calendar/gui/Makefile.am | 3 |
4 files changed, 28 insertions, 38 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 82487d69fe..b9e6c328d0 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +1998-02-18 Raja R Harinath <harinath@cs.umn.edu> + + * Makefile.am (gncal_LDADD): Include `libsupport.a'. + + * calcs.c (month_atoi): Replace buggy explicit loop string compare + with strcasecmp. + (day_atoi): Likewise. + Sun Jan 25 23:38:30 1998 Miguel de Icaza <miguel@nuclecu.unam.mx> * menus.c: Replace "Quit" with "Exit". diff --git a/calendar/Makefile.am b/calendar/Makefile.am index 2f370712ca..2c11d28c13 100644 --- a/calendar/Makefile.am +++ b/calendar/Makefile.am @@ -11,7 +11,8 @@ gncal_SOURCES = \ calcs.h gncal_LDADD = \ - $(GNOMEUI_LIBS) + $(GNOMEUI_LIBS) \ + $(top_builddir)/support/libsupport.a EXTRA_DIST = \ gncal.desktop diff --git a/calendar/calcs.c b/calendar/calcs.c index 002ffbf28b..2797a31d6c 100644 --- a/calendar/calcs.c +++ b/calendar/calcs.c @@ -11,6 +11,12 @@ #include <ctype.h> #include "calcs.h" +#include <config.h> + +#ifndef HAVE_STRCASECMP +int strcasecmp(const char * /*s1*/, const char * /*s2*/); +#endif + /* Number of days in a month */ static const int dvec[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; /* Number of past days of a month */ @@ -117,47 +123,21 @@ void get_system_date(int *day, int *month, int *year) */ int month_atoi(const char *string) { - int i, j; - int len; - char *ptr; - - len = strlen(string); - - for(i= MONTH_MIN; i <= MONTH_MAX; i++) { - ptr = (char*)month_name(i); - j = 0; - while ( *(ptr + j) && string[j]) - if (tolower((ptr+j)) == tolower(string[j])) - j++; - else - break; - if (j == len || !*(ptr + j)) - return(i); - } + int i; + for (i = MONTH_MIN; i <= MONTH_MAX; i++) + if (strcasecmp(string, (char *)month_name(i)) == 0) + return i; return 0; -} /* month_atoi */ +} int day_atoi(const char *string) { - int i, j; - int len; - char *ptr; - - len = strlen(string); - - for(i= DAY_MIN; i <= DAY_MAX; i++) { - ptr = (char*)day_name(i); - j = 0; - while ( *(ptr + j) && string[j]) - if (tolower((ptr+j)) == tolower(string[j])) - j++; - else - break; - if (j == len || !*(ptr + j)) - return(i); - } + int i; + for (i = DAY_MIN; i <= DAY_MAX; i++) + if (strcasecmp(string, (char *)day_name(i)) == 0) + return i; return 0; -} /* day_atoi */ +} /* * Returns ordinal suffix (st, nd, rd, th) for a day diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 2f370712ca..2c11d28c13 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -11,7 +11,8 @@ gncal_SOURCES = \ calcs.h gncal_LDADD = \ - $(GNOMEUI_LIBS) + $(GNOMEUI_LIBS) \ + $(top_builddir)/support/libsupport.a EXTRA_DIST = \ gncal.desktop |