1
0
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:
Tamas TEVESZ
2010-09-27 16:12:57 +02:00
committed by Carlos R. Mafra
parent c5f5e0b9c0
commit 1f21919809
20 changed files with 92 additions and 108 deletions

View File

@@ -17,7 +17,7 @@ wmessage converted from function to wrapper macro
wwarning converted from function to wrapper macro wwarning converted from function to wrapper macro
wfatal converted from function to wrapper macro wfatal converted from function to wrapper macro
wsyserror converted from function to wrapper macro wsyserror converted from function to wrapper macro
wsyserrorwithcode converted from function to wrapper macro wsyserrorwithcode removed
wmkdirhier ADDED wmkdirhier ADDED
wrmdirhier ADDED wrmdirhier ADDED
wmalloc0 REMOVED wmalloc0 REMOVED

View File

@@ -169,19 +169,16 @@ waborthandler* wsetabort(waborthandler* handler);
enum { enum {
WMESSAGE_TYPE_MESSAGE, WMESSAGE_TYPE_MESSAGE,
WMESSAGE_TYPE_WARNING, WMESSAGE_TYPE_WARNING,
WMESSAGE_TYPE_FATAL, WMESSAGE_TYPE_ERROR,
WMESSAGE_TYPE_WSYSERROR, WMESSAGE_TYPE_FATAL
WMESSAGE_TYPE_WSYSERRORWITHCODE
}; };
#define wmessage(fmt, args...) __wmessage( WMESSAGE_TYPE_MESSAGE, NULL, fmt, ## args) #define wmessage(fmt, args...) __wmessage( WMESSAGE_TYPE_MESSAGE, fmt, ## args)
#define wwarning(fmt, args...) __wmessage( WMESSAGE_TYPE_WARNING, NULL, fmt, ## args) #define wwarning(fmt, args...) __wmessage( WMESSAGE_TYPE_WARNING, fmt, ## args)
#define wfatal(fmt, args...) __wmessage( WMESSAGE_TYPE_FATAL, NULL, fmt, ## args) #define werror(fmt, args...) __wmessage( WMESSAGE_TYPE_ERROR, fmt, ## args)
#define wsyserror(fmt, args...) __wmessage( WMESSAGE_TYPE_WSYSERROR, NULL, fmt, ## args) #define wfatal(fmt, args...) __wmessage( WMESSAGE_TYPE_FATAL, fmt, ## args)
#define wsyserrorwithcode(errno, fmt, args...) \
__wmessage( WMESSAGE_TYPE_WSYSERRORWITHCODE, &errno, 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); char* wfindfile(char *paths, char *file);

View File

@@ -20,7 +20,6 @@
#include "wconfig.h" #include "wconfig.h"
#include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -31,7 +30,7 @@
extern char *_WINGS_progname; extern char *_WINGS_progname;
void __wmessage(int type, void *extra, const char *msg, ...) void __wmessage(int type, const char *msg, ...)
{ {
va_list args; va_list args;
char *buf; char *buf;
@@ -56,40 +55,28 @@ void __wmessage(int type, void *extra, const char *msg, ...)
buf = wmalloc(linemax); buf = wmalloc(linemax);
fflush(stdout); 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"); snprintf(buf, linemax, "%s: ", _WINGS_progname ? _WINGS_progname : "WINGs");
va_start(args, msg);
switch (type) { 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: case WMESSAGE_TYPE_FATAL:
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1, snprintf(buf + strlen(buf), linemax - strlen(buf) - 1, _("fatal error: "));
_("fatal error: ")); break;
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1, case WMESSAGE_TYPE_ERROR:
msg, args); snprintf(buf + strlen(buf), linemax - strlen(buf) - 1, _("error: "));
break;
case WMESSAGE_TYPE_WARNING:
snprintf(buf + strlen(buf), linemax - strlen(buf) - 1, _("warning: "));
break; 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; break;
case WMESSAGE_TYPE_MESSAGE: case WMESSAGE_TYPE_MESSAGE:
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default: /* should not happen, but doesn't hurt either */
strncat(buf, ": ", linemax - strlen(buf)); strncat(buf, ": ", linemax - strlen(buf));
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1, msg, args);
break; break;
} }
va_start(args, msg);
vsnprintf(buf + strlen(buf), linemax - strlen(buf) - 1, msg, args);
va_end(args); va_end(args);
strncat(buf, "\n", linemax - strlen(buf)); strncat(buf, "\n", linemax - strlen(buf));

