diff options
Diffstat (limited to 'glib')
-rw-r--r-- | glib/ChangeLog | 5 | ||||
-rw-r--r-- | glib/configure.in | 4 | ||||
-rw-r--r-- | glib/glib.h | 13 | ||||
-rw-r--r-- | glib/glibconfig.h.in | 3 | ||||
-rw-r--r-- | glib/gutils.c | 19 |
5 files changed, 36 insertions, 8 deletions
diff --git a/glib/ChangeLog b/glib/ChangeLog index 5fb90e439..df0ae96da 100644 --- a/glib/ChangeLog +++ b/glib/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 30 23:57:17 PST 1998 Manish Singh <yosh@gimp.org> + + * added and autoconfigured in a new utility function + g_strcasecmp + Wed Jan 28 23:53:27 PST 1998 Manish Singh <yosh@gimp.org> * glist.c diff --git a/glib/configure.in b/glib/configure.in index 66da2f0fa..9df1d3922 100644 --- a/glib/configure.in +++ b/glib/configure.in @@ -69,8 +69,8 @@ AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H)) AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H)) AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H)) -# Check for strerror, strsignal, and memmove functions -AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf) +# Check for strerror, strsignal, memmove, vsnprintf, and strcasecmp functions +AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf strcasecmp) # Check for sys_errlist AC_MSG_CHECKING(sys_errlist) diff --git a/glib/glib.h b/glib/glib.h index 257d5925c..32850def1 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -625,12 +625,13 @@ void g_print (gchar *format, ...); /* Utility functions */ -gchar* g_strdup (const gchar *str); -gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */ -gdouble g_strtod (const gchar *nptr, gchar **endptr); -gchar* g_strerror (gint errnum); -gchar* g_strsignal (gint signum); -gint g_snprintf (gchar *str, gulong n, gchar const *fmt, ...); +gchar* g_strdup (const gchar *str); +gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */ +gdouble g_strtod (const gchar *nptr, gchar **endptr); +gchar* g_strerror (gint errnum); +gchar* g_strsignal (gint signum); +gint g_strcasecmp (const guchar *s1, const guchar *s2); +gint g_snprintf (gchar *str, gulong n, gchar const *fmt, ...); /* We make the assumption that if memmove isn't available, then diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in index ad4a6b08e..f1b9eacfa 100644 --- a/glib/glibconfig.h.in +++ b/glib/glibconfig.h.in @@ -65,6 +65,9 @@ /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + /* Define if you have the <float.h> header file. */ #undef HAVE_FLOAT_H diff --git a/glib/gutils.c b/glib/gutils.c index 87c3964b5..6dd230d4e 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -842,3 +842,22 @@ g_snprintf (gchar *str, #endif } + +gint +g_strcasecmp (const guchar *s1, const guchar *s2) +{ +#ifdef HAVE_STRCASECMP + return strcasecmp(s1, s2); +#else + gint c1, c2; + + while (*s1 && *s2) + { + c1 = tolower(*s1++); c2 = tolower(*s2++); + if (c1 != c2) + return (c1 - c2); + } + + return ((gint) *s1 - (gint) *s2); +#endif +} |