summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Jonglez <baptiste--git@jonglez.org>2012-05-31 18:11:53 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-31 20:27:43 +0200
commit4c4d4d3eb3fd2bdeefb034a524f02b803f4583ab (patch)
tree94b27921dcd22e6b28fb7ba1a25c2a76019bf13d
parentbc7c0be84c31633f1b4903b8ae623f5c1cb9395e (diff)
downloadcalcurse-4c4d4d3eb3fd2bdeefb034a524f02b803f4583ab.zip
Use mvwaddstr() instead of mvwprintw()
When we only want to display a string at a specific place of the screen, there's no need to use the more complex mvwprintw(), use mvwaddstr() instead. This should be slightly more efficient, and, above all, it prevents weird things to happen if our string contains a '%', being interpreted as an unwanted format string. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/calendar.c10
-rw-r--r--src/custom.c86
-rw-r--r--src/help.c4
-rw-r--r--src/io.c20
-rw-r--r--src/keys.c4
-rw-r--r--src/notify.c4
-rw-r--r--src/utils.c27
7 files changed, 75 insertions, 80 deletions
diff --git a/src/calendar.c b/src/calendar.c
index be39f38..772c177 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -313,8 +313,7 @@ draw_monthly_view(struct window *cwin, struct date *current_day,
/* print the days, with regards to the first day of the week */
custom_apply_attr(cwin->p, ATTR_HIGHEST);
for (j = 0; j < WEEKINDAYS; j++) {
- mvwprintw(cwin->p, ofs_y, ofs_x + 4 * j, "%s",
- _(daynames[1 + j - sunday_first]));
+ mvwaddstr(cwin->p, ofs_y, ofs_x + 4 * j, _(daynames[1 + j - sunday_first]));
}
custom_remove_attr(cwin->p, ATTR_HIGHEST);
@@ -473,8 +472,7 @@ draw_weekly_view(struct window *cwin, struct date *current_day,
/* print the day names, with regards to the first day of the week */
custom_apply_attr(cwin->p, ATTR_HIGHEST);
- mvwprintw(cwin->p, OFFY, OFFX + 4 * j, "%s",
- _(daynames[1 + j - sunday_first]));
+ mvwaddstr(cwin->p, OFFY, OFFX + 4 * j, _(daynames[1 + j - sunday_first]));
custom_remove_attr(cwin->p, ATTR_HIGHEST);
/* Check if the day to be printed has an item or not. */
@@ -515,8 +513,8 @@ draw_weekly_view(struct window *cwin, struct date *current_day,
if (highlight)
custom_apply_attr(cwin->p, attr);
wattron(cwin->p, A_REVERSE);
- mvwprintw(cwin->p, OFFY + 2 + i, OFFX + 1 + 4 * j, " ");
- mvwprintw(cwin->p, OFFY + 2 + i, OFFX + 2 + 4 * j, " ");
+ mvwaddstr(cwin->p, OFFY + 2 + i, OFFX + 1 + 4 * j, " ");
+ mvwaddstr(cwin->p, OFFY + 2 + i, OFFX + 2 + 4 * j, " ");
wattroff(cwin->p, A_REVERSE);
if (highlight)
custom_remove_attr(cwin->p, attr);
diff --git a/src/custom.c b/src/custom.c
index e6f7d3d..fd93a11 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -100,22 +100,22 @@ void custom_config_bar(void)
const int SPC = 15;
custom_apply_attr(win[STA].p, ATTR_HIGHEST);
- mvwprintw(win[STA].p, 0, 2, "Q");
- mvwprintw(win[STA].p, 1, 2, "G");
- mvwprintw(win[STA].p, 0, 2 + SPC, "L");
- mvwprintw(win[STA].p, 1, 2 + SPC, "S");
- mvwprintw(win[STA].p, 0, 2 + 2 * SPC, "C");
- mvwprintw(win[STA].p, 1, 2 + 2 * SPC, "N");
- mvwprintw(win[STA].p, 0, 2 + 3 * SPC, "K");
+ mvwaddstr(win[STA].p, 0, 2, "Q");
+ mvwaddstr(win[STA].p, 1, 2, "G");
+ mvwaddstr(win[STA].p, 0, 2 + SPC, "L");
+ mvwaddstr(win[STA].p, 1, 2 + SPC, "S");
+ mvwaddstr(win[STA].p, 0, 2 + 2 * SPC, "C");
+ mvwaddstr(win[STA].p, 1, 2 + 2 * SPC, "N");
+ mvwaddstr(win[STA].p, 0, 2 + 3 * SPC, "K");
custom_remove_attr(win[STA].p, ATTR_HIGHEST);
- mvwprintw(win[STA].p, 0, 2 + SMLSPC, _("Exit"));
- mvwprintw(win[STA].p, 1, 2 + SMLSPC, _("General"));
- mvwprintw(win[STA].p, 0, 2 + SPC + SMLSPC, _("Layout"));
- mvwprintw(win[STA].p, 1, 2 + SPC + SMLSPC, _("Sidebar"));
- mvwprintw(win[STA].p, 0, 2 + 2 * SPC + SMLSPC, _("Color"));
- mvwprintw(win[STA].p, 1, 2 + 2 * SPC + SMLSPC, _("Notify"));
- mvwprintw(win[STA].p, 0, 2 + 3 * SPC + SMLSPC, _("Keys"));
+ mvwaddstr(win[STA].p, 0, 2 + SMLSPC, _("Exit"));
+ mvwaddstr(win[STA].p, 1, 2 + SMLSPC, _("General"));
+ mvwaddstr(win[STA].p, 0, 2 + SPC + SMLSPC, _("Layout"));
+ mvwaddstr(win[STA].p, 1, 2 + SPC + SMLSPC, _("Sidebar"));
+ mvwaddstr(win[STA].p, 0, 2 + 2 * SPC + SMLSPC, _("Color"));
+ mvwaddstr(win[STA].p, 1, 2 + 2 * SPC + SMLSPC, _("Notify"));
+ mvwaddstr(win[STA].p, 0, 2 + 3 * SPC + SMLSPC, _("Keys"));
wnoutrefresh(win[STA].p);
wmove(win[STA].p, 0, 0);
@@ -184,11 +184,11 @@ static void display_layout_config(struct window *lwin, int mark, int cursor)
for (i = 0; i < NBLAYOUTS; i++) {
int j;
- mvwprintw(lwin->p, pos[i][YPOS] + 2, pos[i][XPOS], box);
+ mvwaddstr(lwin->p, pos[i][YPOS] + 2, pos[i][XPOS], box);
if (i == mark)
custom_apply_attr(lwin->p, ATTR_HIGHEST);
for (j = 0; j < LAYOUTH; j++) {
- mvwprintw(lwin->p, pos[i][YPOS] + j, pos[i][XPOS] + BOXSIZ + 1,
+ mvwaddstr(lwin->p, pos[i][YPOS] + j, pos[i][XPOS] + BOXSIZ + 1,
layouts[j][i]);
}
if (i == mark)
@@ -231,7 +231,7 @@ void custom_layout_config(void)
switch (ch) {
case KEY_GENERIC_HELP:
help_wins_init(&hwin, 0, 0, (notify_bar())? row - 3 : row - 2, col);
- mvwprintw(hwin.pad.p, 1, 0, "%s", help_text);
+ mvwaddstr(hwin.pad.p, 1, 0, help_text);
hwin.total_lines = 7;
wins_scrollwin_display(&hwin);
wgetch(hwin.win.p);
@@ -319,7 +319,7 @@ void custom_sidebar_config(void)
break;
case KEY_GENERIC_HELP:
help_wins_init(&hwin, 0, 0, (notify_bar())? row - 3 : row - 2, col);
- mvwprintw(hwin.pad.p, 1, 0, "%s", help_text);
+ mvwaddstr(hwin.pad.p, 1, 0, help_text);
hwin.total_lines = 6;
wins_scrollwin_display(&hwin);
wgetch(hwin.win.p);
@@ -473,26 +473,26 @@ display_color_config(struct window *cwin, int *mark_fore, int *mark_back,
/* color boxes */
for (i = 0; i < SIZE - 1; i++) {
- mvwprintw(cwin->p, pos[i][YPOS], pos[i][XPOS], box);
+ mvwaddstr(cwin->p, pos[i][YPOS], pos[i][XPOS], box);
wattron(cwin->p, COLOR_PAIR(colr[i]) | A_REVERSE);
- mvwprintw(cwin->p, pos[i][YPOS], pos[i][XPOS] + XOFST, bar);
+ mvwaddstr(cwin->p, pos[i][YPOS], pos[i][XPOS] + XOFST, bar);
wattroff(cwin->p, COLOR_PAIR(colr[i]) | A_REVERSE);
}
/* Terminal's default color */
i = SIZE - 1;
- mvwprintw(cwin->p, pos[i][YPOS], pos[i][XPOS], box);
+ mvwaddstr(cwin->p, pos[i][YPOS], pos[i][XPOS], box);
wattron(cwin->p, COLOR_PAIR(colr[i]));
- mvwprintw(cwin->p, pos[i][YPOS], pos[i][XPOS] + XOFST, bar);
+ mvwaddstr(cwin->p, pos[i][YPOS], pos[i][XPOS] + XOFST, bar);
wattroff(cwin->p, COLOR_PAIR(colr[i]));
- mvwprintw(cwin->p, pos[NBUSERCOLORS][YPOS] + 1,
+ mvwaddstr(cwin->p, pos[NBUSERCOLORS][YPOS] + 1,
pos[NBUSERCOLORS][XPOS] + XOFST, default_txt);
- mvwprintw(cwin->p, pos[SIZE - 1][YPOS] + 1,
+ mvwaddstr(cwin->p, pos[SIZE - 1][YPOS] + 1,
pos[SIZE - 1][XPOS] + XOFST, default_txt);
custom_apply_attr(cwin->p, ATTR_HIGHEST);
- mvwprintw(cwin->p, Y, XFORE + XOFST, fore_txt);
- mvwprintw(cwin->p, Y, XBACK + XOFST, back_txt);
+ mvwaddstr(cwin->p, Y, XFORE + XOFST, fore_txt);
+ mvwaddstr(cwin->p, Y, XBACK + XOFST, back_txt);
custom_remove_attr(cwin->p, ATTR_HIGHEST);
if (colorize) {
@@ -621,64 +621,64 @@ static int print_general_options(WINDOW * win)
mvwprintw(win, y, XPOS, "[1] %s ", opt[AUTO_SAVE]);
print_bool_option_incolor(win, conf.auto_save, y,
XPOS + 4 + strlen(opt[AUTO_SAVE]));
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(if set to YES, automatic save is done when quitting)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[2] %s ", opt[AUTO_GC]);
print_bool_option_incolor(win, conf.auto_gc, y,
XPOS + 4 + strlen(opt[AUTO_GC]));
- mvwprintw(win, y + 1, XPOS, _("(run the garbage collector when quitting)"));
+ mvwaddstr(win, y + 1, XPOS, _("(run the garbage collector when quitting)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[3] %s ", opt[PERIODIC_SAVE]);
custom_apply_attr(win, ATTR_HIGHEST);
mvwprintw(win, y, XPOS + 4 + strlen(opt[PERIODIC_SAVE]), "%d",
conf.periodic_save);
custom_remove_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(if not null, automatically save data every 'periodic_save' "
"minutes)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[4] %s ", opt[CONFIRM_QUIT]);
print_bool_option_incolor(win, conf.confirm_quit, y,
XPOS + 4 + strlen(opt[CONFIRM_QUIT]));
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(if set to YES, confirmation is required before quitting)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[5] %s ", opt[CONFIRM_DELETE]);
print_bool_option_incolor(win, conf.confirm_delete, y,
XPOS + 4 + strlen(opt[CONFIRM_DELETE]));
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(if set to YES, confirmation is required "
"before deleting an event)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[6] %s ", opt[SYSTEM_DIAGS]);
print_bool_option_incolor(win, conf.system_dialogs, y,
XPOS + 4 + strlen(opt[SYSTEM_DIAGS]));
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(if set to YES, messages about loaded "
"and saved data will be displayed)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[7] %s ", opt[PROGRESS_BAR]);
print_bool_option_incolor(win, conf.progress_bar, y,
XPOS + 4 + strlen(opt[PROGRESS_BAR]));
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(if set to YES, progress bar will be displayed "
"when saving data)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[8] %s ", opt[FIRST_DAY_OF_WEEK]);
custom_apply_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y, XPOS + 4 + strlen(opt[FIRST_DAY_OF_WEEK]), "%s",
+ mvwaddstr(win, y, XPOS + 4 + strlen(opt[FIRST_DAY_OF_WEEK]),
calendar_week_begins_on_monday()? _("Monday") : _("Sunday"));
custom_remove_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(specifies the first day of week in the calendar view)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[9] %s ", opt[OUTPUT_DATE_FMT]);
custom_apply_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y, XPOS + 4 + strlen(opt[OUTPUT_DATE_FMT]), "%s",
+ mvwaddstr(win, y, XPOS + 4 + strlen(opt[OUTPUT_DATE_FMT]),
conf.output_datefmt);
custom_remove_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y + 1, XPOS,
+ mvwaddstr(win, y + 1, XPOS,
_("(Format of the date to be displayed in non-interactive mode)"));
y += YOFF;
mvwprintw(win, y, XPOS, "[0] %s ", opt[INPUT_DATE_FMT]);
@@ -686,8 +686,8 @@ static int print_general_options(WINDOW * win)
mvwprintw(win, y, XPOS + 4 + strlen(opt[INPUT_DATE_FMT]), "%d",
conf.input_datefmt);
custom_remove_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y + 1, XPOS, _("(Format to be used when entering a date: "));
- mvwprintw(win, y + 2, XPOS,
+ mvwaddstr(win, y + 1, XPOS, _("(Format to be used when entering a date: "));
+ mvwaddstr(win, y + 2, XPOS,
_(" (1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd (4)yyyy-mm-dd)"));
return y + YOFF;
@@ -849,9 +849,9 @@ print_keys_bindings(WINDOW * win, int selected_row, int selected_elm, int yoff)
if (action == selected_row)
custom_apply_attr(win, ATTR_HIGHEST);
mvwprintw(win, y, XPOS, "%s ", actionstr);
- mvwprintw(win, y, EQUALPOS, "=");
+ mvwaddstr(win, y, EQUALPOS, "=");
if (nbkeys == 0)
- mvwprintw(win, y, KEYPOS, _("undefined"));
+ mvwaddstr(win, y, KEYPOS, _("undefined"));
if (action == selected_row)
custom_remove_attr(win, ATTR_HIGHEST);
if (nbkeys > 0) {
@@ -869,7 +869,7 @@ print_keys_bindings(WINDOW * win, int selected_row, int selected_elm, int yoff)
pos += strlen(key) + 1;
}
} else {
- mvwprintw(win, y, KEYPOS, "%s", keys_action_allkeys(action));
+ mvwaddstr(win, y, KEYPOS, keys_action_allkeys(action));
}
}
y += yoff;
@@ -1044,7 +1044,7 @@ void custom_config_main(void)
else {
colorize = 0;
wins_erase_status_bar();
- mvwprintw(win[STA].p, 0, 0, no_color_support);
+ mvwaddstr(win[STA].p, 0, 0, no_color_support);
wgetch(win[STA].p);
}
break;
diff --git a/src/help.c b/src/help.c
index 6dbac96..69bb79d 100644
--- a/src/help.c
+++ b/src/help.c
@@ -103,7 +103,7 @@ help_write_pad(struct window *win, char *title, char *text, enum key action)
rownum = 0;
erase_window_part(win->p, rownum, colnum, BUFSIZ, win->w);
custom_apply_attr(win->p, ATTR_HIGHEST);
- mvwprintw(win->p, rownum, colnum, "%s", title);
+ mvwaddstr(win->p, rownum, colnum, title);
if ((int)action != KEY_RESIZE && action < NBKEYS) {
switch (action) {
case KEY_END_OF_WEEK:
@@ -137,7 +137,7 @@ help_write_pad(struct window *win, char *title, char *text, enum key action)
colnum = 0;
rownum += get_help_lines(title);
custom_remove_attr(win->p, ATTR_HIGHEST);
- mvwprintw(win->p, rownum, colnum, "%s", text);
+ mvwaddstr(win->p, rownum, colnum, text);
rownum += get_help_lines(text);
return rownum;
}
diff --git a/src/io.c b/src/io.c
index fdead34..9bffe1a 100644
--- a/src/io.c
+++ b/src/io.c
@@ -134,8 +134,8 @@ static void progress_bar(progress_bar_t type, int progress)
}
/* Draw the progress bar. */
- mvwprintw(win[STA].p, 1, ipos, barchar);
- mvwprintw(win[STA].p, 1, epos[steps - 1], barchar);
+ mvwaddstr(win[STA].p, 1, ipos, barchar);
+ mvwaddstr(win[STA].p, 1, epos[steps - 1], barchar);
custom_apply_attr(win[STA].p, ATTR_HIGHEST);
for (i = ipos + 1; i < epos[progress]; i++)
mvwaddch(win[STA].p, 1, i, ' ' | A_REVERSE);
@@ -310,10 +310,10 @@ static void display_mark(void)
mwin = newwin(1, 2, 1, col - 3);
custom_apply_attr(mwin, ATTR_HIGHEST);
- mvwprintw(mwin, 0, 0, "**");
+ mvwaddstr(mwin, 0, 0, "**");
wins_wrefresh(mwin);
sleep(DISPLAY_TIME);
- mvwprintw(mwin, 0, 0, " ");
+ mvwaddstr(mwin, 0, 0, " ");
wins_wrefresh(mwin);
delwin(mwin);
wins_doupdate();
@@ -942,14 +942,14 @@ void io_export_bar(void)
spc = 15;
custom_apply_attr(win[STA].p, ATTR_HIGHEST);
- mvwprintw(win[STA].p, 0, 2, "Q");
- mvwprintw(win[STA].p, 1, 2, "I");
- mvwprintw(win[STA].p, 0, 2 + spc, "P");
+ mvwaddstr(win[STA].p, 0, 2, "Q");
+ mvwaddstr(win[STA].p, 1, 2, "I");
+ mvwaddstr(win[STA].p, 0, 2 + spc, "P");
custom_remove_attr(win[STA].p, ATTR_HIGHEST);
- mvwprintw(win[STA].p, 0, 2 + smlspc, _("Exit"));
- mvwprintw(win[STA].p, 1, 2 + smlspc, _("Ical"));
- mvwprintw(win[STA].p, 0, 2 + spc + smlspc, _("Pcal"));
+ mvwaddstr(win[STA].p, 0, 2 + smlspc, _("Exit"));
+ mvwaddstr(win[STA].p, 1, 2 + smlspc, _("Ical"));
+ mvwaddstr(win[STA].p, 0, 2 + spc + smlspc, _("Pcal"));
wnoutrefresh(win[STA].p);
wmove(win[STA].p, 0, 0);
diff --git a/src/keys.c b/src/keys.c
index 23ee61f..3392cfc 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -416,9 +416,9 @@ keys_display_bindings_bar(WINDOW * win, struct binding *bindings[], int count,
fmtkey = keys_format_label(key, KEYS_KEYLEN);
custom_apply_attr(win, ATTR_HIGHEST);
- mvwprintw(win, key_pos_y, key_pos_x, fmtkey);
+ mvwaddstr(win, key_pos_y, key_pos_x, fmtkey);
custom_remove_attr(win, ATTR_HIGHEST);
- mvwprintw(win, label_pos_y, label_pos_x, binding->label);
+ mvwaddstr(win, label_pos_y, label_pos_x, binding->label);
}
wnoutrefresh(win);
}
diff --git a/src/notify.c b/src/notify.c
index ffd32dd..a057c2f 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -543,7 +543,7 @@ print_option(WINDOW * win, unsigned x, unsigned y, char *name,
maxlen = MAXCOL - x_opt - 2;
custom_apply_attr(win, ATTR_HIGHEST);
if (len < maxlen)
- mvwprintw(win, y, x_opt, "%s", valstr);
+ mvwaddstr(win, y, x_opt, valstr);
else {
char buf[BUFSIZ];
@@ -554,7 +554,7 @@ print_option(WINDOW * win, unsigned x, unsigned y, char *name,
custom_remove_attr(win, ATTR_HIGHEST);
} else
print_bool_option_incolor(win, valbool, y, x_opt);
- mvwprintw(win, y + 1, x, desc);
+ mvwaddstr(win, y + 1, x, desc);
}
/* Print options related to the notify-bar. */
diff --git a/src/utils.c b/src/utils.c
index bf950aa..3ca89c2 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -129,8 +129,8 @@ void fatalbox(const char *errmsg)
custom_apply_attr(errwin, ATTR_HIGHEST);
box(errwin, 0, 0);
wins_show(errwin, label);
- mvwprintw(errwin, 3, 1, reportmsg);
- mvwprintw(errwin, 5, (WINCOL - strlen(msg)) / 2, "%s", msg);
+ mvwaddstr(errwin, 3, 1, reportmsg);
+ mvwaddstr(errwin, 5, (WINCOL - strlen(msg)) / 2, msg);
custom_remove_attr(errwin, ATTR_HIGHEST);
wins_wrefresh(errwin);
wgetch(errwin);
@@ -155,7 +155,7 @@ void warnbox(const char *msg)
custom_apply_attr(warnwin, ATTR_HIGHEST);
box(warnwin, 0, 0);
wins_show(warnwin, label);
- mvwprintw(warnwin, 5, (WINCOL - strlen(displmsg)) / 2, "%s", displmsg);
+ mvwaddstr(warnwin, 5, (WINCOL - strlen(displmsg)) / 2, displmsg);
custom_remove_attr(warnwin, ATTR_HIGHEST);
wins_wrefresh(warnwin);
wgetch(warnwin);
@@ -171,8 +171,8 @@ void status_mesg(const char *msg1, const char *msg2)
{
wins_erase_status_bar();
custom_apply_attr(win[STA].p, ATTR_HIGHEST);
- mvwprintw(win[STA].p, 0, 0, msg1);
- mvwprintw(win[STA].p, 1, 0, msg2);
+ mvwaddstr(win[STA].p, 0, 0, msg1);
+ mvwaddstr(win[STA].p, 1, 0, msg2);
custom_remove_attr(win[STA].p, ATTR_HIGHEST);
}
@@ -269,7 +269,7 @@ erase_window_part(WINDOW * win, int first_col, int first_row, int last_col,
for (r = first_row; r <= last_row; r++) {
for (c = first_col; c <= last_col; c++)
- mvwprintw(win, r, c, " ");
+ mvwaddstr(win, r, c, " ");
}
}
@@ -278,21 +278,18 @@ WINDOW *popup(int pop_row, int pop_col, int pop_y, int pop_x, const char *title,
const char *msg, int hint)
{
const char *any_key = _("Press any key to continue...");
- char label[BUFSIZ];
WINDOW *popup_win;
const int MSGXPOS = 5;
popup_win = newwin(pop_row, pop_col, pop_y, pop_x);
keypad(popup_win, TRUE);
if (msg)
- mvwprintw(popup_win, MSGXPOS, (pop_col - strlen(msg)) / 2, "%s", msg);
+ mvwaddstr(popup_win, MSGXPOS, (pop_col - strlen(msg)) / 2, msg);
custom_apply_attr(popup_win, ATTR_HIGHEST);
box(popup_win, 0, 0);
- snprintf(label, BUFSIZ, "%s", title);
- wins_show(popup_win, label);
+ wins_show(popup_win, title);
if (hint)
- mvwprintw(popup_win, pop_row - 2, pop_col - (strlen(any_key) + 1), "%s",
- any_key);
+ mvwaddstr(popup_win, pop_row - 2, pop_col - (strlen(any_key) + 1), any_key);
custom_remove_attr(popup_win, ATTR_HIGHEST);
wins_wrefresh(popup_win);
@@ -316,7 +313,7 @@ print_in_middle(WINDOW * win, int starty, int startx, int width,
x += (width - len) / 2;
custom_apply_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y, x, "%s", string);
+ mvwaddstr(win, y, x, string);
custom_remove_attr(win, ATTR_HIGHEST);
}
@@ -505,7 +502,7 @@ item_in_popup(const char *saved_a_start, const char *saved_a_end,
mvwprintw(popup_win, margin_top, margin_left, "- %s -> %s",
saved_a_start, saved_a_end);
}
- mvwprintw(pad, 0, margin_left, "%s", msg);
+ mvwaddstr(pad, 0, margin_left, msg);
wmove(win[STA].p, 0, 0);
pnoutrefresh(pad, 0, 0, margin_top + 2, margin_left, padl, winw);
wins_doupdate();
@@ -580,7 +577,7 @@ print_bool_option_incolor(WINDOW * win, unsigned option, int pos_y, int pos_x)
EXIT(_("option not defined"));
custom_apply_attr(win, color);
- mvwprintw(win, pos_y, pos_x, "%s", option_value);
+ mvwaddstr(win, pos_y, pos_x, option_value);
custom_remove_attr(win, color);
wnoutrefresh(win);
wins_doupdate();