put revstrstr() back in utils.c, as it's case sensitive and hance should

work with multibyte strings as-is


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2279 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-01-16 19:30:48 +00:00
parent c5e21dafb7
commit 18d616f253
3 changed files with 33 additions and 32 deletions

View File

@ -102,16 +102,16 @@ CVS code -
chars.c), is_cntrl_char() (moved to chars.c), nstricmp()
(renamed nstrcasecmp() and moved to chars.c), nstrnicmp()
(renamed nstrncasecmp() and moved to chars.c), nstristr()
(renamed nstrcasestr() and moved to chars.c), revstrstr()
(moved to chars.c), revstristr() (renamed revstrcasestr() and
moved to chars.c), nstrnlen() (moved to chars.c),
parse_char() (renamed parse_mbchar() and moved to chars.c),
move_left() (renamed move_mbleft() and moved to chars.c),
move_right() (renamed move_mbright() and moved to chars.c),
do_home(), do_verbatim_input(), do_delete(), do_tab(),
do_next_word(), do_prev_word(), do_input(), do_output(),
get_buffer(), unget_input(), unget_kbinput(), get_input(),
parse_kbinput(), unparse_kbinput(), parse_verbatim_kbinput(),
(renamed nstrcasestr() and moved to chars.c), revstristr()
(renamed revstrcasestr() and moved to chars.c), nstrnlen()
(moved to chars.c), parse_char() (renamed parse_mbchar() and
moved to chars.c), move_left() (renamed move_mbleft() and
moved to chars.c), move_right() (renamed move_mbright() and
moved to chars.c), do_home(), do_verbatim_input(),
do_delete(), do_tab(), do_next_word(), do_prev_word(),
do_input(), do_output(), get_buffer(), unget_input(),
unget_kbinput(), get_input(), parse_kbinput(),
unparse_kbinput(), parse_verbatim_kbinput(),
do_statusbar_input(), do_statusbar_home(),
do_statusbar_verbatim_kbinput(), do_statusbar_output(), and
display_string(); removal of buffer_to_keys() and

View File

@ -595,26 +595,7 @@ const char *nstrcasestr(const char *haystack, const char *needle)
}
#endif
/* None of this is needed if we're using NANO_SMALL! */
#ifndef NANO_SMALL
const char *revstrstr(const char *haystack, const char *needle, const
char *rev_start)
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
for (; rev_start >= haystack; rev_start--) {
const char *r, *q;
for (r = rev_start, q = needle; *q == *r && *q != '\0'; r++, q++)
;
if (*q == '\0')
return rev_start;
}
return NULL;
}
const char *revstrcasestr(const char *haystack, const char *needle,
const char *rev_start)
{
@ -632,7 +613,7 @@ const char *revstrcasestr(const char *haystack, const char *needle,
return NULL;
}
#endif /* !NANO_SMALL */
#endif
#ifndef HAVE_STRNLEN
/* This function is equivalent to strnlen(). */

View File

@ -131,7 +131,26 @@ void sunder(char *str)
}
}
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
#ifndef NANO_SMALL
const char *revstrstr(const char *haystack, const char *needle, const
char *rev_start)
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
for (; rev_start >= haystack; rev_start--) {
const char *r, *q;
for (r = rev_start, q = needle; *q == *r && *q != '\0'; r++, q++)
;
if (*q == '\0')
return rev_start;
}
return NULL;
}
#ifdef ENABLE_NANORC
#ifndef HAVE_GETLINE
/* This function is equivalent to getline(). It was adapted from
* GNU mailutils' getline() function. */
@ -189,7 +208,8 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
}
#endif
#endif /* !NANO_SMALL && ENABLE_NANORC */
#endif /* ENABLE_NANORC */
#endif /* !NANO_SMALL */
/* If we are searching backwards, we will find the last match that
* starts no later than start. Otherwise we find the first match