when reading color syntax names or sorting filenames, use mbstrcasecmp()

instead of strcasecmp() to compare them, in case they're UTF-8


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2734 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-06-19 21:10:48 +00:00
parent 483f3ac1b5
commit a62e8e3de9
3 changed files with 9 additions and 2 deletions

View File

@ -121,6 +121,10 @@ CVS code -
- Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a - Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a
compilation problem when --enable-nanorc isn't used and compilation problem when --enable-nanorc isn't used and
--enable-extra is. (DLR) --enable-extra is. (DLR)
- color.c:
update_color()
- Use mbstrcasecmp() instead of strcasecmp(), so that UTF-8
color syntax names are properly detected. (DLR)
- cut.c: - cut.c:
cut_line() cut_line()
- Set placewewant properly after cutting a line, to avoid a - Set placewewant properly after cutting a line, to avoid a
@ -148,6 +152,9 @@ CVS code -
- Since lineswritten is a size_t, print its value as an unsigned - Since lineswritten is a size_t, print its value as an unsigned
long instead of an unsigned int. (DLR) long instead of an unsigned int. (DLR)
- Declare the size_t i only in the loop where it's used. (DLR) - Declare the size_t i only in the loop where it's used. (DLR)
diralphasort()
- Use mbstrcasecmp() instead of strcasecmp(), so that UTF-8
filenames are sorted properly. (DLR)
cwd_tab_completion(), browser_init() cwd_tab_completion(), browser_init()
- Rename variable next to nextdir to avoid confusion. (DLR) - Rename variable next to nextdir to avoid confusion. (DLR)
input_tab() input_tab()

View File

@ -122,7 +122,7 @@ void update_color(void)
if (colorstrings == NULL && syntaxstr != NULL) { if (colorstrings == NULL && syntaxstr != NULL) {
for (tmpsyntax = syntaxes; tmpsyntax != NULL; for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) { tmpsyntax = tmpsyntax->next) {
if (strcasecmp(tmpsyntax->desc, syntaxstr) == 0) if (mbstrcasecmp(tmpsyntax->desc, syntaxstr) == 0)
colorstrings = tmpsyntax->color; colorstrings = tmpsyntax->color;
} }
} }

View File

@ -2008,7 +2008,7 @@ int diralphasort(const void *va, const void *vb)
if (!aisdir && bisdir) if (!aisdir && bisdir)
return 1; return 1;
return strcasecmp(a, b); return mbstrcasecmp(a, b);
} }
/* Free the memory allocated for array, which should contain len /* Free the memory allocated for array, which should contain len