#endif
#include "mutt.h"
+#include "enter.h"
#include "mutt_menu.h"
#include "mutt_curses.h"
#include "pager.h"
* ensure there is enough room for the answer and truncate the question
* to fit.
*/
- answer_string = safe_malloc (COLS + 1);
+ answer_string = mem_malloc (COLS + 1);
snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
def == M_YES ? no : yes);
answer_string_len = str_len (answer_string);
printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
- FREE (&answer_string);
+ mem_free (&answer_string);
FOREVER {
mutt_refresh ();
if (Timeout)
timeout (-1); /* restore blocking operation */
if (mutt_yesorno (_("Exit Mutt-ng?"), M_YES) == M_YES) {
- endwin ();
+ mutt_endwin (NULL);
exit (1);
}
mutt_clear_error ();
set_option (OPTMSGERR);
}
+#ifdef USE_SOCKET
+void mutt_progress_bar (progress_t* progress, long pos) {
+ char posstr[SHORT_STRING];
+
+ if (!pos) {
+ if (!NetInc)
+ mutt_message (progress->msg);
+ else {
+ mutt_pretty_size (progress->sizestr, sizeof (progress->sizestr),
+ progress->size);
+ progress->pos = 0;
+ }
+ }
+
+ if (!NetInc)
+ return;
+
+ if (pos >= progress->pos + (NetInc << 10)) {
+ progress->pos = pos;
+ pos = pos / (NetInc << 10) * (NetInc << 10);
+ mutt_pretty_size (posstr, sizeof (posstr), pos);
+ mutt_message ("%s %s/%s", progress->msg, posstr, progress->sizestr);
+ }
+}
+#endif
+
void mutt_curses_message (const char *fmt, ...)
{
char TmpErrorbuf[STRING];
*redraw = REDRAW_FULL;
}
else {
- char *pc = safe_malloc (str_len (prompt) + 3);
+ char *pc = mem_malloc (str_len (prompt) + 3);
sprintf (pc, "%s: ", prompt); /* __SPRINTF_CHECKED__ */
mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
!= 0)
buf[0] = 0;
MAYBE_REDRAW (*redraw);
- FREE (&pc);
+ mem_free (&pc);
}
return 0;
tmp.op = op;
if (UngetCount >= UngetBufLen)
- safe_realloc (&KeyEvent, (UngetBufLen += 128) * sizeof (event_t));
+ mem_realloc (&KeyEvent, (UngetBufLen += 128) * sizeof (event_t));
KeyEvent[UngetCount++] = tmp;
}