View File

@@ -43,7 +43,7 @@ char *wgethomedir()
user = getpwuid(getuid()); user = getpwuid(getuid());
if (!user) { if (!user) {
wsyserror(_("could not get password entry for UID %i"), getuid()); werror(_("could not get password entry for UID %i"), getuid());
return "/"; return "/";
} }
if (!user->pw_dir) { if (!user->pw_dir) {
@@ -59,7 +59,7 @@ static char *getuserhomedir(const char *username)
user = getpwnam(username); user = getpwnam(username);
if (!user) { if (!user) {
wsyserror(_("could not get password entry for user %s"), username); werror(_("could not get password entry for user %s"), username);
return NULL; return NULL;
} }
if (!user->pw_dir) { if (!user->pw_dir) {
@@ -175,7 +175,7 @@ char *wexpandpath(char *path)
error: error:
errno = ENAMETOOLONG; 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 */ /* FIXME: too many functions handle a return value of NULL incorrectly */
exit(1); exit(1);
} }

View File

@@ -1496,14 +1496,14 @@ WMPropList *WMReadPropListFromFile(char *file)
f = fopen(file, "rb"); f = fopen(file, "rb");
if (!f) { if (!f) {
/* let the user print the error message if he really needs to */ /* 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; return NULL;
} }
if (stat(file, &stbuf) == 0) { if (stat(file, &stbuf) == 0) {
length = (size_t) stbuf.st_size; length = (size_t) stbuf.st_size;
} else { } else {
wsyserror(_("could not get size for file '%s'"), file); werror(_("could not get size for file '%s'"), file);
fclose(f); fclose(f);
return NULL; return NULL;
} }
@@ -1516,7 +1516,7 @@ WMPropList *WMReadPropListFromFile(char *file)
if (fread(pldata->ptr, length, 1, f) != 1) { if (fread(pldata->ptr, length, 1, f) != 1) {
if (ferror(f)) { if (ferror(f)) {
wsyserror(_("error reading from file '%s'"), file); werror(_("error reading from file '%s'"), file);
} }
plist = NULL; plist = NULL;
goto cleanup; goto cleanup;
@@ -1567,7 +1567,7 @@ Bool WMWritePropListToFile(WMPropList * plist, char *path)
#ifdef HAVE_MKSTEMP #ifdef HAVE_MKSTEMP
if ((fd = mkstemp(thePath)) < 0) { if ((fd = mkstemp(thePath)) < 0) {
wsyserror(_("mkstemp (%s) failed"), thePath); werror(_("mkstemp (%s) failed"), thePath);
goto failure; goto failure;
} }
mask = umask(0); mask = umask(0);
@@ -1578,21 +1578,21 @@ Bool WMWritePropListToFile(WMPropList * plist, char *path)
} }
#else #else
if (mktemp(thePath) == NULL) { if (mktemp(thePath) == NULL) {
wsyserror(_("mktemp (%s) failed"), thePath); werror(_("mktemp (%s) failed"), thePath);
goto failure; goto failure;
} }
theFile = fopen(thePath, "wb"); theFile = fopen(thePath, "wb");
#endif #endif
if (theFile == NULL) { if (theFile == NULL) {
wsyserror(_("open (%s) failed"), thePath); werror(_("open (%s) failed"), thePath);
goto failure; goto failure;
} }
desc = indentedDescription(plist, 0); desc = indentedDescription(plist, 0);
if (fprintf(theFile, "%s\n", desc) != strlen(desc) + 1) { 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); wfree(desc);
goto failure; goto failure;
} }
@@ -1601,7 +1601,7 @@ Bool WMWritePropListToFile(WMPropList * plist, char *path)
(void)fsync(fileno(theFile)); (void)fsync(fileno(theFile));
if (fclose(theFile) != 0) { if (fclose(theFile) != 0) {
wsyserror(_("fclose (%s) failed"), thePath); werror(_("fclose (%s) failed"), thePath);
goto failure; 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 * real file. Also, we need to try to retain the file attributes of
* the original file we are overwriting (if we are) */ * the original file we are overwriting (if we are) */
if (rename(thePath, path) != 0) { if (rename(thePath, path) != 0) {
wsyserror(_("rename ('%s' to '%s') failed"), thePath, path); werror(_("rename ('%s' to '%s') failed"), thePath, path);
goto failure; goto failure;
} }
@@ -1679,7 +1679,7 @@ int wmkdirhier(const char *path)
strncpy(buf, thePath, p); strncpy(buf, thePath, p);
if (mkdir(buf, 0777) == -1 && errno == EEXIST && if (mkdir(buf, 0777) == -1 && errno == EEXIST &&
stat(buf, &st) == 0 && !S_ISDIR(st.st_mode)) { 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); wfree(thePath);
return 0; return 0;
} }

View File

@@ -1144,7 +1144,7 @@ static void readConfiguration(W_ColorPanel * panel)
if (stat(panel->configurationPath, &stat_buf) != 0) { if (stat(panel->configurationPath, &stat_buf) != 0) {
if (mkdir(panel->configurationPath, S_IRWXU | S_IRGRP | S_IROTH | S_IXGRP | S_IXOTH) != 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); " to store configurations"), panel->configurationPath);
WMSetPopUpButtonEnabled(panel->customPaletteMenuBtn, False); WMSetPopUpButtonEnabled(panel->customPaletteMenuBtn, False);
WMSetPopUpButtonEnabled(panel->colorListColorMenuBtn, False); WMSetPopUpButtonEnabled(panel->colorListColorMenuBtn, False);
@@ -2955,7 +2955,7 @@ static void customPaletteMenuNewFromFile(W_ColorPanel * panel)
WMRunAlertPanel(scr, panel->win, _("File Error"), WMRunAlertPanel(scr, panel->win, _("File Error"),
_("Invalid file format !"), _("OK"), NULL, NULL); _("Invalid file format !"), _("OK"), NULL, NULL);
if (i != 0) { if (i != 0) {
wsyserror(_("can't remove file %s"), tmp); werror(_("can't remove file %s"), tmp);
WMRunAlertPanel(scr, panel->win, _("File Error"), WMRunAlertPanel(scr, panel->win, _("File Error"),
_("Couldn't remove file from Configuration Directory !"), _("Couldn't remove file from Configuration Directory !"),
_("OK"), NULL, NULL); _("OK"), NULL, NULL);
@@ -3031,7 +3031,7 @@ static void customPaletteMenuRename(W_ColorPanel * panel)
} }
if (rename(fromPath, toPath) != 0) 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 { else {
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item); WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
WMInsertPopUpButtonItem(panel->customPaletteHistoryBtn, item, toName); WMInsertPopUpButtonItem(panel->customPaletteHistoryBtn, item, toName);
@@ -3078,7 +3078,7 @@ static void customPaletteMenuRemove(W_ColorPanel * panel)
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item); WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
} else { } else {
wsyserror(_("Couldn't remove palette %s\n"), tmp); werror(_("Couldn't remove palette %s\n"), tmp);
} }
wfree(tmp); wfree(tmp);
@@ -3347,14 +3347,14 @@ static int fetchFile(char *toPath, char *srcFile, char *destFile)
RETRY( src = fopen(srcFile, "rb") ) RETRY( src = fopen(srcFile, "rb") )
if (src == NULL) { if (src == NULL) {
wsyserror(_("Could not open %s"), srcFile); werror(_("Could not open %s"), srcFile);
return -1; return -1;
} }
dstpath = wstrconcat(toPath, destFile); dstpath = wstrconcat(toPath, destFile);
RETRY( dst = fopen(dstpath, "wb") ) RETRY( dst = fopen(dstpath, "wb") )
if (dst == NULL) { if (dst == NULL) {
wsyserror(_("Could not create %s"), dstpath); werror(_("Could not create %s"), dstpath);
wfree(dstpath); wfree(dstpath);
RETRY( fclose(src) ) RETRY( fclose(src) )
return -1; return -1;

View File

@@ -395,7 +395,7 @@ static void dumpRImage(char *path, RImage * image)
f = fopen(path, "wb"); f = fopen(path, "wb");
if (!f) { if (!f) {
wsyserror(path); werror(path);
return; return;
} }
fprintf(f, "%02x%02x%1x", image->width, image->height, channels); fprintf(f, "%02x%02x%1x", image->width, image->height, channels);
@@ -404,7 +404,7 @@ static void dumpRImage(char *path, RImage * image)
fsync(fileno(f)); fsync(fileno(f));
if (fclose(f) < 0) { if (fclose(f) < 0) {
wsyserror(path); werror(path);
} }
} }
@@ -1027,7 +1027,7 @@ static void deleteTexture(WMWidget * w, void *data)
WMReleasePropList(titem->prop); WMReleasePropList(titem->prop);
if (titem->path) { if (titem->path) {
if (remove(titem->path) < 0 && errno != ENOENT) { 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); wfree(titem->path);
} }
@@ -1572,7 +1572,7 @@ static void createPanel(Panel * p)
if (access(panel->fprefix, F_OK) != 0) { if (access(panel->fprefix, F_OK) != 0) {
if (mkdir(panel->fprefix, 0755) < 0) { if (mkdir(panel->fprefix, 0755) < 0) {
wsyserror(panel->fprefix); werror(panel->fprefix);
ok = False; ok = False;
} }
} }
@@ -1582,7 +1582,7 @@ static void createPanel(Panel * p)
panel->fprefix = tmp; panel->fprefix = tmp;
if (access(panel->fprefix, F_OK) != 0) { if (access(panel->fprefix, F_OK) != 0) {
if (mkdir(panel->fprefix, 0755) < 0) { if (mkdir(panel->fprefix, 0755) < 0) {
wsyserror(panel->fprefix); werror(panel->fprefix);
} }
} }
} }

