1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-07-06 03:19:21 +02:00

* 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.
This commit is contained in:
Werner Koch 2002-05-22 09:09:24 +00:00
parent 09e732361a
commit eb1057be7c
4 changed files with 23 additions and 19 deletions

View File

@ -1,3 +1,11 @@
2002-05-22 Werner Koch <wk@gnupg.org>
* 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 <sbellon@sbellon.de> 2002-05-10 Stefan Bellon <sbellon@sbellon.de>
* memory.c (add_entry) [M_DEBUG]: Added some missing EXTRA_ALIGN. * memory.c (add_entry) [M_DEBUG]: Added some missing EXTRA_ALIGN.

View File

@ -153,7 +153,7 @@ compare_filenames( const char *a, const char *b )
abuf = gstrans(a); abuf = gstrans(a);
bbuf = gstrans(b); bbuf = gstrans(b);
c = stricmp(abuf, bbuf); c = strcasecmp (abuf, bbuf);
m_free(abuf); m_free(abuf);
m_free(bbuf); m_free(bbuf);
@ -228,5 +228,3 @@ leave:
return rc; return rc;
} }

View File

@ -299,12 +299,12 @@ answer_is_yes_no_default( const char *s, int def_answer )
const char *short_no = _("nN"); const char *short_no = _("nN");
/* Note: we have to use the local dependent strcasecmp here */ /* Note: we have to use the local dependent strcasecmp here */
if( !stricmp(s, long_yes ) ) if( !strcasecmp(s, long_yes ) )
return 1; return 1;
if( *s && strchr( short_yes, *s ) && !s[1] ) if( *s && strchr( short_yes, *s ) && !s[1] )
return 1; return 1;
/* test for no strings to catch ambiguities for the next test */ /* test for no strings to catch ambiguities for the next test */
if( !stricmp(s, long_no ) ) if( !strcasecmp(s, long_no ) )
return 0; return 0;
if( *s && strchr( short_no, *s ) && !s[1] ) if( *s && strchr( short_no, *s ) && !s[1] )
return 0; return 0;
@ -336,11 +336,11 @@ answer_is_yes_no_quit( const char *s )
const char *short_quit = _("qQ"); const char *short_quit = _("qQ");
/* Note: We have to use the locale dependent strcasecmp */ /* Note: We have to use the locale dependent strcasecmp */
if( !stricmp(s, long_no ) ) if( !strcasecmp(s, long_no ) )
return 0; return 0;
if( !stricmp(s, long_yes ) ) if( !strcasecmp(s, long_yes ) )
return 1; return 1;
if( !stricmp(s, long_quit ) ) if( !strcasecmp(s, long_quit ) )
return -1; return -1;
if( *s && strchr( short_no, *s ) && !s[1] ) if( *s && strchr( short_no, *s ) && !s[1] )
return 0; return 0;
@ -359,5 +359,3 @@ answer_is_yes_no_quit( const char *s )
return -1; return -1;
return 0; return 0;
} }

View File

@ -766,17 +766,17 @@ strcasecmp( const char *a, const char *b )
} }
#endif #endif
/**************** #ifndef HAVE_STRNCASECMP
* mingw32/cpd has a memicmp()
*/
#ifndef HAVE_MEMICMP
int 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++ ) for( ; n && *a && *b; a++, b++, n--) {
if( *a != *b && toupper(*(const byte*)a) != toupper(*(const byte*)b) ) if( *a != *b && toupper(*a) != toupper(*b) )
return *(const byte *)a - *(const byte*)b; break;
}
if (!n)
return 0; return 0;
return *(const byte*)a - *(const byte*)b;
} }
#endif #endif