From dce39a03fdbef364d81f72452af199c90914b3dd Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 14 Jul 2017 22:07:37 +0100 Subject: [PATCH] rename mutt_format_string and mutt_FormatString `mutt_format_string` and `mutt_FormatString` were much to similarly named to be useful. The first only does formatting. The second uses expandos to allow custom expansion. To avoid future confusion, I've created new names that are distinct: mutt_format_string mutt_simple_format mutt_FormatString mutt_expando_format --- addrbook.c | 2 +- browser.c | 14 +++++++------- commands.c | 2 +- compose.c | 4 ++-- compress.c | 6 +++--- curs_lib.c | 8 ++++---- format_flags.h | 4 ++-- hdrline.c | 8 ++++---- lib.h | 4 ++-- menu.c | 2 +- muttlib.c | 15 ++++++++------- ncrypt/crypt_gpgme.c | 6 +++--- ncrypt/pgpinvoke.c | 6 +++--- ncrypt/pgpkey.c | 6 +++--- ncrypt/smime.c | 6 +++--- newsrc.c | 2 +- protos.h | 2 +- query.c | 6 +++--- recvattach.c | 6 +++--- recvcmd.c | 2 +- remailer.c | 6 +++--- sendlib.c | 2 +- sidebar.c | 10 +++++----- status.c | 4 ++-- 24 files changed, 67 insertions(+), 66 deletions(-) diff --git a/addrbook.c b/addrbook.c index 6310d8075..3ac40685c 100644 --- a/addrbook.c +++ b/addrbook.c @@ -86,7 +86,7 @@ static const char *alias_format_str(char *dest, size_t destlen, size_t col, int static void alias_entry(char *s, size_t slen, struct Menu *m, int num) { - mutt_FormatString(s, slen, 0, MuttIndexWindow->cols, NONULL(AliasFmt), alias_format_str, + mutt_expando_format(s, slen, 0, MuttIndexWindow->cols, NONULL(AliasFmt), alias_format_str, (unsigned long) ((struct Alias **) m->data)[num], MUTT_FORMAT_ARROWCURSOR); } diff --git a/browser.c b/browser.c index 0f27472d3..40235f74a 100644 --- a/browser.c +++ b/browser.c @@ -486,9 +486,9 @@ static const char *folder_format_str(char *dest, size_t destlen, size_t col, int } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, folder_format_str, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, folder_format_str, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, folder_format_str, data, 0); + mutt_expando_format(dest, destlen, col, cols, elsestring, folder_format_str, data, 0); return src; } @@ -535,10 +535,10 @@ static const char *newsgroup_format_str(char *dest, size_t destlen, size_t col, if (flags & MUTT_FORMAT_OPTIONAL) { if (folder->ff->nd->unread != 0) - mutt_FormatString(dest, destlen, col, cols, ifstring, + mutt_expando_format(dest, destlen, col, cols, ifstring, newsgroup_format_str, data, flags); else - mutt_FormatString(dest, destlen, col, cols, elsestring, + mutt_expando_format(dest, destlen, col, cols, elsestring, newsgroup_format_str, data, flags); } else if (Context && Context->data == folder->ff->nd) @@ -900,11 +900,11 @@ static void folder_entry(char *s, size_t slen, struct Menu *menu, int num) #ifdef USE_NNTP if (option(OPTNEWS)) - mutt_FormatString(s, slen, 0, MuttIndexWindow->cols, NONULL(GroupFormat), newsgroup_format_str, + mutt_expando_format(s, slen, 0, MuttIndexWindow->cols, NONULL(GroupFormat), newsgroup_format_str, (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR); else #endif - mutt_FormatString(s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), + mutt_expando_format(s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str, (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR); } @@ -916,7 +916,7 @@ static void vfolder_entry(char *s, size_t slen, struct Menu *menu, int num) folder.ff = &((struct FolderFile *) menu->data)[num]; folder.num = num; - mutt_FormatString(s, slen, 0, MuttIndexWindow->cols, NONULL(VirtFolderFormat), + mutt_expando_format(s, slen, 0, MuttIndexWindow->cols, NONULL(VirtFolderFormat), folder_format_str, (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR); } #endif diff --git a/commands.c b/commands.c index 4fb6f8db0..bb1a86bc5 100644 --- a/commands.c +++ b/commands.c @@ -324,7 +324,7 @@ void ci_bounce_message(struct Header *h) if (mutt_strwidth(prompt) > MuttMessageWindow->cols - extra_space) { - mutt_format_string(prompt, sizeof(prompt), 0, MuttMessageWindow->cols - extra_space, + mutt_simple_format(prompt, sizeof(prompt), 0, MuttMessageWindow->cols - extra_space, FMT_LEFT, 0, scratch, sizeof(scratch), 0); safe_strcat(prompt, sizeof(prompt), "...?"); } diff --git a/compose.c b/compose.c index b37765f22..f2eb29b5f 100644 --- a/compose.c +++ b/compose.c @@ -227,7 +227,7 @@ static void init_header_padding(void) static void snd_entry(char *b, size_t blen, struct Menu *menu, int num) { - mutt_FormatString(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), mutt_attach_fmt, + mutt_expando_format(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), mutt_attach_fmt, (unsigned long) (((struct AttachPtr **) menu->data)[num]), MUTT_FORMAT_STAT_FILE | MUTT_FORMAT_ARROWCURSOR); } @@ -694,7 +694,7 @@ static const char *compose_format_str(char *buf, size_t buflen, size_t col, int static void compose_status_line(char *buf, size_t buflen, size_t col, int cols, struct Menu *menu, const char *p) { - mutt_FormatString(buf, buflen, col, cols, p, compose_format_str, (unsigned long) menu, 0); + mutt_expando_format(buf, buflen, col, cols, p, compose_format_str, (unsigned long) menu, 0); } /** diff --git a/compress.c b/compress.c index e510add09..316ea21e5 100644 --- a/compress.c +++ b/compress.c @@ -348,7 +348,7 @@ static char *escape_path(char *src) * @param flags Format flags, UNUSED * @return src (unchanged) * - * cb_format_str is a callback function for mutt_FormatString. It understands + * cb_format_str is a callback function for mutt_expando_format. It understands * two operators. '%f' : 'from' filename, '%t' : 'to' filename. */ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int cols, @@ -383,7 +383,7 @@ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int col * @param buflen Size of the buffer * * This function takes a hook command and expands the filename placeholders - * within it. The function calls mutt_FormatString() to do the replacement + * within it. The function calls mutt_expando_format() to do the replacement * which calls our callback function cb_format_str(). e.g. * * Template command: @@ -397,7 +397,7 @@ static void expand_command_str(const struct Context *ctx, const char *cmd, char if (!ctx || !cmd || !buf) return; - mutt_FormatString(buf, buflen, 0, buflen, cmd, cb_format_str, (unsigned long) ctx, 0); + mutt_expando_format(buf, buflen, 0, buflen, cmd, cb_format_str, (unsigned long) ctx, 0); } /** diff --git a/curs_lib.c b/curs_lib.c index a20d2b076..70822e974 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -406,7 +406,7 @@ static void curses_message(int error, const char *fmt, va_list ap) vsnprintf(scratch, sizeof(scratch), fmt, ap); mutt_debug(1, "%s\n", scratch); - mutt_format_string(Errorbuf, sizeof(Errorbuf), 0, MuttMessageWindow->cols, + mutt_simple_format(Errorbuf, sizeof(Errorbuf), 0, MuttMessageWindow->cols, FMT_LEFT, 0, scratch, sizeof(scratch), 0); if (!option(OPTKEEPQUIET)) @@ -501,7 +501,7 @@ static void message_bar(int percent, const char *fmt, ...) l = mutt_strwidth(buf); va_end(ap); - mutt_format_string(buf2, sizeof(buf2), 0, COLS - 2, FMT_LEFT, 0, buf, sizeof(buf), 0); + mutt_simple_format(buf2, sizeof(buf2), 0, COLS - 2, FMT_LEFT, 0, buf, sizeof(buf), 0); move(LINES - 1, 0); @@ -1147,7 +1147,7 @@ int mutt_addwch(wchar_t wc) * min_width, max_width, s), except that the widths refer to the number of * character cells when printed. */ -void mutt_format_string(char *dest, size_t destlen, int min_width, int max_width, +void mutt_simple_format(char *dest, size_t destlen, int min_width, int max_width, int justify, char m_pad_char, const char *s, size_t n, int arboreal) { char *p = NULL; @@ -1277,7 +1277,7 @@ static void format_s_x(char *dest, size_t destlen, const char *prefix, max_width = INT_MAX; } - mutt_format_string(dest, destlen, min_width, max_width, justify, ' ', s, + mutt_simple_format(dest, destlen, min_width, max_width, justify, ' ', s, mutt_strlen(s), arboreal); } diff --git a/format_flags.h b/format_flags.h index 286616a08..6295efaf7 100644 --- a/format_flags.h +++ b/format_flags.h @@ -26,7 +26,7 @@ #include /** - * enum FormatFlag - Control the behaviour of mutt_FormatString() + * enum FormatFlag - Control the behaviour of mutt_expando_format() */ enum FormatFlag { @@ -45,7 +45,7 @@ typedef const char *format_t(char *dest, size_t destlen, size_t col, int cols, const char *ifstring, const char *elsestring, unsigned long data, enum FormatFlag flags); -void mutt_FormatString(char *dest, /* output buffer */ +void mutt_expando_format(char *dest, /* output buffer */ size_t destlen, /* output buffer len */ size_t col, /* starting column (nonzero when called recursively) */ int cols, /* maximum columns */ diff --git a/hdrline.c b/hdrline.c index 951024edb..a1bf1385d 100644 --- a/hdrline.c +++ b/hdrline.c @@ -1338,10 +1338,10 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, hdr_format_str, + mutt_expando_format(dest, destlen, col, cols, ifstring, hdr_format_str, (unsigned long) hfi, flags); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, hdr_format_str, + mutt_expando_format(dest, destlen, col, cols, elsestring, hdr_format_str, (unsigned long) hfi, flags); return src; @@ -1358,12 +1358,12 @@ void _mutt_make_string(char *dest, size_t destlen, const char *s, hfi.ctx = ctx; hfi.pager_progress = 0; - mutt_FormatString(dest, destlen, 0, MuttIndexWindow->cols, s, hdr_format_str, + mutt_expando_format(dest, destlen, 0, MuttIndexWindow->cols, s, hdr_format_str, (unsigned long) &hfi, flags); } void mutt_make_string_info(char *dst, size_t dstlen, int cols, const char *s, struct HdrFormatInfo *hfi, enum FormatFlag flags) { - mutt_FormatString(dst, dstlen, 0, cols, s, hdr_format_str, (unsigned long) hfi, flags); + mutt_expando_format(dst, dstlen, 0, cols, s, hdr_format_str, (unsigned long) hfi, flags); } diff --git a/lib.h b/lib.h index f015534fc..ee12c012b 100644 --- a/lib.h +++ b/lib.h @@ -63,9 +63,9 @@ * definition, it obviously won't produce a correct result. */ #define mutt_array_size(x) (sizeof(x) / sizeof((x)[0])) -/* For mutt_format_string() justifications */ +/* For mutt_simple_format() justifications */ /* Making left 0 and center -1 is of course completely nonsensical, but - * it retains compatibility for any patches that call mutt_format_string. + * it retains compatibility for any patches that call mutt_simple_format. * Once patches are updated to use FMT_*, these can be made sane. */ #define FMT_LEFT 0 #define FMT_RIGHT 1 diff --git a/menu.c b/menu.c index fa4de3b2c..1c760d741 100644 --- a/menu.c +++ b/menu.c @@ -286,7 +286,7 @@ static void menu_pad_string(struct Menu *menu, char *s, size_t n) int shift = option(OPTARROWCURSOR) ? 3 : 0; int cols = menu->indexwin->cols - shift; - mutt_format_string(s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen(scratch), 1); + mutt_simple_format(s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen(scratch), 1); s[n - 1] = 0; FREE(&scratch); } diff --git a/muttlib.c b/muttlib.c index 53b21948a..b646d805a 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1331,7 +1331,7 @@ char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, struct ReplaceList /** - * mutt_FormatString - Expand expandos (%x) in a string + * mutt_expando_format - Expand expandos (%x) in a string * @param dest output buffer * @param destlen output buffer len * @param col starting column (nonzero when called recursively) @@ -1341,8 +1341,9 @@ char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, struct ReplaceList * @param data callback data * @param flags callback flags */ -void mutt_FormatString(char *dest, size_t destlen, size_t col, int cols, const char *src, - format_t *callback, unsigned long data, enum FormatFlag flags) +void mutt_expando_format(char *dest, size_t destlen, size_t col, int cols, + const char *src, format_t *callback, + unsigned long data, enum FormatFlag flags) { char prefix[SHORT_STRING], buf[LONG_STRING], *cp = NULL, *wptr = dest, ch; char ifstring[SHORT_STRING], elsestring[SHORT_STRING]; @@ -1408,7 +1409,7 @@ void mutt_FormatString(char *dest, size_t destlen, size_t col, int cols, const c mutt_extract_token(word, srcbuf, 0); mutt_debug(3, "fmtpipe %2d: %s\n", i++, word->data); mutt_buffer_addch(command, '\''); - mutt_FormatString(buf, sizeof(buf), 0, cols, word->data, callback, data, + mutt_expando_format(buf, sizeof(buf), 0, cols, word->data, callback, data, flags | MUTT_FORMAT_NOFILTER); for (p = buf; p && *p; p++) { @@ -1448,7 +1449,7 @@ void mutt_FormatString(char *dest, size_t destlen, size_t col, int cols, const c /* If the result ends with '%', this indicates that the filter * generated %-tokens that mutt can expand. Eliminate the '%' - * marker and recycle the string through mutt_FormatString(). + * marker and recycle the string through mutt_expando_format(). * To literally end with "%", use "%%". */ if ((n > 0) && dest[n - 1] == '%') { @@ -1464,7 +1465,7 @@ void mutt_FormatString(char *dest, size_t destlen, size_t col, int cols, const c * it back for the recursive call since the expansion of * format pipes does not try to append a nul itself. */ - mutt_FormatString(dest, destlen + 1, col, cols, recycler, + mutt_expando_format(dest, destlen + 1, col, cols, recycler, callback, data, flags); FREE(&recycler); } @@ -1667,7 +1668,7 @@ void mutt_FormatString(char *dest, size_t destlen, size_t col, int cols, const c int pad; /* get contents after padding */ - mutt_FormatString(buf, sizeof(buf), 0, cols, src + pl, callback, data, flags); + mutt_expando_format(buf, sizeof(buf), 0, cols, src + pl, callback, data, flags); len = mutt_strlen(buf); wid = mutt_strwidth(buf); diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index a8ea029e5..80ed32caa 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -3067,9 +3067,9 @@ static const char *crypt_entry_fmt(char *dest, size_t destlen, size_t col, int c } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return src; } @@ -3084,7 +3084,7 @@ static void crypt_entry(char *s, size_t l, struct Menu *menu, int num) entry.key = key_table[num]; entry.num = num + 1; - mutt_FormatString(s, l, 0, MuttIndexWindow->cols, NONULL(PgpEntryFormat), + mutt_expando_format(s, l, 0, MuttIndexWindow->cols, NONULL(PgpEntryFormat), crypt_entry_fmt, (unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR); } diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 6968f186c..0bc06cb62 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -137,9 +137,9 @@ static const char *_mutt_fmt_pgp_command(char *dest, size_t destlen, size_t col, } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, _mutt_fmt_pgp_command, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, _mutt_fmt_pgp_command, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, _mutt_fmt_pgp_command, data, 0); + mutt_expando_format(dest, destlen, col, cols, elsestring, _mutt_fmt_pgp_command, data, 0); return src; } @@ -147,7 +147,7 @@ static const char *_mutt_fmt_pgp_command(char *dest, size_t destlen, size_t col, static void mutt_pgp_command(char *d, size_t dlen, struct PgpCommandContext *cctx, const char *fmt) { - mutt_FormatString(d, dlen, 0, MuttIndexWindow->cols, NONULL(fmt), + mutt_expando_format(d, dlen, 0, MuttIndexWindow->cols, NONULL(fmt), _mutt_fmt_pgp_command, (unsigned long) cctx, 0); mutt_debug(2, "mutt_pgp_command: %s\n", d); } diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 73a498f80..490069d59 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -291,9 +291,9 @@ static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int col } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return src; } @@ -305,7 +305,7 @@ static void pgp_entry(char *s, size_t l, struct Menu *menu, int num) entry.uid = KeyTable[num]; entry.num = num + 1; - mutt_FormatString(s, l, 0, MuttIndexWindow->cols, NONULL(PgpEntryFormat), + mutt_expando_format(s, l, 0, MuttIndexWindow->cols, NONULL(PgpEntryFormat), pgp_entry_fmt, (unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR); } diff --git a/ncrypt/smime.c b/ncrypt/smime.c index c302d3756..c81dbb073 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -284,9 +284,9 @@ static const char *_mutt_fmt_smime_command(char *dest, size_t destlen, size_t co } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, _mutt_fmt_smime_command, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, _mutt_fmt_smime_command, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, + mutt_expando_format(dest, destlen, col, cols, elsestring, _mutt_fmt_smime_command, data, 0); return src; @@ -295,7 +295,7 @@ static const char *_mutt_fmt_smime_command(char *dest, size_t destlen, size_t co static void smime_command(char *d, size_t dlen, struct SmimeCommandContext *cctx, const char *fmt) { - mutt_FormatString(d, dlen, 0, MuttIndexWindow->cols, NONULL(fmt), + mutt_expando_format(d, dlen, 0, MuttIndexWindow->cols, NONULL(fmt), _mutt_fmt_smime_command, (unsigned long) cctx, 0); mutt_debug(2, "smime_command: %s\n", d); } diff --git a/newsrc.c b/newsrc.c index 02efba35c..5900df231 100644 --- a/newsrc.c +++ b/newsrc.c @@ -1030,7 +1030,7 @@ struct NntpServer *nntp_select_server(char *server, int leave_lock) /* load .newsrc */ if (rc >= 0) { - mutt_FormatString(file, sizeof(file), 0, MuttIndexWindow->cols, + mutt_expando_format(file, sizeof(file), 0, MuttIndexWindow->cols, NONULL(NewsRc), nntp_format_str, (unsigned long) nserv, 0); mutt_expand_path(file, sizeof(file)); nserv->newsrc_file = safe_strdup(file); diff --git a/protos.h b/protos.h index 66d4540bb..a59d1a531 100644 --- a/protos.h +++ b/protos.h @@ -199,7 +199,7 @@ void mutt_expand_file_fmt(char *dest, size_t destlen, const char *fmt, const cha void mutt_expand_fmt(char *dest, size_t destlen, const char *fmt, const char *src); void mutt_fix_reply_recipients(struct Envelope *env); void mutt_folder_hook(char *path); -void mutt_format_string(char *dest, size_t destlen, int min_width, int max_width, int justify, +void mutt_simple_format(char *dest, size_t destlen, int min_width, int max_width, int justify, char m_pad_char, const char *s, size_t n, int arboreal); void mutt_format_s(char *dest, size_t destlen, const char *prefix, const char *s); void mutt_format_s_tree(char *dest, size_t destlen, const char *prefix, const char *s); diff --git a/query.c b/query.c index b12904196..e3311e664 100644 --- a/query.c +++ b/query.c @@ -246,9 +246,9 @@ static const char *query_format_str(char *dest, size_t destlen, size_t col, int } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, query_format_str, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, query_format_str, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, query_format_str, data, 0); + mutt_expando_format(dest, destlen, col, cols, elsestring, query_format_str, data, 0); return src; } @@ -258,7 +258,7 @@ static void query_entry(char *s, size_t slen, struct Menu *m, int num) struct Entry *entry = &((struct Entry *) m->data)[num]; entry->data->num = num; - mutt_FormatString(s, slen, 0, MuttIndexWindow->cols, NONULL(QueryFormat), + mutt_expando_format(s, slen, 0, MuttIndexWindow->cols, NONULL(QueryFormat), query_format_str, (unsigned long) entry, MUTT_FORMAT_ARROWCURSOR); } diff --git a/recvattach.c b/recvattach.c index 978b2882e..37be1867f 100644 --- a/recvattach.c +++ b/recvattach.c @@ -382,15 +382,15 @@ const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols, } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return src; } static void attach_entry(char *b, size_t blen, struct Menu *menu, int num) { - mutt_FormatString(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), mutt_attach_fmt, + mutt_expando_format(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), mutt_attach_fmt, (unsigned long) (((struct AttachPtr **) menu->data)[num]), MUTT_FORMAT_ARROWCURSOR); } diff --git a/recvcmd.c b/recvcmd.c index 8b690772e..74faabcf2 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -202,7 +202,7 @@ void mutt_attach_bounce(FILE *fp, struct Header *hdr, struct AttachPtr **idx, if (mutt_strwidth(prompt) > MuttMessageWindow->cols - extra_space) { - mutt_format_string(prompt, sizeof(prompt) - 4, 0, MuttMessageWindow->cols - extra_space, + mutt_simple_format(prompt, sizeof(prompt) - 4, 0, MuttMessageWindow->cols - extra_space, FMT_LEFT, 0, prompt, sizeof(prompt), 0); safe_strcat(prompt, sizeof(prompt), "...?"); } diff --git a/remailer.c b/remailer.c index d81136bd3..469e4ea6d 100644 --- a/remailer.c +++ b/remailer.c @@ -407,9 +407,9 @@ static const char *mix_entry_fmt(char *dest, size_t destlen, size_t col, int col } if (optional) - mutt_FormatString(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); + mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return src; } @@ -417,7 +417,7 @@ static const char *mix_entry_fmt(char *dest, size_t destlen, size_t col, int col static void mix_entry(char *b, size_t blen, struct Menu *menu, int num) { struct Remailer **type2_list = (struct Remailer **) menu->data; - mutt_FormatString(b, blen, 0, MuttIndexWindow->cols, NONULL(MixEntryFormat), mix_entry_fmt, + mutt_expando_format(b, blen, 0, MuttIndexWindow->cols, NONULL(MixEntryFormat), mix_entry_fmt, (unsigned long) type2_list[num], MUTT_FORMAT_ARROWCURSOR); } diff --git a/sendlib.c b/sendlib.c index 28235ee2c..461e83916 100644 --- a/sendlib.c +++ b/sendlib.c @@ -2471,7 +2471,7 @@ int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Addres { char cmd[LONG_STRING]; - mutt_FormatString(cmd, sizeof(cmd), 0, MuttIndexWindow->cols, NONULL(Inews), + mutt_expando_format(cmd, sizeof(cmd), 0, MuttIndexWindow->cols, NONULL(Inews), nntp_format_str, 0, 0); if (!*cmd) { diff --git a/sidebar.c b/sidebar.c index 67b3c79c5..791522854 100644 --- a/sidebar.c +++ b/sidebar.c @@ -102,7 +102,7 @@ enum SidebarSrc * @param flags Format flags, e.g. MUTT_FORMAT_OPTIONAL * @return src (unchanged) * - * cb_format_str is a callback function for mutt_FormatString. It understands + * cb_format_str is a callback function for mutt_expando_format. It understands * six operators. '%B' : Mailbox name, '%F' : Number of flagged messages, * '%N' : Number of new messages, '%S' : Size (total number of messages), * '%!' : Icon denoting number of flagged messages. @@ -222,10 +222,10 @@ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int col } if (optional) - mutt_FormatString(dest, destlen, col, SidebarWidth, ifstring, cb_format_str, + mutt_expando_format(dest, destlen, col, SidebarWidth, ifstring, cb_format_str, (unsigned long) sbe, flags); else if (flags & MUTT_FORMAT_OPTIONAL) - mutt_FormatString(dest, destlen, col, SidebarWidth, elsestring, + mutt_expando_format(dest, destlen, col, SidebarWidth, elsestring, cb_format_str, (unsigned long) sbe, flags); /* We return the format string, unchanged */ @@ -241,7 +241,7 @@ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int col * @param sbe Mailbox object * * Take all the relevant mailbox data and the desired screen width and then get - * mutt_FormatString to do the actual work. mutt_FormatString will callback to + * mutt_expando_format to do the actual work. mutt_expando_format will callback to * us using cb_format_str() for the sidebar specific formatting characters. */ static void make_sidebar_entry(char *buf, unsigned int buflen, int width, @@ -252,7 +252,7 @@ static void make_sidebar_entry(char *buf, unsigned int buflen, int width, strfcpy(sbe->box, box, sizeof(sbe->box)); - mutt_FormatString(buf, buflen, 0, width, NONULL(SidebarFormat), cb_format_str, + mutt_expando_format(buf, buflen, 0, width, NONULL(SidebarFormat), cb_format_str, (unsigned long) sbe, 0); /* Force string to be exactly the right width */ diff --git a/status.c b/status.c index 5d229c4cd..b69efb353 100644 --- a/status.c +++ b/status.c @@ -328,12 +328,12 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c static void _menu_status_line(char *buf, size_t buflen, size_t col, int cols, struct Menu *menu, const char *p) { - mutt_FormatString(buf, buflen, col, cols, p, status_format_str, (unsigned long) menu, 0); + mutt_expando_format(buf, buflen, col, cols, p, status_format_str, (unsigned long) menu, 0); } void menu_status_line(char *buf, size_t buflen, struct Menu *menu, const char *p) { - mutt_FormatString(buf, buflen, 0, + mutt_expando_format(buf, buflen, 0, menu ? menu->statuswin->cols : MuttStatusWindow->cols, p, status_format_str, (unsigned long) menu, 0); } -- 2.40.0