aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog8
-rw-r--r--util/fileutil.c4
-rw-r--r--util/miscutil.c12
-rw-r--r--util/strgutil.c18
4 files changed, 23 insertions, 19 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 673476291..6dc7fb918 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,11 @@
+2002-05-22 Werner Koch <[email protected]>
+
+ * fileutil.c (compare_filenames): Replaced stricmp by strcasecmp.
+ * miscutil.c (answer_is_yes_no_quit,answer_is_yes_no_default): Ditto.
+
+ * strgutil.c (strncasecmp): New.
+ (memicmp): Removed.
+
2002-05-10 Stefan Bellon <[email protected]>
* memory.c (add_entry) [M_DEBUG]: Added some missing EXTRA_ALIGN.
diff --git a/util/fileutil.c b/util/fileutil.c
index 8c062c51e..ebc1383ab 100644
--- a/util/fileutil.c
+++ b/util/fileutil.c
@@ -153,7 +153,7 @@ compare_filenames( const char *a, const char *b )
abuf = gstrans(a);
bbuf = gstrans(b);
- c = stricmp(abuf, bbuf);
+ c = strcasecmp (abuf, bbuf);
m_free(abuf);
m_free(bbuf);
@@ -228,5 +228,3 @@ leave:
return rc;
}
-
-
diff --git a/util/miscutil.c b/util/miscutil.c
index 276954234..e1735cd59 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -299,12 +299,12 @@ answer_is_yes_no_default( const char *s, int def_answer )
const char *short_no = _("nN");
/* Note: we have to use the local dependent strcasecmp here */
- if( !stricmp(s, long_yes ) )
+ if( !strcasecmp(s, long_yes ) )
return 1;
if( *s && strchr( short_yes, *s ) && !s[1] )
return 1;
/* test for no strings to catch ambiguities for the next test */
- if( !stricmp(s, long_no ) )
+ if( !strcasecmp(s, long_no ) )
return 0;
if( *s && strchr( short_no, *s ) && !s[1] )
return 0;
@@ -336,11 +336,11 @@ answer_is_yes_no_quit( const char *s )
const char *short_quit = _("qQ");
/* Note: We have to use the locale dependent strcasecmp */
- if( !stricmp(s, long_no ) )
+ if( !strcasecmp(s, long_no ) )
return 0;
- if( !stricmp(s, long_yes ) )
+ if( !strcasecmp(s, long_yes ) )
return 1;
- if( !stricmp(s, long_quit ) )
+ if( !strcasecmp(s, long_quit ) )
return -1;
if( *s && strchr( short_no, *s ) && !s[1] )
return 0;
@@ -359,5 +359,3 @@ answer_is_yes_no_quit( const char *s )
return -1;
return 0;
}
-
-
diff --git a/util/strgutil.c b/util/strgutil.c
index c4fafe562..6ad434006 100644
--- a/util/strgutil.c
+++ b/util/strgutil.c
@@ -766,17 +766,17 @@ strcasecmp( const char *a, const char *b )
}
#endif
-/****************
- * mingw32/cpd has a memicmp()
- */
-#ifndef HAVE_MEMICMP
+#ifndef HAVE_STRNCASECMP
int
-memicmp( const char *a, const char *b, size_t n )
+strncasecmp( const char *a, const char *b, size_t n )
{
- for( ; n; n--, a++, b++ )
- if( *a != *b && toupper(*(const byte*)a) != toupper(*(const byte*)b) )
- return *(const byte *)a - *(const byte*)b;
- return 0;
+ for( ; n && *a && *b; a++, b++, n--) {
+ if( *a != *b && toupper(*a) != toupper(*b) )
+ break;
+ }
+ if (!n)
+ return 0;
+ return *(const byte*)a - *(const byte*)b;
}
#endif