summaryrefslogtreecommitdiff
path: root/src/common/showmsg.c
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-05 14:32:04 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-05 14:32:04 +0000
commit573c40f53e1d0fe29c72117fc4ca2d931b274d8c (patch)
tree1c8afefbc96da8878fc94bfc3edd32486b80875f /src/common/showmsg.c
parent6acbd82fb5b77315853f42a9a31b7439a7e58bb9 (diff)
downloadhercules-573c40f53e1d0fe29c72117fc4ca2d931b274d8c.tar.gz
hercules-573c40f53e1d0fe29c72117fc4ca2d931b274d8c.tar.bz2
hercules-573c40f53e1d0fe29c72117fc4ca2d931b274d8c.tar.xz
hercules-573c40f53e1d0fe29c72117fc4ca2d931b274d8c.zip
* Added SERVER_TYPE to core for future plugins support
* Added support for the UPNP plugin to release port mappings and re-close firewall ports on shutdown * Updated showmsg git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1409 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/showmsg.c')
-rw-r--r--src/common/showmsg.c64
1 files changed, 29 insertions, 35 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index 9901af81b..24d51d2dc 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -5,15 +5,12 @@
char tmp_output[1024] = {"\0"};
-#undef ShowMessage
-
// by MC Cameri
int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
{
// _ShowMessage MUST be used instead of printf as of 10/24/2004.
// Return: 0 = Successful, 1 = Failed.
// int ret = 0;
-// char *output;
char prefix[40];
if (!string || strlen(string) <= 0) {
@@ -21,6 +18,8 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
return 1;
}
switch (flag) {
+ case MSG_NONE: // direct printf replacement
+ break;
case MSG_STATUS: //Bright Green (To inform about good things)
strcpy(prefix,CL_GREEN"[Status]"CL_RESET":");
break;
@@ -49,22 +48,10 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
printf("In function _ShowMessage() -> Invalid flag passed.\n");
return 1;
}
- if (!(flag == MSG_DEBUG && !SHOW_DEBUG_MSG)) {
-
-/* output = (char*)aMalloc(sizeof(char)*(strlen(prefix)+strlen(string)+2)); // prefix+string+two chars(space and \0)
- if (output == NULL) {
- return 1;
-// exit(1); // Kill server? Deadly
- }
- strcpy(output,prefix);
- strcat(output," ");
- strcat(output,string);
- vprintf(output, ap);
- fflush(stdout);
- aFree(output);*/
-
- printf ("%s ", prefix);
+ if (!(flag == MSG_DEBUG && !SHOW_DEBUG_MSG)) {
+ if (flag != MSG_NONE)
+ printf ("%s ", prefix);
vprintf (string, ap);
fflush (stdout);
}
@@ -96,51 +83,58 @@ int _ShowMessage(enum msg_type flag, const char *string, ...)
return _vShowMessage(flag, string, ap);
}
+// direct printf replacement
+int ShowMessage(const char *string, ...) {
+ va_list ap;
+
+ va_start(ap, string);
+ return _vShowMessage(MSG_NONE, string, ap);
+}
int ShowStatus(const char *string, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, string);
- return _vShowMessage(MSG_STATUS, string, ap);
+ return _vShowMessage(MSG_STATUS, string, ap);
}
int ShowSQL(const char *string, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, string);
- return _vShowMessage(MSG_SQL, string, ap);
+ return _vShowMessage(MSG_SQL, string, ap);
}
int ShowInfo(const char *string, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, string);
- return _vShowMessage(MSG_INFORMATION, string, ap);
+ return _vShowMessage(MSG_INFORMATION, string, ap);
}
int ShowNotice(const char *string, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, string);
- return _vShowMessage(MSG_NOTICE, string, ap);
+ return _vShowMessage(MSG_NOTICE, string, ap);
}
int ShowWarning(const char *string, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, string);
- return _vShowMessage(MSG_WARNING, string, ap);
+ return _vShowMessage(MSG_WARNING, string, ap);
}
int ShowDebug(const char *string, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, string);
- return _vShowMessage(MSG_DEBUG, string, ap);
+ return _vShowMessage(MSG_DEBUG, string, ap);
}
int ShowError(const char *string, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, string);
- return _vShowMessage(MSG_ERROR, string, ap);
+ return _vShowMessage(MSG_ERROR, string, ap);
}
int ShowFatalError(const char *string, ...) {
- va_list ap;
-
+ va_list ap;
+
va_start(ap, string);
- return _vShowMessage(MSG_FATALERROR, string, ap);
+ return _vShowMessage(MSG_FATALERROR, string, ap);
}