summaryrefslogtreecommitdiff
path: root/src/menus.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2020-06-19 20:27:03 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2020-06-19 20:27:03 -0400
commitd2690bc70d707b7a3a49839787d20eabc138e391 (patch)
tree7380cef4de76a01ee10581744c721d4d6d77338a /src/menus.c
parent248be9688c23f249f1ecf1860f6f4cb09e56fab2 (diff)
use new warning-message functions in the remaining places where suitable,
since -q option can be used to silence those if wanted Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/menus.c')
-rw-r--r--src/menus.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/src/menus.c b/src/menus.c
index a0e5c0f..5ffaa3f 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -216,9 +216,8 @@ CreateTitleButton(const char *name, int func, const char *action,
TitleButton *tb = malloc(sizeof(TitleButton));
if (!tb) {
- fprintf(stderr,
- "%s: unable to allocate %lu bytes for title button\n",
- ProgramName, (unsigned long) sizeof(TitleButton));
+ twmWarning("unable to allocate %lu bytes for title button",
+ (unsigned long) sizeof(TitleButton));
return 0;
}
@@ -307,11 +306,11 @@ InitTitlebarButtons(void)
/* insert extra buttons */
if (!CreateTitleButton(TBPM_ICONIFY, F_ICONIFY, "", (MenuRoot *) NULL,
False, False)) {
- fprintf(stderr, "%s: unable to add iconify button\n", ProgramName);
+ twmWarning("unable to add iconify button");
}
if (!CreateTitleButton(TBPM_RESIZE, F_RESIZE, "", (MenuRoot *) NULL,
True, True)) {
- fprintf(stderr, "%s: unable to add resize button\n", ProgramName);
+ twmWarning("unable to add resize button");
}
AddDefaultBindings();
}
@@ -326,9 +325,7 @@ InitTitlebarButtons(void)
if (!tb->bitmap) {
tb->bitmap = FindBitmap(TBPM_QUESTION, &tb->width, &tb->height);
if (!tb->bitmap) { /* cannot happen (see util.c) */
- fprintf(stderr,
- "%s: unable to add titlebar button \"%s\"\n",
- ProgramName, tb->name);
+ twmWarning("unable to add titlebar button \"%s\"", tb->name);
}
}
@@ -923,7 +920,7 @@ PopUpMenu(MenuRoot *menu, int x, int y, Bool center)
{
TwmWindow **WindowNames;
TwmWindow *tmp_win2, *tmp_win3;
- int (*compar)(const char *, const char *) =
+ int (*compar) (const char *, const char *) =
(Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1);
if (!menu)
@@ -1294,7 +1291,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
if (smcConn)
SmcCloseConnection(smcConn, 0, NULL);
execvp(*Argv, Argv);
- fprintf(stderr, "%s: unable to restart: %s\n", ProgramName, *Argv);
+ twmWarning("unable to restart: %s", *Argv);
break;
}
@@ -1782,8 +1779,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
MenuItem *mitem;
if ((mroot = FindMenuRoot(action)) == NULL) {
- fprintf(stderr, "%s: couldn't find function \"%s\"\n",
- ProgramName, action);
+ twmWarning("couldn't find function \"%s\"", action);
return TRUE;
}
@@ -1952,9 +1948,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
close(fd);
}
else {
- fprintf(stderr,
- "%s: unable to open cut file \"%s\"\n",
- ProgramName, tmp);
+ twmWarning("unable to open cut file \"%s\"", tmp);
}
free(ptr);
}
@@ -1964,7 +1958,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
}
}
else {
- fprintf(stderr, "%s: cut buffer is empty\n", ProgramName);
+ twmWarning("cut buffer is empty");
}
break;
@@ -2143,13 +2137,12 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
close(fd);
}
else {
- fprintf(stderr, "%s: unable to open file \"%s\"\n",
- ProgramName, ptr);
+ twmWarning("unable to open file \"%s\"", ptr);
}
free(ptr);
}
else {
- fprintf(stderr, "%s: error expanding filename\n", ProgramName);
+ twmWarning("error expanding filename");
}
break;
@@ -2205,7 +2198,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
break;
case F_STARTWM:
execlp("/bin/sh", "sh", "-c", action, (void *) NULL);
- fprintf(stderr, "%s: unable to start: %s\n", ProgramName, *Argv);
+ twmWarning("unable to start: %s", *Argv);
break;
}
@@ -2675,8 +2668,7 @@ WarpToScreen(int n, int inc)
n += inc;
continue;
}
- fprintf(stderr, "%s: unable to warp to unmanaged screen %d\n",
- ProgramName, n);
+ twmWarning("unable to warp to unmanaged screen %d", n);
Bell(XkbBI_MinorError, 0, None);
return;
}