mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Remove wsyserrorwithcode, rename wsyserror to werror
wsyserrorwithcode - Not used, no point either. wsyserror->werror - qualifying "error" with a "type" hardly makes sense if there are not at least two "type"s. There are not. Safe trip. Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
This commit is contained in:
committed by
Carlos R. Mafra
parent
c5f5e0b9c0
commit
1f21919809
@@ -17,7 +17,7 @@ wmessage converted from function to wrapper macro
|
||||
wwarning converted from function to wrapper macro
|
||||
wfatal converted from function to wrapper macro
|
||||
wsyserror converted from function to wrapper macro
|
||||
wsyserrorwithcode converted from function to wrapper macro
|
||||
wsyserrorwithcode removed
|
||||
wmkdirhier ADDED
|
||||
wrmdirhier ADDED
|
||||
wmalloc0 REMOVED
|
||||
|
||||
@@ -169,19 +169,16 @@ waborthandler* wsetabort(waborthandler* handler);
|
||||
enum {
|
||||
WMESSAGE_TYPE_MESSAGE,
|
||||
WMESSAGE_TYPE_WARNING,
|
||||
WMESSAGE_TYPE_FATAL,
|
||||
WMESSAGE_TYPE_WSYSERROR,
|
||||
WMESSAGE_TYPE_WSYSERRORWITHCODE
|
||||
WMESSAGE_TYPE_ERROR,
|
||||
WMESSAGE_TYPE_FATAL
|
||||
};
|
||||
|
||||
#define wmessage(fmt, args...) __wmessage( WMESSAGE_TYPE_MESSAGE, NULL, fmt, ## args)
|
||||
#define wwarning(fmt, args...) __wmessage( WMESSAGE_TYPE_WARNING, NULL, fmt, ## args)
|
||||
#define wfatal(fmt, args...) __wmessage( WMESSAGE_TYPE_FATAL, NULL, fmt, ## args)
|
||||
#define wsyserror(fmt, args...) __wmessage( WMESSAGE_TYPE_WSYSERROR, NULL, fmt, ## args)
|
||||
#define wsyserrorwithcode(errno, fmt, args...) \
|
||||
__wmessage( WMESSAGE_TYPE_WSYSERRORWITHCODE, &errno, fmt, ## args)
|
||||
#define wmessage(fmt, args...) __wmessage( WMESSAGE_TYPE_MESSAGE, fmt, ## args)
|
||||
#define wwarning(fmt, args...) __wmessage( WMESSAGE_TYPE_WARNING, fmt, ## args)
|
||||
#define werror(fmt, args...) __wmessage( WMESSAGE_TYPE_ERROR, fmt, ## args)
|
||||
#define wfatal(fmt, args...) __wmessage( WMESSAGE_TYPE_FATAL, fmt, ## args)
|
||||
|
||||
void __wmessage(int type, void *extra, const char *msg, ...) __attribute__((__format__(printf,3,4)));
|
||||
void __wmessage(int type, const char *msg, ...) __attribute__((__format__(printf,2,3)));
|
||||
|
||||
char* wfindfile(char *paths, char *file);
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -31,7 +30,7 @@
|
||||
|
||||
extern char *_WINGS_progname;
|
||||
|
||||
void __wmessage(int type, void *extra, const char *msg, ...)
|
||||
void __wmessage(int type, const char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *buf;
|
||||
@@ -56,40 +55,28 @@ void __wmessage(int type, void *extra, const char *msg, ...)
|
||||
buf = wmalloc(linemax);
|
||||
|
||||
fflush(stdout);
|
||||
/* message format: <wings_progname>: <qualifier>: <message>[: <extra info>]"\n" */
|
||||
/* message format: <wings_progname>: <qualifier>: <message>"\n" */
|
||||
snprintf(buf, linemax, "%s: ", _WINGS_progname ? _WINGS_progname : "WINGs");
|
||||
va_start(args, msg);
|
||||
switch (type) {
|
||||
case WMESSAGE_TYPE_WARNING:
|
||||
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1,
|
||||
_("warning: "));
|
||||
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1,
|
||||
msg, args);
|
||||
break;
|
||||
case WMESSAGE_TYPE_FATAL:
|
||||
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1,
|
||||
_("fatal error: "));
|
||||
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1,
|
||||
msg, args);
|
||||
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1, _("fatal error: "));
|
||||
break;
|
||||
case WMESSAGE_TYPE_ERROR:
|
||||
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1, _("error: "));
|
||||
break;
|
||||
case WMESSAGE_TYPE_WARNING:
|
||||
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1, _("warning: "));
|
||||
break;
|
||||
case WMESSAGE_TYPE_WSYSERROR:
|
||||
case WMESSAGE_TYPE_WSYSERRORWITHCODE:
|
||||
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1,
|
||||
_("error: "));
|
||||
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1,
|
||||
msg, args);
|
||||
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1,
|
||||
": %s", type == WMESSAGE_TYPE_WSYSERROR ?
|
||||
strerror(errno) : strerror(*(int *)extra));
|
||||
break;
|
||||
case WMESSAGE_TYPE_MESSAGE:
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
default: /* should not happen, but doesn't hurt either */
|
||||
strncat(buf, ": ", linemax - strlen(buf));
|
||||
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1, msg, args);
|
||||
break;
|
||||
}
|
||||
|
||||
va_start(args, msg);
|
||||
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1, msg, args);
|
||||
va_end(args);
|
||||
|
||||
strncat(buf, "\n", linemax - strlen(buf));
|
||||
|
||||
@@ -43,7 +43,7 @@ char *wgethomedir()
|
||||
|
||||
user = getpwuid(getuid());
|
||||
if (!user) {
|
||||
wsyserror(_("could not get password entry for UID %i"), getuid());
|
||||
werror(_("could not get password entry for UID %i"), getuid());
|
||||
return "/";
|
||||
}
|
||||
if (!user->pw_dir) {
|
||||
@@ -59,7 +59,7 @@ static char *getuserhomedir(const char *username)
|
||||
|
||||
user = getpwnam(username);
|
||||
if (!user) {
|
||||
wsyserror(_("could not get password entry for user %s"), username);
|
||||
werror(_("could not get password entry for user %s"), username);
|
||||
return NULL;
|
||||
}
|
||||
if (!user->pw_dir) {
|
||||
@@ -175,7 +175,7 @@ char *wexpandpath(char *path)
|
||||
|
||||
error:
|
||||
errno = ENAMETOOLONG;
|
||||
wsyserror(_("could not expand %s"), origpath);
|
||||
werror(_("could not expand %s"), origpath);
|
||||
/* FIXME: too many functions handle a return value of NULL incorrectly */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1496,14 +1496,14 @@ WMPropList *WMReadPropListFromFile(char *file)
|
||||
f = fopen(file, "rb");
|
||||
if (!f) {
|
||||
/* let the user print the error message if he really needs to */
|
||||
/*wsyserror(_("could not open domain file '%s' for reading"), file); */
|
||||
/*werror(_("could not open domain file '%s' for reading"), file); */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (stat(file, &stbuf) == 0) {
|
||||
length = (size_t) stbuf.st_size;
|
||||
} else {
|
||||
wsyserror(_("could not get size for file '%s'"), file);
|
||||
werror(_("could not get size for file '%s'"), file);
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1516,7 +1516,7 @@ WMPropList *WMReadPropListFromFile(char *file)
|
||||
|
||||
if (fread(pldata->ptr, length, 1, f) != 1) {
|
||||
if (ferror(f)) {
|
||||
wsyserror(_("error reading from file '%s'"), file);
|
||||
werror(_("error reading from file '%s'"), file);
|
||||
}
|
||||
plist = NULL;
|
||||
goto cleanup;
|
||||
@@ -1567,7 +1567,7 @@ Bool WMWritePropListToFile(WMPropList * plist, char *path)
|
||||
|
||||
#ifdef HAVE_MKSTEMP
|
||||
if ((fd = mkstemp(thePath)) < 0) {
|
||||
wsyserror(_("mkstemp (%s) failed"), thePath);
|
||||
werror(_("mkstemp (%s) failed"), thePath);
|
||||
goto failure;
|
||||
}
|
||||
mask = umask(0);
|
||||
@@ -1578,21 +1578,21 @@ Bool WMWritePropListToFile(WMPropList * plist, char *path)
|
||||
}
|
||||
#else
|
||||
if (mktemp(thePath) == NULL) {
|
||||
wsyserror(_("mktemp (%s) failed"), thePath);
|
||||
werror(_("mktemp (%s) failed"), thePath);
|
||||
goto failure;
|
||||
}
|
||||
theFile = fopen(thePath, "wb");
|
||||
#endif
|
||||
|
||||
if (theFile == NULL) {
|
||||
wsyserror(_("open (%s) failed"), thePath);
|
||||
werror(_("open (%s) failed"), thePath);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
desc = indentedDescription(plist, 0);
|
||||
|
||||
if (fprintf(theFile, "%s\n", desc) != strlen(desc) + 1) {
|
||||
wsyserror(_("writing to file: %s failed"), thePath);
|
||||
werror(_("writing to file: %s failed"), thePath);
|
||||
wfree(desc);
|
||||
goto failure;
|
||||
}
|
||||
@@ -1601,7 +1601,7 @@ Bool WMWritePropListToFile(WMPropList * plist, char *path)
|
||||
|
||||
(void)fsync(fileno(theFile));
|
||||
if (fclose(theFile) != 0) {
|
||||
wsyserror(_("fclose (%s) failed"), thePath);
|
||||
werror(_("fclose (%s) failed"), thePath);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
@@ -1609,7 +1609,7 @@ Bool WMWritePropListToFile(WMPropList * plist, char *path)
|
||||
* real file. Also, we need to try to retain the file attributes of
|
||||
* the original file we are overwriting (if we are) */
|
||||
if (rename(thePath, path) != 0) {
|
||||
wsyserror(_("rename ('%s' to '%s') failed"), thePath, path);
|
||||
werror(_("rename ('%s' to '%s') failed"), thePath, path);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
@@ -1679,7 +1679,7 @@ int wmkdirhier(const char *path)
|
||||
strncpy(buf, thePath, p);
|
||||
if (mkdir(buf, 0777) == -1 && errno == EEXIST &&
|
||||
stat(buf, &st) == 0 && !S_ISDIR(st.st_mode)) {
|
||||
wsyserror(_("Could not create component %s"), buf);
|
||||
werror(_("Could not create component %s"), buf);
|
||||
wfree(thePath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1144,7 +1144,7 @@ static void readConfiguration(W_ColorPanel * panel)
|
||||
|
||||
if (stat(panel->configurationPath, &stat_buf) != 0) {
|
||||
if (mkdir(panel->configurationPath, S_IRWXU | S_IRGRP | S_IROTH | S_IXGRP | S_IXOTH) != 0) {
|
||||
wsyserror(_("Color Panel: Could not create directory %s needed"
|
||||
werror(_("Color Panel: Could not create directory %s needed"
|
||||
" to store configurations"), panel->configurationPath);
|
||||
WMSetPopUpButtonEnabled(panel->customPaletteMenuBtn, False);
|
||||
WMSetPopUpButtonEnabled(panel->colorListColorMenuBtn, False);
|
||||
@@ -2955,7 +2955,7 @@ static void customPaletteMenuNewFromFile(W_ColorPanel * panel)
|
||||
WMRunAlertPanel(scr, panel->win, _("File Error"),
|
||||
_("Invalid file format !"), _("OK"), NULL, NULL);
|
||||
if (i != 0) {
|
||||
wsyserror(_("can't remove file %s"), tmp);
|
||||
werror(_("can't remove file %s"), tmp);
|
||||
WMRunAlertPanel(scr, panel->win, _("File Error"),
|
||||
_("Couldn't remove file from Configuration Directory !"),
|
||||
_("OK"), NULL, NULL);
|
||||
@@ -3031,7 +3031,7 @@ static void customPaletteMenuRename(W_ColorPanel * panel)
|
||||
}
|
||||
|
||||
if (rename(fromPath, toPath) != 0)
|
||||
wsyserror(_("Couldn't rename palette %s to %s\n"), fromName, toName);
|
||||
werror(_("Couldn't rename palette %s to %s\n"), fromName, toName);
|
||||
else {
|
||||
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
|
||||
WMInsertPopUpButtonItem(panel->customPaletteHistoryBtn, item, toName);
|
||||
@@ -3078,7 +3078,7 @@ static void customPaletteMenuRemove(W_ColorPanel * panel)
|
||||
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
|
||||
|
||||
} else {
|
||||
wsyserror(_("Couldn't remove palette %s\n"), tmp);
|
||||
werror(_("Couldn't remove palette %s\n"), tmp);
|
||||
}
|
||||
|
||||
wfree(tmp);
|
||||
@@ -3347,14 +3347,14 @@ static int fetchFile(char *toPath, char *srcFile, char *destFile)
|
||||
|
||||
RETRY( src = fopen(srcFile, "rb") )
|
||||
if (src == NULL) {
|
||||
wsyserror(_("Could not open %s"), srcFile);
|
||||
werror(_("Could not open %s"), srcFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
dstpath = wstrconcat(toPath, destFile);
|
||||
RETRY( dst = fopen(dstpath, "wb") )
|
||||
if (dst == NULL) {
|
||||
wsyserror(_("Could not create %s"), dstpath);
|
||||
werror(_("Could not create %s"), dstpath);
|
||||
wfree(dstpath);
|
||||
RETRY( fclose(src) )
|
||||
return -1;
|
||||
|
||||
@@ -395,7 +395,7 @@ static void dumpRImage(char *path, RImage * image)
|
||||
|
||||
f = fopen(path, "wb");
|
||||
if (!f) {
|
||||
wsyserror(path);
|
||||
werror(path);
|
||||
return;
|
||||
}
|
||||
fprintf(f, "%02x%02x%1x", image->width, image->height, channels);
|
||||
@@ -404,7 +404,7 @@ static void dumpRImage(char *path, RImage * image)
|
||||
|
||||
fsync(fileno(f));
|
||||
if (fclose(f) < 0) {
|
||||
wsyserror(path);
|
||||
werror(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1027,7 +1027,7 @@ static void deleteTexture(WMWidget * w, void *data)
|
||||
WMReleasePropList(titem->prop);
|
||||
if (titem->path) {
|
||||
if (remove(titem->path) < 0 && errno != ENOENT) {
|
||||
wsyserror("could not remove file %s", titem->path);
|
||||
werror("could not remove file %s", titem->path);
|
||||
}
|
||||
wfree(titem->path);
|
||||
}
|
||||
@@ -1572,7 +1572,7 @@ static void createPanel(Panel * p)
|
||||
|
||||
if (access(panel->fprefix, F_OK) != 0) {
|
||||
if (mkdir(panel->fprefix, 0755) < 0) {
|
||||
wsyserror(panel->fprefix);
|
||||
werror(panel->fprefix);
|
||||
ok = False;
|
||||
}
|
||||
}
|
||||
@@ -1582,7 +1582,7 @@ static void createPanel(Panel * p)
|
||||
panel->fprefix = tmp;
|
||||
if (access(panel->fprefix, F_OK) != 0) {
|
||||
if (mkdir(panel->fprefix, 0755) < 0) {
|
||||
wsyserror(panel->fprefix);
|
||||
werror(panel->fprefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,7 +656,7 @@ static void storeCommandInScript(char *cmd, char *line)
|
||||
if (!f) {
|
||||
f = fopen(path, "wb");
|
||||
if (!f) {
|
||||
wsyserror(_("could not create %s"), path);
|
||||
werror(_("could not create %s"), path);
|
||||
goto end;
|
||||
}
|
||||
fprintf(f, "#!/bin/sh\n");
|
||||
@@ -671,7 +671,7 @@ static void storeCommandInScript(char *cmd, char *line)
|
||||
tmppath = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart.tmp");
|
||||
fo = fopen(tmppath, "wb");
|
||||
if (!fo) {
|
||||
wsyserror(_("could not create temporary file %s"), tmppath);
|
||||
werror(_("could not create temporary file %s"), tmppath);
|
||||
wfree(tmppath);
|
||||
goto end;
|
||||
}
|
||||
@@ -704,7 +704,7 @@ static void storeCommandInScript(char *cmd, char *line)
|
||||
fclose(fo);
|
||||
|
||||
if (rename(tmppath, path) != 0) {
|
||||
wsyserror(_("could not rename file %s to %s\n"), tmppath, path);
|
||||
werror(_("could not rename file %s to %s\n"), tmppath, path);
|
||||
}
|
||||
wfree(tmppath);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ static pid_t downloadFile(WMScreen * scr, _Panel * panel, char *file)
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
wsyserror("could not fork() process");
|
||||
werror("could not fork() process");
|
||||
|
||||
WMRunAlertPanel(scr, GetWindow(panel), _("Error"),
|
||||
"Could not start download. fork() failed", _("OK"), NULL, NULL);
|
||||
|
||||
@@ -675,7 +675,7 @@ static void loadConfigurations(WMScreen * scr, WMWindow * mainw)
|
||||
wfree(command);
|
||||
}
|
||||
if (!file || !fgets(buffer, 1023, file)) {
|
||||
wsyserror(_("could not extract version information from Window Maker"));
|
||||
werror(_("could not extract version information from Window Maker"));
|
||||
wfatal(_("Make sure wmaker is in your search path."));
|
||||
|
||||
WMRunAlertPanel(scr, mainw, _("Error"),
|
||||
@@ -719,7 +719,7 @@ static void loadConfigurations(WMScreen * scr, WMWindow * mainw)
|
||||
wfree(command);
|
||||
}
|
||||
if (!file || !fgets(buffer, 1023, file)) {
|
||||
wsyserror(_("could not run \"%s --global_defaults_path\"."), path);
|
||||
werror(_("could not run \"%s --global_defaults_path\"."), path);
|
||||
exit(1);
|
||||
} else {
|
||||
char *ptr;
|
||||
|
||||
@@ -2667,7 +2667,7 @@ static int setWorkspaceSpecificBack(WScreen * scr, WDefaultEntry * entry, WMProp
|
||||
return 0;
|
||||
|
||||
if (pipe(filedes) < 0) {
|
||||
wsyserror("pipe() failed:can't set workspace specific background image");
|
||||
werror("pipe() failed:can't set workspace specific background image");
|
||||
|
||||
WMReleasePropList(value);
|
||||
return 0;
|
||||
@@ -2675,11 +2675,11 @@ static int setWorkspaceSpecificBack(WScreen * scr, WDefaultEntry * entry, WMProp
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
wsyserror("fork() failed:can't set workspace specific background image");
|
||||
werror("fork() failed:can't set workspace specific background image");
|
||||
if (close(filedes[0]) < 0)
|
||||
wsyserror("could not close pipe");
|
||||
werror("could not close pipe");
|
||||
if (close(filedes[1]) < 0)
|
||||
wsyserror("could not close pipe");
|
||||
werror("could not close pipe");
|
||||
|
||||
} else if (pid == 0) {
|
||||
char *dither;
|
||||
@@ -2687,24 +2687,24 @@ static int setWorkspaceSpecificBack(WScreen * scr, WDefaultEntry * entry, WMProp
|
||||
SetupEnvironment(scr);
|
||||
|
||||
if (close(0) < 0)
|
||||
wsyserror("could not close pipe");
|
||||
werror("could not close pipe");
|
||||
if (dup(filedes[0]) < 0) {
|
||||
wsyserror("dup() failed:can't set workspace specific background image");
|
||||
werror("dup() failed:can't set workspace specific background image");
|
||||
}
|
||||
dither = wPreferences.no_dithering ? "-m" : "-d";
|
||||
if (wPreferences.smooth_workspace_back)
|
||||
execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither, NULL);
|
||||
else
|
||||
execlp("wmsetbg", "wmsetbg", "-helper", dither, NULL);
|
||||
wsyserror("could not execute wmsetbg");
|
||||
werror("could not execute wmsetbg");
|
||||
exit(1);
|
||||
} else {
|
||||
|
||||
if (fcntl(filedes[0], F_SETFD, FD_CLOEXEC) < 0) {
|
||||
wsyserror("error setting close-on-exec flag");
|
||||
werror("error setting close-on-exec flag");
|
||||
}
|
||||
if (fcntl(filedes[1], F_SETFD, FD_CLOEXEC) < 0) {
|
||||
wsyserror("error setting close-on-exec flag");
|
||||
werror("error setting close-on-exec flag");
|
||||
}
|
||||
|
||||
scr->helper_fd = filedes[1];
|
||||
|
||||
@@ -1551,7 +1551,7 @@ int wShowCrashingDialogPanel(int whatSig)
|
||||
|
||||
scr = WMCreateScreen(dpy, screen_no);
|
||||
if (!scr) {
|
||||
wsyserror(_("cannot open connection for crashing dialog panel. Aborting."));
|
||||
werror(_("cannot open connection for crashing dialog panel. Aborting."));
|
||||
return WMAbort;
|
||||
}
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ static char *getnameforicon(WWindow * wwin)
|
||||
|
||||
if (access(path, F_OK) != 0) {
|
||||
if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR)) {
|
||||
wsyserror(_("could not create directory %s"), path);
|
||||
werror(_("could not create directory %s"), path);
|
||||
wfree(path);
|
||||
wfree(suffix);
|
||||
return NULL;
|
||||
@@ -457,7 +457,7 @@ static char *getnameforicon(WWindow * wwin)
|
||||
strcat(path, "/CachedPixmaps");
|
||||
if (access(path, F_OK) != 0) {
|
||||
if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 0) {
|
||||
wsyserror(_("could not create directory %s"), path);
|
||||
werror(_("could not create directory %s"), path);
|
||||
wfree(path);
|
||||
wfree(suffix);
|
||||
return NULL;
|
||||
|
||||
12
src/main.c
12
src/main.c
@@ -309,7 +309,7 @@ void Restart(char *manager, Bool abortOnFailure)
|
||||
wfatal(_("failed to restart Window Maker."));
|
||||
} else {
|
||||
execvp(prog, argv);
|
||||
wsyserror(_("could not exec %s"), prog);
|
||||
werror(_("could not exec %s"), prog);
|
||||
}
|
||||
if (abortOnFailure)
|
||||
exit(7);
|
||||
@@ -388,10 +388,10 @@ void ExecuteShellCommand(WScreen * scr, char *command)
|
||||
setsid();
|
||||
#endif
|
||||
execl(shell, shell, "-c", command, NULL);
|
||||
wsyserror("could not execute %s -c %s", shell, command);
|
||||
werror("could not execute %s -c %s", shell, command);
|
||||
Exit(-1);
|
||||
} else if (pid < 0) {
|
||||
wsyserror("cannot fork a new process");
|
||||
werror("cannot fork a new process");
|
||||
} else {
|
||||
_tuple *data = wmalloc(sizeof(_tuple));
|
||||
|
||||
@@ -517,7 +517,7 @@ static void execInitScript()
|
||||
|
||||
if (file) {
|
||||
if (system(file) != 0) {
|
||||
wsyserror(_("%s:could not execute initialization script"), file);
|
||||
werror(_("%s:could not execute initialization script"), file);
|
||||
}
|
||||
wfree(file);
|
||||
}
|
||||
@@ -535,7 +535,7 @@ void ExecExitScript()
|
||||
|
||||
if (file) {
|
||||
if (system(file) != 0) {
|
||||
wsyserror(_("%s:could not execute exit script"), file);
|
||||
werror(_("%s:could not execute exit script"), file);
|
||||
}
|
||||
wfree(file);
|
||||
}
|
||||
@@ -754,7 +754,7 @@ static int real_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (fcntl(ConnectionNumber(dpy), F_SETFD, FD_CLOEXEC) < 0) {
|
||||
wsyserror("error setting close-on-exec flag for X connection");
|
||||
werror("error setting close-on-exec flag for X connection");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ static char *username(void)
|
||||
|
||||
user = getpwuid(getuid());
|
||||
if (!user) {
|
||||
wsyserror(_("could not get password entry for UID %i"), getuid());
|
||||
werror(_("could not get password entry for UID %i"), getuid());
|
||||
return NULL;
|
||||
}
|
||||
if (!user->pw_name) {
|
||||
@@ -1013,7 +1013,7 @@ void SendHelperMessage(WScreen * scr, char type, int workspace, char *msg)
|
||||
strcpy(&buffer[i], msg);
|
||||
|
||||
if (write(scr->helper_fd, buffer, len + 4) < 0) {
|
||||
wsyserror(_("could not send message to background image helper"));
|
||||
werror(_("could not send message to background image helper"));
|
||||
}
|
||||
wfree(buffer);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int showCrashDialog(int sig)
|
||||
XCloseDisplay(dpy);
|
||||
dpy = NULL;
|
||||
} else {
|
||||
wsyserror(_("cannot open connection for crashing dialog panel. Aborting."));
|
||||
werror(_("cannot open connection for crashing dialog panel. Aborting."));
|
||||
crashAction = WMAbort;
|
||||
}
|
||||
|
||||
@@ -98,16 +98,16 @@ int MonitorLoop(int argc, char **argv)
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
execvp(child_argv[0], child_argv);
|
||||
wsyserror(_("Error respawning Window Maker"));
|
||||
werror(_("Error respawning Window Maker"));
|
||||
exit(1);
|
||||
} else if (pid < 0) {
|
||||
wsyserror(_("Error respawning Window Maker"));
|
||||
werror(_("Error respawning Window Maker"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
do {
|
||||
if ((exited = waitpid(-1, &status, 0)) < 0) {
|
||||
wsyserror(_("Error during monitoring of Window Maker process."));
|
||||
werror(_("Error during monitoring of Window Maker process."));
|
||||
error = True;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry)
|
||||
if (first < 0)
|
||||
first = i;
|
||||
} else {
|
||||
wsyserror(_("%s:could not stat menu"), path[i]);
|
||||
werror(_("%s:could not stat menu"), path[i]);
|
||||
/*goto finish; */
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry)
|
||||
}
|
||||
|
||||
if (first < 0) {
|
||||
wsyserror(_("%s:could not stat menu:%s"), "OPEN_MENU", (char *)entry->clientdata);
|
||||
werror(_("%s:could not stat menu:%s"), "OPEN_MENU", (char *)entry->clientdata);
|
||||
goto finish;
|
||||
}
|
||||
stat(path[first], &stat_buf);
|
||||
@@ -1082,7 +1082,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
|
||||
wfree(args);
|
||||
file = popen(command, "r");
|
||||
if (!file) {
|
||||
wsyserror(_("%s:could not open/preprocess menu file"), file_name);
|
||||
werror(_("%s:could not open/preprocess menu file"), file_name);
|
||||
} else {
|
||||
cpp = 1;
|
||||
}
|
||||
@@ -1093,7 +1093,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
|
||||
if (!file) {
|
||||
file = fopen(file_name, "rb");
|
||||
if (!file) {
|
||||
wsyserror(_("%s:could not open menu file"), file_name);
|
||||
werror(_("%s:could not open menu file"), file_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1127,7 +1127,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
|
||||
#ifdef CPP
|
||||
if (cpp) {
|
||||
if (pclose(file) == -1) {
|
||||
wsyserror(_("error reading preprocessed menu data"));
|
||||
werror(_("error reading preprocessed menu data"));
|
||||
}
|
||||
} else {
|
||||
fclose(file);
|
||||
@@ -1178,7 +1178,7 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
|
||||
wfree(args);
|
||||
file = popen(command, "r");
|
||||
if (!file) {
|
||||
wsyserror(_("%s:could not open/preprocess menu file"), filename);
|
||||
werror(_("%s:could not open/preprocess menu file"), filename);
|
||||
} else {
|
||||
cpp = 1;
|
||||
}
|
||||
@@ -1190,7 +1190,7 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
|
||||
file = popen(filename, "rb");
|
||||
|
||||
if (!file) {
|
||||
wsyserror(_("%s:could not open menu file"), filename);
|
||||
werror(_("%s:could not open menu file"), filename);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1297,7 +1297,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
|
||||
|
||||
buffer = malloc(strlen(path[i]) + strlen(dentry->d_name) + 4);
|
||||
if (!buffer) {
|
||||
wsyserror(_("out of memory while constructing directory menu %s"), path[i]);
|
||||
werror(_("out of memory while constructing directory menu %s"), path[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1306,7 +1306,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
|
||||
strcat(buffer, dentry->d_name);
|
||||
|
||||
if (stat(buffer, &stat_buf) != 0) {
|
||||
wsyserror(_("%s:could not stat file \"%s\" in menu directory"),
|
||||
werror(_("%s:could not stat file \"%s\" in menu directory"),
|
||||
path[i], dentry->d_name);
|
||||
} else {
|
||||
Bool isFilePack = False;
|
||||
@@ -1369,7 +1369,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
|
||||
length += strlen(command) + 6;
|
||||
buffer = malloc(length);
|
||||
if (!buffer) {
|
||||
wsyserror(_("out of memory while constructing directory menu %s"), path[data->index]);
|
||||
werror(_("out of memory while constructing directory menu %s"), path[data->index]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1408,7 +1408,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
|
||||
|
||||
buffer = malloc(length);
|
||||
if (!buffer) {
|
||||
wsyserror(_("out of memory while constructing directory menu %s"), path[data->index]);
|
||||
werror(_("out of memory while constructing directory menu %s"), path[data->index]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1501,13 +1501,13 @@ static WMenu *configureMenu(WScreen * scr, WMPropList * definition)
|
||||
}
|
||||
|
||||
if (!path) {
|
||||
wsyserror(_("could not find menu file \"%s\" referenced in WMRootMenu"), tmp);
|
||||
werror(_("could not find menu file \"%s\" referenced in WMRootMenu"), tmp);
|
||||
wfree(tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (stat(path, &stat_buf) < 0) {
|
||||
wsyserror(_("could not access menu \"%s\" referenced in WMRootMenu"), path);
|
||||
werror(_("could not access menu \"%s\" referenced in WMRootMenu"), path);
|
||||
wfree(path);
|
||||
wfree(tmp);
|
||||
return NULL;
|
||||
|
||||
@@ -1010,7 +1010,7 @@ void wScreenSaveState(WScreen * scr)
|
||||
str = wdefaultspathfordomain(buf);
|
||||
}
|
||||
if (!WMWritePropListToFile(scr->session_state, str)) {
|
||||
wsyserror(_("could not save session state in %s"), str);
|
||||
werror(_("could not save session state in %s"), str);
|
||||
}
|
||||
wfree(str);
|
||||
WMReleasePropList(old_state);
|
||||
|
||||
@@ -201,13 +201,13 @@ void copyFile(char *dir, char *file)
|
||||
|
||||
RETRY( dst = fopen(dstpath, "wb") )
|
||||
if (dst == NULL) {
|
||||
wsyserror(_("Could not create %s"), dstpath);
|
||||
werror(_("Could not create %s"), dstpath);
|
||||
goto err;
|
||||
}
|
||||
|
||||
RETRY( src = fopen(file, "rb") )
|
||||
if (src == NULL) {
|
||||
wsyserror(_("Could not open %s"), file);
|
||||
werror(_("Could not open %s"), file);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
@@ -883,7 +883,7 @@ void helperLoop(RContext * rc)
|
||||
|
||||
/* get length of message */
|
||||
if (readmsg(0, buffer, 4) < 0) {
|
||||
wsyserror("error reading message from Window Maker");
|
||||
werror("error reading message from Window Maker");
|
||||
errcount--;
|
||||
if (errcount == 0) {
|
||||
wfatal("quitting");
|
||||
@@ -897,7 +897,7 @@ void helperLoop(RContext * rc)
|
||||
|
||||
/* get message */
|
||||
if (readmsg(0, buffer, size) < 0) {
|
||||
wsyserror("error reading message from Window Maker");
|
||||
werror("error reading message from Window Maker");
|
||||
errcount--;
|
||||
if (errcount == 0) {
|
||||
wfatal("quitting");
|
||||
|
||||
Reference in New Issue
Block a user