diff options
author | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-04-04 17:45:11 +0000 |
---|---|---|
committer | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-04-04 17:45:11 +0000 |
commit | 2af1c6baaaf4a2f839da26bfd88dd3e629623c79 (patch) | |
tree | 2ab82c35bb2c2221d674d1a0213aa8fd56c60c4d /src/common/showmsg.c | |
parent | a25a0d3cb865e0f4669103884a7fa56767249dd6 (diff) | |
download | hercules-2af1c6baaaf4a2f839da26bfd88dd3e629623c79.tar.gz hercules-2af1c6baaaf4a2f839da26bfd88dd3e629623c79.tar.bz2 hercules-2af1c6baaaf4a2f839da26bfd88dd3e629623c79.tar.xz hercules-2af1c6baaaf4a2f839da26bfd88dd3e629623c79.zip |
Fix show message
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1401 54d463be-8e91-2dee-dedb-b68131a5f0ec
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); +} |