summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-04 18:06:30 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-04 18:06:30 +0000
commit26bf6b6dacd8029a1ed48255518a78dfb11b4ce4 (patch)
tree4e5393d36537864cda07c24cbb8cb292bbb6fd48 /src/common
parent7bccd07dda59813abd5173237718953943e9803b (diff)
downloadhercules-26bf6b6dacd8029a1ed48255518a78dfb11b4ce4.tar.gz
hercules-26bf6b6dacd8029a1ed48255518a78dfb11b4ce4.tar.bz2
hercules-26bf6b6dacd8029a1ed48255518a78dfb11b4ce4.tar.xz
hercules-26bf6b6dacd8029a1ed48255518a78dfb11b4ce4.zip
* Updated showmsg with Shinomori's improvements
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1404 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/showmsg.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index da21ad1e6..9901af81b 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -1,25 +1,22 @@
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "showmsg.h"
-#include "malloc.h"
char tmp_output[1024] = {"\0"};
#undef ShowMessage
+// by MC Cameri
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.
- */
+{
+ // _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];
- char *output;
- if (strlen(string) <= 0) {
+ if (!string || strlen(string) <= 0) {
printf("Empty string passed to _ShowMessage().\n");
return 1;
}
@@ -49,11 +46,12 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
strcpy(prefix,CL_RED"[Fatal Error]"CL_RESET":");
break;
default:
- printf("In function _ShowMessage() -> Invalid flag passed.\n");
+ 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)
+
+/* 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
@@ -64,7 +62,11 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
strcat(output,string);
vprintf(output, ap);
fflush(stdout);
- aFree(output);
+ aFree(output);*/
+
+ printf ("%s ", prefix);
+ vprintf (string, ap);
+ fflush (stdout);
}
va_end(ap);
@@ -86,7 +88,7 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
return 0;
}
-int _ShowMessage(enum msg_type flag, const char *string, ...)
+int _ShowMessage(enum msg_type flag, const char *string, ...)
{
va_list ap;