mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
- Added a global var WErrorCode similar to errno or RErrorCode.
- New function wsyserrorwithcode(), like wsyserror() for prints the message for the specified error code, instead of errno. This is for cases where you can't call wsyserror() immediately after the error, but save errno code for a later use.
This commit is contained in:
@@ -34,6 +34,10 @@ changes since wmaker 0.61.1:
|
|||||||
2. if new_size is 0, call wfree(old), and return NULL.
|
2. if new_size is 0, call wfree(old), and return NULL.
|
||||||
3. if both old is a valid pointer and new_size>0, call realloc.
|
3. if both old is a valid pointer and new_size>0, call realloc.
|
||||||
- added wstrerror(int errnum) to return the string associated with errnum.
|
- added wstrerror(int errnum) to return the string associated with errnum.
|
||||||
|
- added a global var WErrorCode which can hold various error codes
|
||||||
|
(similar to errno or RErrorCode).
|
||||||
|
- new wsyserrorwithcode(int error, const char* fmt, ...), similar to
|
||||||
|
wsyserror(), but printing the message for the specified error code.
|
||||||
|
|
||||||
changes since wmaker 0.61.0:
|
changes since wmaker 0.61.0:
|
||||||
............................
|
............................
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ char *wstrerror(int errnum);
|
|||||||
void wfatal(const char *msg, ...);
|
void wfatal(const char *msg, ...);
|
||||||
void wwarning(const char *msg, ...);
|
void wwarning(const char *msg, ...);
|
||||||
void wsyserror(const char *msg, ...);
|
void wsyserror(const char *msg, ...);
|
||||||
|
void wsyserrorwithcode(int error, const char *msg, ...);
|
||||||
|
|
||||||
char *wfindfile(char *paths, char *file);
|
char *wfindfile(char *paths, char *file);
|
||||||
|
|
||||||
@@ -359,6 +360,13 @@ proplist_t WMGetUDSearchList(WMUserDefaults *database);
|
|||||||
|
|
||||||
void WMSetUDSearchList(WMUserDefaults *database, proplist_t list);
|
void WMSetUDSearchList(WMUserDefaults *database, proplist_t list);
|
||||||
|
|
||||||
|
|
||||||
|
/****** Global Variables *******/
|
||||||
|
|
||||||
|
extern int WErrorCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
extern char *_WINGS_progname;
|
extern char *_WINGS_progname;
|
||||||
|
|
||||||
|
int WErrorCode = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAXLINE 1024
|
#define MAXLINE 1024
|
||||||
|
|
||||||
|
|
||||||
@@ -142,3 +146,33 @@ wsyserror(const char *msg, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* Prints a system error message with variable arguments, being given
|
||||||
|
* the error code.
|
||||||
|
*
|
||||||
|
* error - the error code foe which to print the message
|
||||||
|
* msg - message to print with optional formatting
|
||||||
|
* ... - arguments to use on formatting
|
||||||
|
*********************************************************************/
|
||||||
|
void
|
||||||
|
wsyserrorwithcode(int error, const char *msg, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char buf[MAXLINE];
|
||||||
|
|
||||||
|
va_start(args, msg);
|
||||||
|
vsprintf(buf, msg, args);
|
||||||
|
fflush(stdout);
|
||||||
|
fputs(_WINGS_progname, stderr);
|
||||||
|
fputs(" error: ", stderr);
|
||||||
|
strcat(buf, ": ");
|
||||||
|
strcat(buf, wstrerror(error));
|
||||||
|
strcat(buf,"\n");
|
||||||
|
fputs(buf, stderr);
|
||||||
|
fflush(stderr);
|
||||||
|
fflush(stdout);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user