+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
+1998-11-04 Phil Schwan <pschwan@cmu.edu>
+
+ * configure.in: Added 'strncasecmp' to the list of functions to be
+ searched for.
+ * glib.h: Added a prototype for 'g_strncasecmp'
+ * gstrfuncs.c: (g_strncasecmp) new function modeled closely after
+ 'g_strcasecmp'
+
Wed Nov 4 15:06:44 PST 1998 Manish Singh <yosh@gimp.org>
* config.h.win32 (new file)
AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
# Check for some functions
-AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp)
+AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp strncasecmp)
# Check for sys_errlist
AC_MSG_CHECKING(for sys_errlist)
gchar* g_strsignal (gint signum);
gint g_strcasecmp (const gchar *s1,
const gchar *s2);
+gint g_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ guint n);
void g_strdown (gchar *string);
void g_strup (gchar *string);
void g_strreverse (gchar *string);
gchar* g_strsignal (gint signum);
gint g_strcasecmp (const gchar *s1,
const gchar *s2);
+gint g_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ guint n);
void g_strdown (gchar *string);
void g_strup (gchar *string);
void g_strreverse (gchar *string);
#endif
}
+gint
+g_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ guint n)
+{
+#ifdef HAVE_STRNCASECMP
+ return strncasecmp (s1, s2, n);
+#else
+ gint c1, c2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (n-- && *s1 && *s2)
+ {
+ /* According to A. Cox, some platforms have islower's that
+ * don't work right on non-uppercase
+ */
+ c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1;
+ c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2;
+ if (c1 != c2)
+ return (c1 - c2);
+ s1++; s2++;
+ }
+
+ if (n)
+ return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
+ else
+ return 0;
+#endif
+}
+
gchar*
g_strdelimit (gchar *string,
const gchar *delimiters,
#endif
}
+gint
+g_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ guint n)
+{
+#ifdef HAVE_STRNCASECMP
+ return strncasecmp (s1, s2, n);
+#else
+ gint c1, c2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (n-- && *s1 && *s2)
+ {
+ /* According to A. Cox, some platforms have islower's that
+ * don't work right on non-uppercase
+ */
+ c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1;
+ c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2;
+ if (c1 != c2)
+ return (c1 - c2);
+ s1++; s2++;
+ }
+
+ if (n)
+ return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
+ else
+ return 0;
+#endif
+}
+
gchar*
g_strdelimit (gchar *string,
const gchar *delimiters,