View File

@@ -656,7 +656,7 @@ static void storeCommandInScript(char *cmd, char *line)
if (!f) { if (!f) {
f = fopen(path, "wb"); f = fopen(path, "wb");
if (!f) { if (!f) {
wsyserror(_("could not create %s"), path); werror(_("could not create %s"), path);
goto end; goto end;
} }
fprintf(f, "#!/bin/sh\n"); fprintf(f, "#!/bin/sh\n");
@@ -671,7 +671,7 @@ static void storeCommandInScript(char *cmd, char *line)
tmppath = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart.tmp"); tmppath = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart.tmp");
fo = fopen(tmppath, "wb"); fo = fopen(tmppath, "wb");
if (!fo) { if (!fo) {
wsyserror(_("could not create temporary file %s"), tmppath); werror(_("could not create temporary file %s"), tmppath);
wfree(tmppath); wfree(tmppath);
goto end; goto end;
} }
@@ -704,7 +704,7 @@ static void storeCommandInScript(char *cmd, char *line)
fclose(fo); fclose(fo);
if (rename(tmppath, path) != 0) { 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); wfree(tmppath);
} }

View File

@@ -79,7 +79,7 @@ static pid_t downloadFile(WMScreen * scr, _Panel * panel, char *file)
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
wsyserror("could not fork() process"); werror("could not fork() process");
WMRunAlertPanel(scr, GetWindow(panel), _("Error"), WMRunAlertPanel(scr, GetWindow(panel), _("Error"),
"Could not start download. fork() failed", _("OK"), NULL, NULL); "Could not start download. fork() failed", _("OK"), NULL, NULL);

