improve globbing:

• a=blöd; print ${a%???} → now printf 'b' not 'bl' in UTF-8 mode
• a=hä; print ${a%?} still broken
This commit is contained in:
tg
2009-11-21 22:30:36 +00:00
parent d02e6be6cf
commit 6e67920bef
2 changed files with 38 additions and 2 deletions

6
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.129 2009/11/09 23:35:10 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.130 2009/11/21 22:30:36 tg Exp $");
unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */
@ -581,6 +581,10 @@ do_gmatch(const unsigned char *s, const unsigned char *se,
case '?':
if (sc == 0)
return (0);
if (UTFMODE) {
--s;
s += utf_ptradj(s);
}
break;
case '*':