Encapsulate a curses function to reduce dependencies.
(e->security & APPLICATION_PGP) && (e->security & SEC_SIGN))
{
mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
- printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
+ mutt_window_printf("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
mutt_curses_set_color(MT_COLOR_NORMAL);
- printw("%s", C_PgpSignAs ? C_PgpSignAs : _("<default>"));
+ mutt_window_printf("%s", C_PgpSignAs ? C_PgpSignAs : _("<default>"));
}
if (((WithCrypto & APPLICATION_SMIME) != 0) &&
(e->security & APPLICATION_SMIME) && (e->security & SEC_SIGN))
{
mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
- printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
+ mutt_window_printf("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
mutt_curses_set_color(MT_COLOR_NORMAL);
- printw("%s", C_SmimeSignAs ? C_SmimeSignAs : _("<default>"));
+ mutt_window_printf("%s", C_SmimeSignAs ? C_SmimeSignAs : _("<default>"));
}
if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME) &&
mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(rd->win, HDR_CRYPTINFO, 40, "%s", _("Encrypt with: "));
mutt_curses_set_color(MT_COLOR_NORMAL);
- printw("%s", NONULL(C_SmimeEncryptWith));
+ mutt_window_printf("%s", NONULL(C_SmimeEncryptWith));
}
#ifdef USE_AUTOCRYPT
if (C_Autocrypt)
{
mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
- printw("%*s", HeaderPadding[HDR_AUTOCRYPT], _(Prompts[HDR_AUTOCRYPT]));
+ mutt_window_printf("%*s", HeaderPadding[HDR_AUTOCRYPT], _(Prompts[HDR_AUTOCRYPT]));
mutt_curses_set_color(MT_COLOR_NORMAL);
if (e->security & SEC_AUTOCRYPT)
{
*/
_("Recommendation: "));
mutt_curses_set_color(MT_COLOR_NORMAL);
- printw("%s", _(AutocryptRecUiFlags[rd->autocrypt_rec]));
+ mutt_window_printf("%s", _(AutocryptRecUiFlags[rd->autocrypt_rec]));
}
#endif
}
fputs(buf[i], fp);
if (fclose(fp) == 0)
return 0;
- printw("fclose: %s\n", strerror(errno));
+ mutt_window_printf("fclose: %s\n", strerror(errno));
return -1;
}
buf[(*buflen)++] = mutt_str_strdup("\n");
}
else
- printw(_("%d: invalid message number.\n"), n);
+ mutt_window_printf(_("%d: invalid message number.\n"), n);
msg = NULL;
}
return buf;
mutt_env_to_local(e_new->env);
mutt_edit_headers(NONULL(C_Visual), path, e_new, NULL, 0);
if (mutt_env_to_intl(e_new->env, &tag, &err))
- printw(_("Bad IDN in '%s': '%s'"), tag, err);
+ mutt_window_printf(_("Bad IDN in '%s': '%s'"), tag, err);
/* tag is a statically allocated string and should not be freed */
FREE(&err);
}
done = true;
break;
default:
- printw(_("%s: unknown editor command (~? for help)\n"), tmp);
+ mutt_window_printf(_("%s: unknown editor command (~? for help)\n"), tmp);
break;
}
}
if (IsWPrint(wc) && (n > 0))
return mutt_addwch(wc);
if (!(wc & ~0x7f))
- return printw("^%c", ((int) wc + 0x40) & 0x7f);
+ return mutt_window_printf("^%c", ((int) wc + 0x40) & 0x7f);
if (!(wc & ~0xffff))
- return printw("\\u%04x", (int) wc);
- return printw("\\u%08x", (int) wc);
+ return mutt_window_printf("\\u%04x", (int) wc);
+ return mutt_window_printf("\\u%08x", (int) wc);
}
/**
{
move(row, col);
}
+
+/**
+ * mutt_window_printf - Write a formatted string to a Window
+ * @param fmt Format string
+ * @param ... Arguments
+ * @retval num Number of characters written
+ */
+int mutt_window_printf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ int rc = vw_printw(stdscr, fmt, ap);
+ va_end(ap);
+
+ return rc;
+}
void mutt_window_move_abs (int row, int col);
int mutt_window_mvaddstr (struct MuttWindow *win, int row, int col, const char *str);
int mutt_window_mvprintw (struct MuttWindow *win, int row, int col, const char *fmt, ...);
+int mutt_window_printf (const char *format, ...);
#endif /* MUTT_MUTT_WINDOW_H */
break;
col += 4;
if (pa)
- printw("\\%03o", buf[ch]);
+ mutt_window_printf("\\%03o", buf[ch]);
k = 1;
continue;
}
break;
col += 2;
if (pa)
- printw("^%c", ('@' + wc) & 0x7f);
+ mutt_window_printf("^%c", ('@' + wc) & 0x7f);
}
else if (wc < 0x100)
{
break;
col += 4;
if (pa)
- printw("\\%03o", wc);
+ mutt_window_printf("\\%03o", wc);
}
else
{
}
char str[256];
make_sidebar_entry(str, sizeof(str), w, sidebar_folder_name, entry);
- printw("%s", str);
+ mutt_window_printf("%s", str);
mutt_buffer_pool_release(&short_folder_name);
row++;
}