View File

@@ -675,7 +675,7 @@ static void loadConfigurations(WMScreen * scr, WMWindow * mainw)
wfree(command); wfree(command);
} }
if (!file || !fgets(buffer, 1023, file)) { 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.")); wfatal(_("Make sure wmaker is in your search path."));
WMRunAlertPanel(scr, mainw, _("Error"), WMRunAlertPanel(scr, mainw, _("Error"),
@@ -719,7 +719,7 @@ static void loadConfigurations(WMScreen * scr, WMWindow * mainw)
wfree(command); wfree(command);
} }
if (!file || !fgets(buffer, 1023, file)) { 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); exit(1);
} else { } else {
char *ptr; char *ptr;

View File

@@ -2667,7 +2667,7 @@ static int setWorkspaceSpecificBack(WScreen * scr, WDefaultEntry * entry, WMProp
return 0; return 0;
if (pipe(filedes) < 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); WMReleasePropList(value);
return 0; return 0;
@@ -2675,11 +2675,11 @@ static int setWorkspaceSpecificBack(WScreen * scr, WDefaultEntry * entry, WMProp
pid = fork(); pid = fork();
if (pid < 0) { 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) if (close(filedes[0]) < 0)
wsyserror("could not close pipe"); werror("could not close pipe");
if (close(filedes[1]) < 0) if (close(filedes[1]) < 0)
wsyserror("could not close pipe"); werror("could not close pipe");
} else if (pid == 0) { } else if (pid == 0) {
char *dither; char *dither;
@@ -2687,24 +2687,24 @@ static int setWorkspaceSpecificBack(WScreen * scr, WDefaultEntry * entry, WMProp
SetupEnvironment(scr); SetupEnvironment(scr);
if (close(0) < 0) if (close(0) < 0)
wsyserror("could not close pipe"); werror("could not close pipe");
if (dup(filedes[0]) < 0) { 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"; dither = wPreferences.no_dithering ? "-m" : "-d";
if (wPreferences.smooth_workspace_back) if (wPreferences.smooth_workspace_back)
execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither, NULL); execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither, NULL);
else else
execlp("wmsetbg", "wmsetbg", "-helper", dither, NULL); execlp("wmsetbg", "wmsetbg", "-helper", dither, NULL);
wsyserror("could not execute wmsetbg"); werror("could not execute wmsetbg");
exit(1); exit(1);
} else { } else {
if (fcntl(filedes[0], F_SETFD, FD_CLOEXEC) < 0) { 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) { 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]; scr->helper_fd = filedes[1];

View File

@@ -1551,7 +1551,7 @@ int wShowCrashingDialogPanel(int whatSig)
scr = WMCreateScreen(dpy, screen_no); scr = WMCreateScreen(dpy, screen_no);
if (!scr) { if (!scr) {
wsyserror(_("cannot open connection for crashing dialog panel. Aborting.")); werror(_("cannot open connection for crashing dialog panel. Aborting."));
return WMAbort; return WMAbort;
} }

View File

@@ -448,7 +448,7 @@ static char *getnameforicon(WWindow * wwin)
if (access(path, F_OK) != 0) { if (access(path, F_OK) != 0) {
if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR)) { 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(path);
wfree(suffix); wfree(suffix);
return NULL; return NULL;
@@ -457,7 +457,7 @@ static char *getnameforicon(WWindow * wwin)
strcat(path, "/CachedPixmaps"); strcat(path, "/CachedPixmaps");
if (access(path, F_OK) != 0) { if (access(path, F_OK) != 0) {
if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 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(path);
wfree(suffix); wfree(suffix);
return NULL; return NULL;

View File

@@ -309,7 +309,7 @@ void Restart(char *manager, Bool abortOnFailure)
wfatal(_("failed to restart Window Maker.")); wfatal(_("failed to restart Window Maker."));
} else { } else {
execvp(prog, argv); execvp(prog, argv);
wsyserror(_("could not exec %s"), prog); werror(_("could not exec %s"), prog);
} }
if (abortOnFailure) if (abortOnFailure)
exit(7); exit(7);
@@ -388,10 +388,10 @@ void ExecuteShellCommand(WScreen * scr, char *command)
setsid(); setsid();
#endif #endif
execl(shell, shell, "-c", command, NULL); 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); Exit(-1);
} else if (pid < 0) { } else if (pid < 0) {
wsyserror("cannot fork a new process"); werror("cannot fork a new process");
} else { } else {
_tuple *data = wmalloc(sizeof(_tuple)); _tuple *data = wmalloc(sizeof(_tuple));
@@ -517,7 +517,7 @@ static void execInitScript()
if (file) { if (file) {
if (system(file) != 0) { if (system(file) != 0) {
wsyserror(_("%s:could not execute initialization script"), file); werror(_("%s:could not execute initialization script"), file);
} }
wfree(file); wfree(file);
} }
@@ -535,7 +535,7 @@ void ExecExitScript()
if (file) { if (file) {
if (system(file) != 0) { if (system(file) != 0) {
wsyserror(_("%s:could not execute exit script"), file); werror(_("%s:could not execute exit script"), file);
} }
wfree(file); wfree(file);
} }
@@ -754,7 +754,7 @@ static int real_main(int argc, char **argv)
} }
if (fcntl(ConnectionNumber(dpy), F_SETFD, FD_CLOEXEC) < 0) { 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); exit(1);
} }

