diff options
Diffstat (limited to 'src/common/showmsg.c')
-rw-r--r-- | src/common/showmsg.c | 68 |
1 files changed, 63 insertions, 5 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 5587e8658..da21ad1e6 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -7,7 +7,10 @@ char tmp_output[1024] = {"\0"}; -int _ShowMessage(enum msg_type flag, const char *string, ...){ // by MC Cameri +#undef ShowMessage + +int _vShowMessage(enum msg_type flag, const char *string, va_list ap) +{ // by MC Cameri /* _ShowMessage MUST be used instead of printf as of 10/24/2004. Return: 0 = Successful, 1 = Failed. @@ -15,11 +18,9 @@ int _ShowMessage(enum msg_type flag, const char *string, ...){ // by MC Cameri // int ret = 0; char prefix[40]; char *output; - va_list ap; - va_start(ap, string); if (strlen(string) <= 0) { - ShowError("Empty string passed to _ShowMessage().\n"); + printf("Empty string passed to _ShowMessage().\n"); return 1; } switch (flag) { @@ -48,7 +49,7 @@ int _ShowMessage(enum msg_type flag, const char *string, ...){ // by MC Cameri strcpy(prefix,CL_RED"[Fatal Error]"CL_RESET":"); break; default: - ShowError("In function _ShowMessage() -> Invalid flag passed.\n"); + printf("In function _ShowMessage() -> Invalid flag passed.\n"); return 1; } if (!(flag == MSG_DEBUG && !SHOW_DEBUG_MSG)) { @@ -84,3 +85,60 @@ int _ShowMessage(enum msg_type flag, const char *string, ...){ // by MC Cameri */ return 0; } + +int _ShowMessage(enum msg_type flag, const char *string, ...) +{ + va_list ap; + + va_start(ap, string); + return _vShowMessage(flag, string, ap); +} + +int ShowStatus(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_STATUS, string, ap); +} +int ShowSQL(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_SQL, string, ap); +} +int ShowInfo(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_INFORMATION, string, ap); +} +int ShowNotice(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_NOTICE, string, ap); +} +int ShowWarning(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_WARNING, string, ap); +} +int ShowDebug(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_DEBUG, string, ap); +} +int ShowError(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_ERROR, string, ap); +} +int ShowFatalError(const char *string, ...) { + va_list ap; + + va_start(ap, string); + return _vShowMessage(MSG_FATALERROR, string, ap); +} |