Added 'strncasecmp' to the list of functions to be searched for. Added a

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'
        * strfuncs.c: (g_strncasecmp) new function modeled closely after
        'g_strcasecmp'
This commit is contained in:
Phil Schwan 1998-11-05 01:36:36 +00:00 committed by Phil Schwan
parent 2701b4b563
commit 59f6876ded
13 changed files with 135 additions and 1 deletions

View File

@ -1,3 +1,11 @@
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)

View File

@ -1,3 +1,11 @@
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)

View File

@ -1,3 +1,11 @@
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)

View File

@ -1,3 +1,11 @@
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)

View File

@ -1,3 +1,11 @@
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)

View File

@ -1,3 +1,11 @@
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)

View File

@ -1,3 +1,11 @@
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)

View File

@ -1,3 +1,11 @@
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)

View File

@ -233,7 +233,7 @@ AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
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)

3
glib.h
View File

@ -1402,6 +1402,9 @@ gchar* g_strerror (gint errnum);
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);

View File

@ -1402,6 +1402,9 @@ gchar* g_strerror (gint errnum);
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);

View File

@ -975,6 +975,38 @@ g_strcasecmp (const gchar *s1,
#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,

View File

@ -975,6 +975,38 @@ g_strcasecmp (const gchar *s1,
#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,