X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=color.c;h=17af49a2f6386455edc4f1c544ea88a06996b9e6;hp=82180f7b91a5f341a1310a16419f8be71800518d;hb=2b2f17c2b838911949a6e8665ef3131382099a62;hpb=9274cbe8e6410ddb95ddc667faa678a29da85420 diff --git a/color.c b/color.c index 82180f7..17af49a 100644 --- a/color.c +++ b/color.c @@ -15,11 +15,11 @@ #include #include #include +#include +#include #include "mutt.h" -#include "buffer.h" #include "mutt_curses.h" -#include "mapping.h" #include "lib/debug.h" @@ -162,21 +162,21 @@ static char *get_color_name (char *dest, size_t destlen, int val) switch (val) { case COLOR_YELLOW: - strfcpy (dest, missing[0], destlen); + m_strcpy(dest, destlen, missing[0]); return dest; case COLOR_WHITE: - strfcpy (dest, missing[1], destlen); + m_strcpy(dest, destlen, missing[1]); return dest; case COLOR_DEFAULT: - strfcpy (dest, missing[2], destlen); + m_strcpy(dest, destlen, missing[2]); return dest; } for (i = 0; Colors[i].name; i++) { if (Colors[i].value == val) { - strfcpy (dest, Colors[i].name, destlen); + m_strcpy(dest, destlen, Colors[i].name); return dest; } } @@ -214,7 +214,7 @@ int mutt_alloc_color (int fg, int bg) /* find the smallest available index (object) */ i = 1; - FOREVER { + for (;;) { p = ColorList; while (p) { if (p->index == i) @@ -298,13 +298,13 @@ parse_color_name (const char *s, int *col, int *attr, int brite, BUFFER * err) { char *eptr; - if (str_ncasecmp (s, "bright", 6) == 0) { + if (m_strncasecmp(s, "bright", 6) == 0) { *attr |= brite; s += 6; } /* allow aliases for xterm color resources */ - if (str_ncasecmp (s, "color", 5) == 0) { + if (m_strncasecmp(s, "color", 5) == 0) { s += 5; *col = strtol (s, &eptr, 10); if (!*s || *eptr || *col < 0 || @@ -364,7 +364,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data, return (-1); } - if (str_ncmp (buf->data, "index", 5) != 0) { + if (m_strncmp(buf->data, "index", 5) != 0) { snprintf (err->data, err->dsize, _("%s: command valid only for index object"), parse_uncolor ? "uncolor" : "unmono"); @@ -402,7 +402,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data, do { mutt_extract_token (buf, s, 0); - if (!str_cmp ("*", buf->data)) { + if (!m_strcmp("*", buf->data)) { for (tmp = ColorIndexList; tmp;) { if (!do_cache) do_cache = 1; @@ -415,7 +415,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data, else { for (last = NULL, tmp = ColorIndexList; tmp; last = tmp, tmp = tmp->next) { - if (!str_cmp (buf->data, tmp->pattern)) { + if (!m_strcmp(buf->data, tmp->pattern)) { if (!do_cache) do_cache = 1; debug_print (1, ("Freeing pattern \"%s\" from ColorIndexList\n", tmp->pattern)); @@ -457,11 +457,11 @@ add_pattern (COLOR_LINE ** top, const char *s, int sensitive, while (tmp) { if (sensitive) { - if (str_cmp (s, tmp->pattern) == 0) + if (m_strcmp(s, tmp->pattern) == 0) break; } else { - if (str_casecmp (s, tmp->pattern) == 0) + if (m_strcasecmp(s, tmp->pattern) == 0) break; } tmp = tmp->next; @@ -490,7 +490,7 @@ add_pattern (COLOR_LINE ** top, const char *s, int sensitive, if (is_index) { int i; - strfcpy (buf, NONULL (s), sizeof (buf)); + m_strcpy(buf, sizeof(buf), NONULL(s)); mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch)); if ((tmp->color_pattern = mutt_pattern_comp (buf, M_FULL_MSG, err)) == NULL) { @@ -532,12 +532,12 @@ parse_object (BUFFER * buf, BUFFER * s, int *o, int *ql, BUFFER * err) char *eptr; if (!MoreArgs (s)) { - strfcpy (err->data, _("Missing arguments."), err->dsize); + m_strcpy(err->data, err->dsize, _("Missing arguments.")); return -1; } mutt_extract_token (buf, s, 0); - if (!str_ncmp (buf->data, "quoted", 6)) { + if (!m_strncmp(buf->data, "quoted", 6)) { if (buf->data[6]) { *ql = strtol (buf->data + 6, &eptr, 10); if (*eptr || q_level < 0) { @@ -568,7 +568,7 @@ parse_color_pair (BUFFER * buf, BUFFER * s, int *fg, int *bg, int *attr, BUFFER * err) { if (!MoreArgs (s)) { - strfcpy (err->data, _("color: too few arguments"), err->dsize); + m_strcpy(err->data, err->dsize, _("color: too few arguments")); return (-1); } @@ -578,7 +578,7 @@ parse_color_pair (BUFFER * buf, BUFFER * s, int *fg, int *bg, int *attr, return (-1); if (!MoreArgs (s)) { - strfcpy (err->data, _("color: too few arguments"), err->dsize); + m_strcpy(err->data, err->dsize, _("color: too few arguments")); return (-1); } @@ -603,7 +603,7 @@ parse_attr_spec (BUFFER * buf, BUFFER * s, int *fg, int *bg, int *attr, *bg = -1; if (!MoreArgs (s)) { - strfcpy (err->data, _("mono: too few arguments"), err->dsize); + m_strcpy(err->data, err->dsize, _("mono: too few arguments")); return (-1); } @@ -661,7 +661,7 @@ _mutt_parse_color (BUFFER * buf, BUFFER * s, BUFFER * err, if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY || object == MT_COLOR_INDEX) { if (!MoreArgs (s)) { - strfcpy (err->data, _("too few arguments"), err->dsize); + m_strcpy(err->data, err->dsize, _("too few arguments")); return (-1); } @@ -669,7 +669,7 @@ _mutt_parse_color (BUFFER * buf, BUFFER * s, BUFFER * err, } if (MoreArgs (s)) { - strfcpy (err->data, _("too many arguments"), err->dsize); + m_strcpy(err->data, err->dsize, _("too many arguments")); return (-1); } @@ -685,7 +685,7 @@ _mutt_parse_color (BUFFER * buf, BUFFER * s, BUFFER * err, /* delay use_default_colors() until needed, since it initializes things */ && (fg == COLOR_DEFAULT || bg == COLOR_DEFAULT) && use_default_colors () != OK) { - strfcpy (err->data, _("default colors not supported"), err->dsize); + m_strcpy(err->data, err->dsize, _("default colors not supported")); return (-1); } # endif /* HAVE_USE_DEFAULT_COLORS */