Commit 18d616f2 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
No related merge requests found
Showing with 33 additions and 32 deletions
+33 -32
...@@ -102,16 +102,16 @@ CVS code - ...@@ -102,16 +102,16 @@ CVS code -
chars.c), is_cntrl_char() (moved to chars.c), nstricmp() chars.c), is_cntrl_char() (moved to chars.c), nstricmp()
(renamed nstrcasecmp() and moved to chars.c), nstrnicmp() (renamed nstrcasecmp() and moved to chars.c), nstrnicmp()
(renamed nstrncasecmp() and moved to chars.c), nstristr() (renamed nstrncasecmp() and moved to chars.c), nstristr()
(renamed nstrcasestr() and moved to chars.c), revstrstr() (renamed nstrcasestr() and moved to chars.c), revstristr()
(moved to chars.c), revstristr() (renamed revstrcasestr() and (renamed revstrcasestr() and moved to chars.c), nstrnlen()
moved to chars.c), nstrnlen() (moved to chars.c), (moved to chars.c), parse_char() (renamed parse_mbchar() and
parse_char() (renamed parse_mbchar() and moved to chars.c), moved to chars.c), move_left() (renamed move_mbleft() and
move_left() (renamed move_mbleft() and moved to chars.c), moved to chars.c), move_right() (renamed move_mbright() and
move_right() (renamed move_mbright() and moved to chars.c), moved to chars.c), do_home(), do_verbatim_input(),
do_home(), do_verbatim_input(), do_delete(), do_tab(), do_delete(), do_tab(), do_next_word(), do_prev_word(),
do_next_word(), do_prev_word(), do_input(), do_output(), do_input(), do_output(), get_buffer(), unget_input(),
get_buffer(), unget_input(), unget_kbinput(), get_input(), unget_kbinput(), get_input(), parse_kbinput(),
parse_kbinput(), unparse_kbinput(), parse_verbatim_kbinput(), unparse_kbinput(), parse_verbatim_kbinput(),
do_statusbar_input(), do_statusbar_home(), do_statusbar_input(), do_statusbar_home(),
do_statusbar_verbatim_kbinput(), do_statusbar_output(), and do_statusbar_verbatim_kbinput(), do_statusbar_output(), and
display_string(); removal of buffer_to_keys() and display_string(); removal of buffer_to_keys() and
......
...@@ -595,26 +595,7 @@ const char *nstrcasestr(const char *haystack, const char *needle) ...@@ -595,26 +595,7 @@ const char *nstrcasestr(const char *haystack, const char *needle)
} }
#endif #endif
/* None of this is needed if we're using NANO_SMALL! */
#ifndef 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 *revstrcasestr(const char *haystack, const char *needle,
const char *rev_start) const char *rev_start)
{ {
...@@ -632,7 +613,7 @@ const char *revstrcasestr(const char *haystack, const char *needle, ...@@ -632,7 +613,7 @@ const char *revstrcasestr(const char *haystack, const char *needle,
return NULL; return NULL;
} }
#endif /* !NANO_SMALL */ #endif
#ifndef HAVE_STRNLEN #ifndef HAVE_STRNLEN
/* This function is equivalent to strnlen(). */ /* This function is equivalent to strnlen(). */
......
...@@ -131,7 +131,26 @@ void sunder(char *str) ...@@ -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 #ifndef HAVE_GETLINE
/* This function is equivalent to getline(). It was adapted from /* This function is equivalent to getline(). It was adapted from
* GNU mailutils' getline() function. */ * GNU mailutils' getline() function. */
...@@ -189,7 +208,8 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream) ...@@ -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; return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
} }
#endif #endif
#endif /* !NANO_SMALL && ENABLE_NANORC */ #endif /* ENABLE_NANORC */
#endif /* !NANO_SMALL */
/* If we are searching backwards, we will find the last match that /* If we are searching backwards, we will find the last match that
* starts no later than start. Otherwise we find the first match * starts no later than start. Otherwise we find the first match
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment