X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=help.c;h=407b7a492cd4ac82c8a46bb73baff3b901eef6ce;hp=0199398530a0f6955b9eba94576db1a9b4268e0e;hb=f3cbb9f51357972f6e74244494236a41dc4d84cd;hpb=ac813896ca32d850febc2d95065ac4fa040f11f9 diff --git a/help.c b/help.c index 0199398..407b7a4 100644 --- a/help.c +++ b/help.c @@ -9,23 +9,12 @@ #define HELP_C -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include +#include #include #include "mutt.h" +#include "charset.h" #include "keymap.h" #include "pager.h" @@ -97,10 +86,10 @@ static int print_macro (FILE * f, int maxwidth, const char **macro) *macro += k, len -= k) { if (k == -1 || k == -2) { k = (k == -1) ? 1 : len; - wc = replacement_char (); + wc = CharsetReplacement; } /* glibc-2.1.3's wcwidth() returns 1 for unprintable chars! */ - if (IsWPrint (wc) && (w = wcwidth (wc)) >= 0) { + if (iswprint(wc) && (w = wcwidth (wc)) >= 0) { if (w > n) break; n -= w; @@ -283,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 = _(""); + char tmp[_POSIX_PATH_MAX]; + char buf[SHORT_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(Tempdir), NULL); + if (!f) { + mutt_perror(tmp); + return; + } - do { - if ((f = safe_fopen (t, "w")) == NULL) { - mutt_perror (t); - 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); - 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]); + if (menu != MENU_PAGER) + dump_unbound (f, OpGeneric, Keymaps[MENU_GENERIC], Keymaps[menu]); - fclose (f); + m_fclose(&f); - 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); + 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); }