From d140e6bd3ab6c2f8a9a292f8b1b0ade8a2b6d757 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 4 Jul 2019 18:20:49 +0100 Subject: [PATCH] debug: fix levels and messages --- alias.c | 20 ++++++++++---------- config/enum.c | 2 +- config/mbtable.c | 2 +- email/from.c | 4 ++-- email/parse.c | 2 +- imap/message.c | 2 +- init.c | 6 +++--- mutt/pool.c | 3 +-- mutt/regex.c | 12 ++++++------ mutt_parse.c | 2 +- muttlib.c | 2 +- ncrypt/crypt_gpgme.c | 10 +++++----- ncrypt/pgpkey.c | 12 ++++++------ progress.c | 2 +- rfc3676.c | 7 ++++--- send.c | 4 ++-- sendlib.c | 12 ++++++------ 17 files changed, 52 insertions(+), 52 deletions(-) diff --git a/alias.c b/alias.c index fb2f18073..7283e869b 100644 --- a/alias.c +++ b/alias.c @@ -670,54 +670,54 @@ bool mutt_addr_is_user(const struct Address *addr) { if (!addr) { - mutt_debug(5, "no, NULL address\n"); + mutt_debug(LL_DEBUG5, "no, NULL address\n"); return false; } if (!addr->mailbox) { - mutt_debug(5, "no, no mailbox\n"); + mutt_debug(LL_DEBUG5, "no, no mailbox\n"); return false; } if (mutt_str_strcasecmp(addr->mailbox, Username) == 0) { - mutt_debug(5, "#1 yes, %s = %s\n", addr->mailbox, Username); + mutt_debug(LL_DEBUG5, "#1 yes, %s = %s\n", addr->mailbox, Username); return true; } if (string_is_address(addr->mailbox, Username, ShortHostname)) { - mutt_debug(5, "#2 yes, %s = %s @ %s\n", addr->mailbox, Username, ShortHostname); + mutt_debug(LL_DEBUG5, "#2 yes, %s = %s @ %s\n", addr->mailbox, Username, ShortHostname); return true; } const char *fqdn = mutt_fqdn(false); if (string_is_address(addr->mailbox, Username, fqdn)) { - mutt_debug(5, "#3 yes, %s = %s @ %s\n", addr->mailbox, Username, NONULL(fqdn)); + mutt_debug(LL_DEBUG5, "#3 yes, %s = %s @ %s\n", addr->mailbox, Username, NONULL(fqdn)); return true; } fqdn = mutt_fqdn(true); if (string_is_address(addr->mailbox, Username, fqdn)) { - mutt_debug(5, "#4 yes, %s = %s @ %s\n", addr->mailbox, Username, NONULL(fqdn)); + mutt_debug(LL_DEBUG5, "#4 yes, %s = %s @ %s\n", addr->mailbox, Username, NONULL(fqdn)); return true; } if (C_From && (mutt_str_strcasecmp(C_From->mailbox, addr->mailbox) == 0)) { - mutt_debug(5, "#5 yes, %s = %s\n", addr->mailbox, C_From->mailbox); + mutt_debug(LL_DEBUG5, "#5 yes, %s = %s\n", addr->mailbox, C_From->mailbox); return true; } if (mutt_regexlist_match(&Alternates, addr->mailbox)) { - mutt_debug(5, "yes, %s matched by alternates\n", addr->mailbox); + mutt_debug(LL_DEBUG5, "yes, %s matched by alternates\n", addr->mailbox); if (mutt_regexlist_match(&UnAlternates, addr->mailbox)) - mutt_debug(5, "but, %s matched by unalternates\n", addr->mailbox); + mutt_debug(LL_DEBUG5, "but, %s matched by unalternates\n", addr->mailbox); else return true; } - mutt_debug(5, "no, all failed\n"); + mutt_debug(LL_DEBUG5, "no, all failed\n"); return false; } diff --git a/config/enum.c b/config/enum.c index 812f521a9..bd9a22d22 100644 --- a/config/enum.c +++ b/config/enum.c @@ -121,7 +121,7 @@ static int enum_string_get(const struct ConfigSet *cs, void *var, const char *name = mutt_map_get_name(value, ed->lookup); if (!name) { - mutt_debug(1, "Variable has an invalid value: %d\n", value); + mutt_debug(LL_DEBUG1, "Variable has an invalid value: %d\n", value); return (CSR_ERR_INVALID | CSR_INV_TYPE); } diff --git a/config/mbtable.c b/config/mbtable.c index 6d316f84c..7c1cc6886 100644 --- a/config/mbtable.c +++ b/config/mbtable.c @@ -67,7 +67,7 @@ struct MbTable *mbtable_parse(const char *s) if ((k == (size_t)(-1)) || (k == (size_t)(-2))) { /* XXX put message in err buffer; fail? warning? */ - mutt_debug(LL_DEBUG1, "mbtable_parse: mbrtowc returned %d converting %s in %s\n", + mutt_debug(LL_DEBUG1, "mbrtowc returned %d converting %s in %s\n", (k == (size_t)(-1)) ? -1 : -2, s, t->orig_str); if (k == (size_t)(-1)) memset(&mbstate, 0, sizeof(mbstate)); diff --git a/email/from.c b/email/from.c index ba84411e0..2e9ce5680 100644 --- a/email/from.c +++ b/email/from.c @@ -61,7 +61,7 @@ bool is_from(const char *s, char *path, size_t pathlen, time_t *tp) if (!*s) return false; - mutt_debug(5, "\nis_from(): parsing: %s\n", s); + mutt_debug(LL_DEBUG5, "\nis_from(): parsing: %s\n", s); if (!mutt_date_is_day_name(s)) { @@ -106,7 +106,7 @@ bool is_from(const char *s, char *path, size_t pathlen, time_t *tp) len = pathlen - 1; memcpy(path, s, len); path[len] = '\0'; - mutt_debug(5, "got return path: %s\n", path); + mutt_debug(LL_DEBUG5, "got return path: %s\n", path); } s = p + 1; diff --git a/email/parse.c b/email/parse.c index 4e024c1ef..6c019e225 100644 --- a/email/parse.c +++ b/email/parse.c @@ -1110,7 +1110,7 @@ struct Envelope *mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hd } if (env->spam && env->spam->data) - mutt_debug(5, "spam = %s\n", env->spam->data); + mutt_debug(LL_DEBUG5, "spam = %s\n", env->spam->data); } } diff --git a/imap/message.c b/imap/message.c index da8835a97..a6177a9ea 100644 --- a/imap/message.c +++ b/imap/message.c @@ -1536,7 +1536,7 @@ int imap_append_message(struct Mailbox *m, struct Message *msg) return 0; cmd_step_fail: - mutt_debug(LL_DEBUG1, "imap_append_message(): command failed: %s\n", adata->buf); + mutt_debug(LL_DEBUG1, "command failed: %s\n", adata->buf); if (rc != IMAP_CMD_BAD) { char *pc = imap_next_word(adata->buf); /* skip sequence number or token */ diff --git a/init.c b/init.c index 04dddc5cd..7b1ad3aa9 100644 --- a/init.c +++ b/init.c @@ -930,7 +930,7 @@ static enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s, } mutt_extract_token(buf, s, MUTT_TOKEN_QUOTE | MUTT_TOKEN_SPACE | MUTT_TOKEN_SEMICOLON); - mutt_debug(5, "Second token is '%s'\n", buf->data); + mutt_debug(LL_DEBUG5, "Second token is '%s'\n", buf->data); mutt_addrlist_parse2(&tmp->addr, buf->data); @@ -954,9 +954,9 @@ static enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s, break; if (a->group) - mutt_debug(5, " Group %s\n", a->mailbox); + mutt_debug(LL_DEBUG5, " Group %s\n", a->mailbox); else - mutt_debug(5, " %s\n", a->mailbox); + mutt_debug(LL_DEBUG5, " %s\n", a->mailbox); } } mutt_grouplist_destroy(&gl); diff --git a/mutt/pool.c b/mutt/pool.c index de6baae23..0c28471a8 100644 --- a/mutt/pool.c +++ b/mutt/pool.c @@ -60,8 +60,7 @@ static void increase_buffer_pool(void) */ void mutt_buffer_pool_free(void) { - mutt_debug(LL_DEBUG1, "mutt_buffer_pool_free: %zu of %zu returned to pool\n", - BufferPoolCount, BufferPoolLen); + mutt_debug(LL_DEBUG1, "%zu of %zu returned to pool\n", BufferPoolCount, BufferPoolLen); while (BufferPoolCount) mutt_buffer_free(&BufferPool[--BufferPoolCount]); diff --git a/mutt/regex.c b/mutt/regex.c index f2ee83124..0a3ca45c9 100644 --- a/mutt/regex.c +++ b/mutt/regex.c @@ -198,7 +198,7 @@ bool mutt_regexlist_match(struct RegexList *rl, const char *str) continue; if (regexec(np->regex->regex, str, 0, NULL, 0) == 0) { - mutt_debug(5, "%s matches %s\n", str, np->regex->pattern); + mutt_debug(LL_DEBUG5, "%s matches %s\n", str, np->regex->pattern); return true; } } @@ -389,7 +389,7 @@ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, c switcher ^= 1; dst = twinbuf[switcher]; - mutt_debug(5, "%s matches %s\n", src, np->regex->pattern); + mutt_debug(LL_DEBUG5, "%s matches %s\n", src, np->regex->pattern); /* Copy into other twinbuf with substitutions */ if (np->tmpl) @@ -429,7 +429,7 @@ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, c } } dst[tlen] = '\0'; - mutt_debug(5, "subst %s\n", dst); + mutt_debug(LL_DEBUG5, "subst %s\n", dst); } src = dst; } @@ -496,8 +496,8 @@ bool mutt_replacelist_match(struct ReplaceList *rl, char *buf, size_t buflen, co /* Does this pattern match? */ if (regexec(np->regex->regex, str, (size_t) np->nmatch, pmatch, 0) == 0) { - mutt_debug(5, "%s matches %s\n", str, np->regex->pattern); - mutt_debug(5, "%d subs\n", (int) np->regex->regex->re_nsub); + mutt_debug(LL_DEBUG5, "%s matches %s\n", str, np->regex->pattern); + mutt_debug(LL_DEBUG5, "%d subs\n", (int) np->regex->regex->re_nsub); /* Copy template into buf, with substitutions. */ for (p = np->tmpl; *p && tlen < buflen - 1;) @@ -538,7 +538,7 @@ bool mutt_replacelist_match(struct ReplaceList *rl, char *buf, size_t buflen, co if (tlen < buflen) { buf[tlen] = '\0'; - mutt_debug(5, "\"%s\"\n", buf); + mutt_debug(LL_DEBUG5, "\"%s\"\n", buf); } return true; } diff --git a/mutt_parse.c b/mutt_parse.c index 26469693c..0a9e36bc2 100644 --- a/mutt_parse.c +++ b/mutt_parse.c @@ -129,7 +129,7 @@ static int count_body_parts(struct Body *body, int flags) bool shallcount = true; /* default */ bool shallrecurse = false; - mutt_debug(5, "desc=\"%s\"; fn=\"%s\", type=\"%d/%s\"\n", + mutt_debug(LL_DEBUG5, "desc=\"%s\"; fn=\"%s\", type=\"%d/%s\"\n", bp->description ? bp->description : ("none"), bp->filename ? bp->filename : bp->d_filename ? bp->d_filename : "(none)", bp->type, bp->subtype ? bp->subtype : "*"); diff --git a/muttlib.c b/muttlib.c index e8b873821..48b8369f3 100644 --- a/muttlib.c +++ b/muttlib.c @@ -940,7 +940,7 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c buf[n] = '\0'; while ((n > 0) && ((buf[n - 1] == '\n') || (buf[n - 1] == '\r'))) buf[--n] = '\0'; - mutt_debug(5, "fmtpipe < %s\n", buf); + mutt_debug(LL_DEBUG5, "fmtpipe < %s\n", buf); /* If the result ends with '%', this indicates that the filter * generated %-tokens that neomutt can expand. Eliminate the '%' diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 29f324ca5..4dc3b445f 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -4902,11 +4902,11 @@ static struct CryptKeyInfo *crypt_getkeybyaddr(struct Address *a, if (!keys) return NULL; - mutt_debug(5, "looking for %s <%s>\n", a ? a->personal : "", a ? a->mailbox : ""); + mutt_debug(LL_DEBUG5, "looking for %s <%s>\n", a ? a->personal : "", a ? a->mailbox : ""); for (k = keys; k; k = k->next) { - mutt_debug(5, " looking at key: %s '%.15s'\n", crypt_keyid(k), k->uid); + mutt_debug(LL_DEBUG5, " looking at key: %s '%.15s'\n", crypt_keyid(k), k->uid); if (abilities && !(k->flags & abilities)) { @@ -5027,7 +5027,7 @@ static struct CryptKeyInfo *crypt_getkeybystr(const char *p, KeyFlags abilities, if (abilities && !(k->flags & abilities)) continue; - mutt_debug(5, "matching \"%s\" against key %s, \"%s\": ", p, + mutt_debug(LL_DEBUG5, "matching \"%s\" against key %s, \"%s\": ", p, crypt_long_keyid(k), k->uid); if (!*p || (pfcopy && (mutt_str_strcasecmp(pfcopy, crypt_fpr(k)) == 0)) || @@ -5035,7 +5035,7 @@ static struct CryptKeyInfo *crypt_getkeybystr(const char *p, KeyFlags abilities, (ps && (mutt_str_strcasecmp(ps, crypt_short_keyid(k)) == 0)) || mutt_str_stristr(k->uid, p)) { - mutt_debug(5, "match\n"); + mutt_debug(LL_DEBUG5, "match\n"); struct CryptKeyInfo *tmp = crypt_copy_key(k); *matches_endp = tmp; @@ -5043,7 +5043,7 @@ static struct CryptKeyInfo *crypt_getkeybystr(const char *p, KeyFlags abilities, } else { - mutt_debug(5, "no match\n"); + mutt_debug(LL_DEBUG5, "no match\n"); } } diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 4767f73fa..3353f3964 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -1016,13 +1016,13 @@ struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, KeyFlags abilities, if (!keys) return NULL; - mutt_debug(5, "looking for %s <%s>\n", a->personal, a->mailbox); + mutt_debug(LL_DEBUG5, "looking for %s <%s>\n", a->personal, a->mailbox); for (k = keys; k; k = kn) { kn = k->next; - mutt_debug(5, " looking at key: %s\n", pgp_keyid(k)); + mutt_debug(LL_DEBUG5, " looking at key: %s\n", pgp_keyid(k)); if (abilities && !(k->flags & abilities)) { @@ -1155,24 +1155,24 @@ struct PgpKeyInfo *pgp_getkeybystr(const char *cp, KeyFlags abilities, enum PgpR bool match = false; - mutt_debug(5, "matching \"%s\" against key %s:\n", p, pgp_long_keyid(k)); + mutt_debug(LL_DEBUG5, "matching \"%s\" against key %s:\n", p, pgp_long_keyid(k)); if (!*p || (pfcopy && (mutt_str_strcasecmp(pfcopy, k->fingerprint) == 0)) || (pl && (mutt_str_strcasecmp(pl, pgp_long_keyid(k)) == 0)) || (ps && (mutt_str_strcasecmp(ps, pgp_short_keyid(k)) == 0))) { - mutt_debug(5, "\t\tmatch #1\n"); + mutt_debug(LL_DEBUG5, "\t\tmatch #1\n"); match = true; } else { for (a = k->address; a; a = a->next) { - mutt_debug(5, "matching \"%s\" against key %s, \"%s\":\n", p, + mutt_debug(LL_DEBUG5, "matching \"%s\" against key %s, \"%s\":\n", p, pgp_long_keyid(k), NONULL(a->addr)); if (mutt_str_stristr(a->addr, p)) { - mutt_debug(5, "\t\tmatch #2\n"); + mutt_debug(LL_DEBUG5, "\t\tmatch #2\n"); match = true; break; } diff --git a/progress.c b/progress.c index 61052ace0..d8f0e9932 100644 --- a/progress.c +++ b/progress.c @@ -212,7 +212,7 @@ void mutt_progress_update(struct Progress *progress, long pos, int percent) else snprintf(posstr, sizeof(posstr), "%ld", pos); - mutt_debug(4, "updating progress: %s\n", posstr); + mutt_debug(LL_DEBUG4, "updating progress: %s\n", posstr); progress->pos = pos; if (now) diff --git a/rfc3676.c b/rfc3676.c index 7c17031ae..46cc13bce 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -239,12 +239,13 @@ static void print_flowed_line(char *line, struct State *s, int ql, width = quote_width(s, ql); last = line[mutt_str_strlen(line) - 1]; - mutt_debug(5, "f=f: line [%s], width = %ld, spaces = %lu\n", line, + mutt_debug(LL_DEBUG5, "f=f: line [%s], width = %ld, spaces = %lu\n", line, (long) width, fst->spaces); for (words = 0; (p = strsep(&line, " "));) { - mutt_debug(5, "f=f: word [%s], width: %lu, remaining = [%s]\n", p, fst->width, line); + mutt_debug(LL_DEBUG5, "f=f: word [%s], width: %lu, remaining = [%s]\n", p, + fst->width, line); /* remember number of spaces */ if (!*p) @@ -430,7 +431,7 @@ void rfc3676_space_stuff(struct Email *e) c = buf[len - 1]; buf[len - 1] = '\0'; } - mutt_debug(5, "f=f: line %d needs space-stuffing: '%s'\n", lc, buf); + mutt_debug(LL_DEBUG5, "f=f: line %d needs space-stuffing: '%s'\n", lc, buf); if (len > 0) buf[len - 1] = c; } diff --git a/send.c b/send.c index b25cc3e1f..0eae09357 100644 --- a/send.c +++ b/send.c @@ -1995,7 +1995,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (!TAILQ_EMPTY(&msg->env->from)) { - mutt_debug(5, "msg->env->from before set_reverse_name: %s\n", + mutt_debug(LL_DEBUG5, "msg->env->from before set_reverse_name: %s\n", TAILQ_FIRST(&msg->env->from)->mailbox); mutt_addrlist_clear(&msg->env->from); } @@ -2014,7 +2014,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (!TAILQ_EMPTY(&cur->env->x_original_to) && TAILQ_EMPTY(&msg->env->from)) { mutt_addrlist_copy(&msg->env->from, &cur->env->x_original_to, false); - mutt_debug(5, "msg->env->from extracted from X-Original-To: header: %s\n", + mutt_debug(LL_DEBUG5, "msg->env->from extracted from X-Original-To: header: %s\n", TAILQ_FIRST(&msg->env->from)->mailbox); } } diff --git a/sendlib.c b/sendlib.c index a1adafd78..7445d6e53 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1896,8 +1896,8 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value, int first = 1, col = 0, l = 0; const bool display = (chflags & CH_DISPLAY); - mutt_debug(5, "pfx=[%s], tag=[%s], flags=%d value=[%s]\n", pfx, tag, chflags, - NONULL(value)); + mutt_debug(LL_DEBUG5, "pfx=[%s], tag=[%s], flags=%d value=[%s]\n", pfx, tag, + chflags, NONULL(value)); if (tag && *tag && (fprintf(fp, "%s%s: ", NONULL(pfx), tag) < 0)) return -1; @@ -1919,7 +1919,7 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value, const int w = mutt_mb_width(buf, col, display); const int enc = mutt_str_startswith(buf, "=?", CASE_MATCH); - mutt_debug(5, "word=[%s], col=%d, w=%d, next=[0x0%x]\n", buf, col, w, *next); + mutt_debug(LL_DEBUG5, "word=[%s], col=%d, w=%d, next=[0x0%x]\n", buf, col, w, *next); /* insert a folding \n before the current word's lwsp except for * header name, first word on a line (word longer than wrap width) @@ -2040,8 +2040,8 @@ static int write_one_header(FILE *fp, int pfxw, int max, int wraplen, const char if (!(chflags & CH_DISPLAY) && ((pfxw + max <= wraplen) || is_from)) { valbuf = mutt_str_substr_dup(start, end); - mutt_debug(5, "buf[%s%s] short enough, max width = %d <= %d\n", NONULL(pfx), - valbuf, max, wraplen); + mutt_debug(LL_DEBUG5, "buf[%s%s] short enough, max width = %d <= %d\n", + NONULL(pfx), valbuf, max, wraplen); if (pfx && *pfx) { if (fputs(pfx, fp) == EOF) @@ -2149,7 +2149,7 @@ int mutt_write_one_header(FILE *fp, const char *tag, const char *value, /* if header is short enough, simply print it */ if (!display && (mutt_strwidth(tag) + 2 + pfxw + mutt_strwidth(v) <= wraplen)) { - mutt_debug(5, "buf[%s%s: %s] is short enough\n", NONULL(pfx), tag, v); + mutt_debug(LL_DEBUG5, "buf[%s%s: %s] is short enough\n", NONULL(pfx), tag, v); if (fprintf(fp, "%s%s: %s\n", NONULL(pfx), tag, v) <= 0) goto out; rc = 0; -- 2.40.0