is_blank_wchar(), is_cntrl_mbchar(), is_cntrl_wchar(),
control_mbrep(), control_wrep(), mbwidth(), mb_cur_max(),
make_mbchar(), mbstrnlen(), mbstrcasecmp(), and
- mbstrncasecmp(); changes to is_blank_char() (moved to
- 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), revstristr()
+ mbstrncasecmp(); changes to is_byte() (moved to chars.c),
+ is_blank_char() (moved to 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
#include <wctype.h>
#endif
+/* Return TRUE if the value of c is in byte range, and FALSE
+ * otherwise. */
+bool is_byte(unsigned int c)
+{
+ return (c == (unsigned char)c);
+}
+
/* This function is equivalent to isalnum(). */
bool is_alnum_char(unsigned int c)
{
#endif
#ifndef NANO_SMALL
+/* This function is equivalent to strstr(), except in that it scans the
+ * string in reverse. */
+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;
+}
+
+/* This function is equivalent to strcasestr(), except in that it scans
+ * the string in reverse. */
const char *revstrcasestr(const char *haystack, const char *needle,
const char *rev_start)
{
/* Functions we want available. */
/* Public functions in chars.c. */
+bool is_byte(unsigned int c);
bool is_alnum_char(unsigned int c);
bool is_alnum_mbchar(const char *c);
#ifdef NANO_WIDE
int regexp_bol_or_eol(const regex_t *preg, const char *string);
#endif
int num_of_digits(int n);
-bool is_byte(unsigned int c);
bool parse_num(const char *str, ssize_t *val);
void align(char **strp);
void null_at(char **data, size_t index);
return i;
}
-bool is_byte(unsigned int c)
-{
- return (c == (unsigned char)c);
-}
-
/* Read a ssize_t from str, and store it in *val (if val is not NULL).
* On error, we return FALSE and don't change *val. Otherwise, we
* return TRUE. */
}
}
-#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
+#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
#ifndef HAVE_GETLINE
/* This function is equivalent to getline(). It was adapted from
* GNU mailutils' getline() function. */
return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
}
#endif
-#endif /* ENABLE_NANORC */
-#endif /* !NANO_SMALL */
+#endif /* !NANO_SMALL && ENABLE_NANORC */
/* If we are searching backwards, we will find the last match that
* starts no later than start. Otherwise we find the first match