From 581475bc6416790765c498aa3d611f6868ffb64a Mon Sep 17 00:00:00 2001 From: amber Date: Sun, 14 Nov 2004 16:18:26 +0000 Subject: Fixed some file types git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@172 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/showmsg.c | 142 +++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 71 deletions(-) (limited to 'src/common/showmsg.c') diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 06daaa42e..28bf58edc 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -1,71 +1,71 @@ -#include -#include -#include -#include "showmsg.h" - -int _ShowMessage(const char *string, int flag){ // by MC Cameri - /* - _ShowMessage MUST be used instead of printf as of 10/24/2004. - Return: 0 = Successful, 1 = Failed. - */ -// int ret = 0; - char prefix[40]; - char *output; - if (strlen(string) <= 0) { - ShowMessage("Empty string passed to ShowMessage().\n",MSG_ERROR); - return 1; - } - switch (flag) { - case MSG_STATUS: //Bright Green (To inform about good things) - strcpy(prefix,"\033[1;32m[Status]\033[0;0m: "); - break; -/* //Do we really need this now? [MC Cameri] - case MSG_SQL: //Bright Violet (For dumping out anything related with SQL) - strcpy(prefix,"\033[1;35m[SQL]\033[0;0m: "); - break; -*/ - case MSG_INFORMATION: //Bright Blue (Variable information) - strcpy(prefix,"\033[1;34m[Info]\033[0;0m: "); - break; - case MSG_NOTICE: //Bright White (Less than a warning) - strcpy(prefix,"\033[1;29m[Notice]\033[0;0m: "); - break; - case MSG_WARNING: //Bright Yellow - strcpy(prefix,"\033[1;33m[Warning]\033[0;0m: "); - break; - case MSG_ERROR: //Bright Red (Regular errors) - strcpy(prefix,"\033[1;31m[Error]\033[0;0m: "); - break; - case MSG_FATALERROR: //Bright Red (Fatal errors, abort(); if possible) - strcpy(prefix,"\033[1;31m[Fatal Error]\033[0;0m: "); - break; - default: - ShowMessage("In function ShowMessage() -> Invalid flag passed.\n",MSG_ERROR); - return 1; - } - output = (char*)malloc(sizeof(char)*(strlen(prefix)+strlen(string))+1); - if (output == NULL) { - return 1; -// abort(); // Kill server? - } - strcpy(output,prefix); - strcat(output,string); - printf(output); - fflush(stdout); -/* - if ((core_config.debug_output_level > -1) && (flag >= core_config.debug_output_level)) { - FILE *fp; - fp=fopen(OUTPUT_MESSAGES_LOG,"a"); - if (fp == NULL) { - printf("\033[1;31m[Error]\033[0;0m: Could not open \033[1;29m%s\033[0;0m, file not found.\n",OUTPUT_MESSAGES_LOG); - fflush(stdout); - return; - } - StripColor(output); - strcpy(output,"\r"); - fwrite(output,strlen(output),1,fp); - fclose(fp); - } -*/ - return 0; -} +#include +#include +#include +#include "showmsg.h" + +int _ShowMessage(const char *string, int flag){ // by MC Cameri + /* + _ShowMessage MUST be used instead of printf as of 10/24/2004. + Return: 0 = Successful, 1 = Failed. + */ +// int ret = 0; + char prefix[40]; + char *output; + if (strlen(string) <= 0) { + ShowMessage("Empty string passed to ShowMessage().\n",MSG_ERROR); + return 1; + } + switch (flag) { + case MSG_STATUS: //Bright Green (To inform about good things) + strcpy(prefix,"\033[1;32m[Status]\033[0;0m: "); + break; +/* //Do we really need this now? [MC Cameri] + case MSG_SQL: //Bright Violet (For dumping out anything related with SQL) + strcpy(prefix,"\033[1;35m[SQL]\033[0;0m: "); + break; +*/ + case MSG_INFORMATION: //Bright Blue (Variable information) + strcpy(prefix,"\033[1;34m[Info]\033[0;0m: "); + break; + case MSG_NOTICE: //Bright White (Less than a warning) + strcpy(prefix,"\033[1;29m[Notice]\033[0;0m: "); + break; + case MSG_WARNING: //Bright Yellow + strcpy(prefix,"\033[1;33m[Warning]\033[0;0m: "); + break; + case MSG_ERROR: //Bright Red (Regular errors) + strcpy(prefix,"\033[1;31m[Error]\033[0;0m: "); + break; + case MSG_FATALERROR: //Bright Red (Fatal errors, abort(); if possible) + strcpy(prefix,"\033[1;31m[Fatal Error]\033[0;0m: "); + break; + default: + ShowMessage("In function ShowMessage() -> Invalid flag passed.\n",MSG_ERROR); + return 1; + } + output = (char*)malloc(sizeof(char)*(strlen(prefix)+strlen(string))+1); + if (output == NULL) { + return 1; +// abort(); // Kill server? + } + strcpy(output,prefix); + strcat(output,string); + printf(output); + fflush(stdout); +/* + if ((core_config.debug_output_level > -1) && (flag >= core_config.debug_output_level)) { + FILE *fp; + fp=fopen(OUTPUT_MESSAGES_LOG,"a"); + if (fp == NULL) { + printf("\033[1;31m[Error]\033[0;0m: Could not open \033[1;29m%s\033[0;0m, file not found.\n",OUTPUT_MESSAGES_LOG); + fflush(stdout); + return; + } + StripColor(output); + strcpy(output,"\r"); + fwrite(output,strlen(output),1,fp); + fclose(fp); + } +*/ + return 0; +} -- cgit v1.2.3-70-g09d2