X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=help.c;h=062f975cc62528e339c0a2e1948ddc724dc7b0fb;hp=4bd1b01127343018d51e62be854dab6b64baaeb7;hb=80566f6aedda1e4bdcca38f9cb27101b5ba1029f;hpb=230399f9632c37b66c1c117a17e8327eae6b3235 diff --git a/help.c b/help.c index 4bd1b01..062f975 100644 --- a/help.c +++ b/help.c @@ -9,15 +9,6 @@ #define HELP_C -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include - #include #include @@ -50,7 +41,7 @@ static struct binding_t *help_lookupFunction (int op, int menu) void mutt_make_help (char *d, ssize_t dlen, char *txt, int menu, int op) { - char buf[SHORT_STRING]; + char buf[STRING]; if (km_expand_key (buf, sizeof (buf), km_find_func (menu, op)) || km_expand_key (buf, sizeof (buf), km_find_func (MENU_GENERIC, op))) @@ -235,7 +226,7 @@ static void dump_menu (FILE * f, int menu) { struct keymap_t *map; struct binding_t *b; - char buf[SHORT_STRING]; + char buf[STRING]; /* browse through the keymap table */ for (map = Keymaps[menu]; map; map = map->next) { @@ -281,43 +272,41 @@ static void dump_unbound (FILE * f, void mutt_help (int menu) { - char t[_POSIX_PATH_MAX]; - char buf[SHORT_STRING]; - const char *desc; - FILE *f; - struct binding_t *funcs; - - mutt_mktemp (t); - - funcs = km_get_table (menu); - desc = mutt_getnamebyvalue (menu, Menus); - if (!desc) - desc = _(""); - - do { - if ((f = safe_fopen (t, "w")) == NULL) { - mutt_perror (t); - return; - } + char tmp[_POSIX_PATH_MAX]; + char buf[STRING]; + const char *desc; + FILE *f; + struct binding_t *funcs; + + funcs = km_get_table (menu); + desc = mutt_getnamebyvalue (menu, Menus); + if (!desc) + desc = _(""); + + do { + f = m_tempfile(tmp, sizeof(tmp), NONULL(MCore.tmpdir), NULL); + if (!f) { + mutt_perror(tmp); + return; + } - dump_menu (f, menu); - if (menu != MENU_EDITOR && menu != MENU_PAGER) { - fputs (_("\nGeneric bindings:\n\n"), f); - dump_menu (f, MENU_GENERIC); - } + dump_menu(f, menu); + if (menu != MENU_EDITOR && menu != MENU_PAGER) { + fputs(_("\nGeneric bindings:\n\n"), f); + dump_menu(f, MENU_GENERIC); + } - fputs (_("\nUnbound functions:\n\n"), f); - if (funcs) - dump_unbound (f, funcs, Keymaps[menu], NULL); - if (menu != MENU_PAGER) - dump_unbound (f, OpGeneric, Keymaps[MENU_GENERIC], Keymaps[menu]); + fputs(_("\nUnbound functions:\n\n"), f); + if (funcs) + dump_unbound(f, funcs, Keymaps[menu], NULL); - fclose (f); + if (menu != MENU_PAGER) + dump_unbound (f, OpGeneric, Keymaps[MENU_GENERIC], Keymaps[menu]); - snprintf (buf, sizeof (buf), _("Help for %s"), desc); - } - while - (mutt_do_pager (buf, t, - M_PAGER_RETWINCH | M_PAGER_MARKER | M_PAGER_NSKIP, NULL) - == OP_REFORMAT_WINCH); + m_fclose(&f); + + snprintf(buf, sizeof (buf), _("Help for %s"), desc); + } while (mutt_do_pager(buf, tmp, + M_PAGER_RETWINCH | M_PAGER_MARKER | M_PAGER_NSKIP, + NULL) == OP_REFORMAT_WINCH); }