View File

@@ -79,7 +79,7 @@ static char *username(void)
user = getpwuid(getuid()); user = getpwuid(getuid());
if (!user) { if (!user) {
wsyserror(_("could not get password entry for UID %i"), getuid()); werror(_("could not get password entry for UID %i"), getuid());
return NULL; return NULL;
} }
if (!user->pw_name) { if (!user->pw_name) {
@@ -1013,7 +1013,7 @@ void SendHelperMessage(WScreen * scr, char type, int workspace, char *msg)
strcpy(&buffer[i], msg); strcpy(&buffer[i], msg);
if (write(scr->helper_fd, buffer, len + 4) < 0) { 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); wfree(buffer);
} }

View File

@@ -56,7 +56,7 @@ int showCrashDialog(int sig)
XCloseDisplay(dpy); XCloseDisplay(dpy);
dpy = NULL; dpy = NULL;
} else { } else {
wsyserror(_("cannot open connection for crashing dialog panel. Aborting.")); werror(_("cannot open connection for crashing dialog panel. Aborting."));
crashAction = WMAbort; crashAction = WMAbort;
} }
@@ -98,16 +98,16 @@ int MonitorLoop(int argc, char **argv)
pid = fork(); pid = fork();
if (pid == 0) { if (pid == 0) {
execvp(child_argv[0], child_argv); execvp(child_argv[0], child_argv);
wsyserror(_("Error respawning Window Maker")); werror(_("Error respawning Window Maker"));
exit(1); exit(1);
} else if (pid < 0) { } else if (pid < 0) {
wsyserror(_("Error respawning Window Maker")); werror(_("Error respawning Window Maker"));
exit(1); exit(1);
} }
do { do {
if ((exited = waitpid(-1, &status, 0)) < 0) { 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; error = True;
break; break;
} }

View File

@@ -636,7 +636,7 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry)
if (first < 0) if (first < 0)
first = i; first = i;
} else { } else {
wsyserror(_("%s:could not stat menu"), path[i]); werror(_("%s:could not stat menu"), path[i]);
/*goto finish; */ /*goto finish; */
} }
@@ -644,7 +644,7 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry)
} }
if (first < 0) { 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; goto finish;
} }
stat(path[first], &stat_buf); stat(path[first], &stat_buf);
@@ -1082,7 +1082,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
wfree(args); wfree(args);
file = popen(command, "r"); file = popen(command, "r");
if (!file) { if (!file) {
wsyserror(_("%s:could not open/preprocess menu file"), file_name); werror(_("%s:could not open/preprocess menu file"), file_name);
} else { } else {
cpp = 1; cpp = 1;
} }
@@ -1093,7 +1093,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
if (!file) { if (!file) {
file = fopen(file_name, "rb"); file = fopen(file_name, "rb");
if (!file) { if (!file) {
wsyserror(_("%s:could not open menu file"), file_name); werror(_("%s:could not open menu file"), file_name);
return NULL; return NULL;
} }
} }
@@ -1127,7 +1127,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
#ifdef CPP #ifdef CPP
if (cpp) { if (cpp) {
if (pclose(file) == -1) { if (pclose(file) == -1) {
wsyserror(_("error reading preprocessed menu data")); werror(_("error reading preprocessed menu data"));
} }
} else { } else {
fclose(file); fclose(file);
@@ -1178,7 +1178,7 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
wfree(args); wfree(args);
file = popen(command, "r"); file = popen(command, "r");
if (!file) { if (!file) {
wsyserror(_("%s:could not open/preprocess menu file"), filename); werror(_("%s:could not open/preprocess menu file"), filename);
} else { } else {
cpp = 1; cpp = 1;
} }
@@ -1190,7 +1190,7 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
file = popen(filename, "rb"); file = popen(filename, "rb");
if (!file) { if (!file) {
wsyserror(_("%s:could not open menu file"), filename); werror(_("%s:could not open menu file"), filename);
return NULL; 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); buffer = malloc(strlen(path[i]) + strlen(dentry->d_name) + 4);
if (!buffer) { 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; break;
} }
@@ -1306,7 +1306,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
strcat(buffer, dentry->d_name); strcat(buffer, dentry->d_name);
if (stat(buffer, &stat_buf) != 0) { 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); path[i], dentry->d_name);
} else { } else {
Bool isFilePack = False; Bool isFilePack = False;
@@ -1369,7 +1369,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
length += strlen(command) + 6; length += strlen(command) + 6;
buffer = malloc(length); buffer = malloc(length);
if (!buffer) { 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; break;
} }
@@ -1408,7 +1408,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
buffer = malloc(length); buffer = malloc(length);
if (!buffer) { 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; break;
} }
@@ -1501,13 +1501,13 @@ static WMenu *configureMenu(WScreen * scr, WMPropList * definition)
} }
if (!path) { 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); wfree(tmp);
return NULL; return NULL;
} }
if (stat(path, &stat_buf) < 0) { 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(path);
wfree(tmp); wfree(tmp);
return NULL; return NULL;

View File

@@ -1010,7 +1010,7 @@ void wScreenSaveState(WScreen * scr)
str = wdefaultspathfordomain(buf); str = wdefaultspathfordomain(buf);
} }
if (!WMWritePropListToFile(scr->session_state, str)) { 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); wfree(str);
WMReleasePropList(old_state); WMReleasePropList(old_state);

