#define HELP_C
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <wctype.h>
-#include <wchar.h>
-#include <ctype.h>
-#include <string.h>
-
-#include <lib-lib/macros.h>
-#include <lib-lib/file.h>
-#include <lib-lib/str.h>
-#include <lib-lib/mapping.h>
+#include <lib-lib/lib-lib.h>
#include <lib-ui/curses.h>
#include "mutt.h"
+#include "charset.h"
#include "keymap.h"
#include "pager.h"
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)))
*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;
{
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) {
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 = _("<UNKNOWN>");
-
- 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 = _("<UNKNOWN>");
+
+ 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);
}