Hi, If busybox is configured with CONFIG_FEATURE_VI_REGEX_SEARCH=y, then all searches in vi are case-sensitive, even if ":set ignorecase" is in effect. The attached patch solves this problem (the code is based on the example on doing case-insensitive regex searches at http://www.gnu.org/software/gnulib/manual/html_node/GNU-Translate-Tables.html#GNU-Translate-Tables).
Regards, Dan.
*** editors/vi.c 2013-03-21 18:55:24.904978893 +0000 --- editors/vi.c 2013-01-31 00:16:01.631883770 +0000 *************** *** 1711,1719 **** struct re_pattern_buffer preg; int i; int size; re_syntax_options = RE_SYNTAX_POSIX_EXTENDED; ! preg.translate = 0; preg.fastmap = 0; preg.buffer = 0; preg.allocated = 0; --- 1711,1733 ---- struct re_pattern_buffer preg; int i; int size; + static unsigned char *ic_translation_table; + + /* Create a translation table that can enable case-insensitive searches. + * See http://www.gnu.org/software/gnulib/manual/html_node/GNU-Translate-Tables.html#GNU-Translate-Tables + * */ + if(!ic_translation_table) + { + int tt_idx; + ic_translation_table=malloc(256); + for (tt_idx = 0; tt_idx < 256; tt_idx++) + ic_translation_table[tt_idx] = tt_idx; + for (tt_idx = 'a'; tt_idx <= 'z'; tt_idx++) + ic_translation_table[tt_idx] = tt_idx - ('a' - 'A'); + } re_syntax_options = RE_SYNTAX_POSIX_EXTENDED; ! preg.translate = ignorecase? ic_translation_table : 0; preg.fastmap = 0; preg.buffer = 0; preg.allocated = 0;
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