View File

@@ -201,13 +201,13 @@ void copyFile(char *dir, char *file)
RETRY( dst = fopen(dstpath, "wb") ) RETRY( dst = fopen(dstpath, "wb") )
if (dst == NULL) { if (dst == NULL) {
wsyserror(_("Could not create %s"), dstpath); werror(_("Could not create %s"), dstpath);
goto err; goto err;
} }
RETRY( src = fopen(file, "rb") ) RETRY( src = fopen(file, "rb") )
if (src == NULL) { if (src == NULL) {
wsyserror(_("Could not open %s"), file); werror(_("Could not open %s"), file);
goto err; goto err;
} }

View File

@@ -883,7 +883,7 @@ void helperLoop(RContext * rc)
/* get length of message */ /* get length of message */
if (readmsg(0, buffer, 4) < 0) { if (readmsg(0, buffer, 4) < 0) {
wsyserror("error reading message from Window Maker"); werror("error reading message from Window Maker");
errcount--; errcount--;
if (errcount == 0) { if (errcount == 0) {
wfatal("quitting"); wfatal("quitting");
@@ -897,7 +897,7 @@ void helperLoop(RContext * rc)
/* get message */ /* get message */
if (readmsg(0, buffer, size) < 0) { if (readmsg(0, buffer, size) < 0) {
wsyserror("error reading message from Window Maker"); werror("error reading message from Window Maker");
errcount--; errcount--;
if (errcount == 0) { if (errcount == 0) {
wfatal("quitting"); wfatal("quitting");