mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-12 20:05:48 +01:00
committed by
Carlos R. Mafra
parent
091c9c366d
commit
ae8937e152
@@ -43,36 +43,36 @@ void __wmessage(int type, void *extra, const char *msg, ...)
|
|||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WMESSAGE_TYPE_WARNING:
|
case WMESSAGE_TYPE_WARNING:
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
|
||||||
_("warning: "));
|
_("warning: "));
|
||||||
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
|
||||||
msg, args);
|
msg, args);
|
||||||
break;
|
break;
|
||||||
case WMESSAGE_TYPE_FATAL:
|
case WMESSAGE_TYPE_FATAL:
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
|
||||||
_("fatal error: "));
|
_("fatal error: "));
|
||||||
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
|
||||||
msg, args);
|
msg, args);
|
||||||
break;
|
break;
|
||||||
case WMESSAGE_TYPE_WSYSERROR:
|
case WMESSAGE_TYPE_WSYSERROR:
|
||||||
case WMESSAGE_TYPE_WSYSERRORWITHCODE:
|
case WMESSAGE_TYPE_WSYSERRORWITHCODE:
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
|
||||||
_("error: "));
|
_("error: "));
|
||||||
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
|
||||||
msg, args);
|
msg, args);
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
|
||||||
": %s", type == WMESSAGE_TYPE_WSYSERROR ?
|
": %s", type == WMESSAGE_TYPE_WSYSERROR ?
|
||||||
strerror(errno) : strerror(*(int *)extra));
|
strerror(errno) : strerror(*(int *)extra));
|
||||||
break;
|
break;
|
||||||
case WMESSAGE_TYPE_MESSAGE:
|
case WMESSAGE_TYPE_MESSAGE:
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ": ");
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1, ": ");
|
||||||
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), msg, args);
|
vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1, msg, args);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
strncat(buf + strlen(buf), "\n", sizeof(buf) - strlen(buf) - 1);
|
strncat(buf + strlen(buf), "\n", sizeof(buf) - strlen(buf));
|
||||||
fputs(buf, stderr);
|
fputs(buf, stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ int main(int argc, char **argv)
|
|||||||
perror(file);
|
perror(file);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strncat(buf, "/style", sizeof(buf) - strlen(buf) - 1);
|
strncat(buf, "/style", sizeof(buf) - strlen(buf));
|
||||||
|
|
||||||
if (stat(buf, &st) != 0 || !S_ISREG(st.st_mode)) { /* maybe symlink too? */
|
if (stat(buf, &st) != 0 || !S_ISREG(st.st_mode)) { /* maybe symlink too? */
|
||||||
printf("%s: %s: style file not found or not a file\n", __progname, buf);
|
printf("%s: %s: style file not found or not a file\n", __progname, buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user