summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-17 17:20:01 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-17 17:20:01 +0000
commita4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d (patch)
tree75dde2edb2807cb44b6ea17cd2f405ad66399716 /src
parent8982c119eaaa031bbdd70798a077c14b5bc183c1 (diff)
downloadhercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.tar.gz
hercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.tar.bz2
hercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.tar.xz
hercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.zip
Using predefined constants as parameters to the exit() function.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11501 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c6
-rw-r--r--src/char/int_guild.c8
-rw-r--r--src/char/int_homun.c2
-rw-r--r--src/char/int_party.c2
-rw-r--r--src/char/int_pet.c2
-rw-r--r--src/char/int_storage.c4
-rw-r--r--src/char/inter.c2
-rw-r--r--src/char_sql/int_party.c2
-rw-r--r--src/char_sql/inter.c6
-rw-r--r--src/common/core.c2
-rw-r--r--src/common/grfio.c4
-rw-r--r--src/common/malloc.c20
-rw-r--r--src/common/mapindex.c2
-rw-r--r--src/common/socket.c12
-rw-r--r--src/ladmin/ladmin.c4
-rw-r--r--src/login_sql/login.c2
-rw-r--r--src/map/chrif.c4
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/map.c14
-rw-r--r--src/map/npc.c10
-rw-r--r--src/map/party.c2
-rw-r--r--src/map/path.c2
-rw-r--r--src/map/pc.c2
-rw-r--r--src/tool/grfio.c4
-rw-r--r--src/tool/mapcache.c4
-rw-r--r--src/txt-converter/login-converter.c4
26 files changed, 66 insertions, 66 deletions
diff --git a/src/char/char.c b/src/char/char.c
index d56c79b28..c99c1e3c4 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1003,7 +1003,7 @@ int mmo_char_init(void)
if (!char_dat) {
ShowFatalError("Out of memory: mmo_char_init (realloc of char_dat).\n");
char_log("Out of memory: mmo_char_init (realloc of char_dat).\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -1227,7 +1227,7 @@ int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, i
if (!char_dat) {
ShowFatalError("Out of memory: make_new_char (realloc of char_dat).\n");
char_log("Out of memory: make_new_char (realloc of char_dat).\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -1993,7 +1993,7 @@ int parse_fromlogin(int fd)
ShowError("The server communication passwords (default s1/p1) are probably invalid.\n");
ShowInfo("Also, please make sure your accounts file (default: accounts.txt) has those values present.\n");
ShowInfo("The communication passwords can be changed in map_athena.conf and char_athena.conf\n");
- //exit(1); //fixed for server shutdown.
+ //exit(EXIT_FAILURE); //fixed for server shutdown.
} else {
ShowStatus("Connected to login-server (connection #%d).\n", fd);
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 52514692c..2bf3e0a41 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -391,7 +391,7 @@ int inter_guild_init() {
g = (struct guild *) aCalloc(sizeof(struct guild), 1);
if(g == NULL){
ShowFatalError("int_guild: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
// memset(g, 0, sizeof(struct guild)); not needed...
if (inter_guild_fromstr(line, g) == 0 && g->guild_id > 0) {
@@ -420,7 +420,7 @@ int inter_guild_init() {
gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1);
if(gc == NULL){
ShowFatalError("int_guild: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
// memset(gc, 0, sizeof(struct guild_castle)); No need...
if (inter_guildcastle_fromstr(line, gc) == 0) {
@@ -439,7 +439,7 @@ int inter_guild_init() {
gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1);
if (gc == NULL) {
ShowFatalError("int_guild: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
gc->castle_id = i;
idb_put(castle_db, gc->castle_id, gc);
@@ -979,7 +979,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem
if (g == NULL) {
ShowFatalError("int_guild: CreateGuild: out of memory !\n");
mapif_guild_created(fd, account_id, NULL);
- exit(0);
+ exit(EXIT_FAILURE);
}
// memset(g, 0, sizeof(struct guild)); Meh...
g->guild_id = guild_newid++;
diff --git a/src/char/int_homun.c b/src/char/int_homun.c
index 35f8f9c50..62b5a78a1 100644
--- a/src/char/int_homun.c
+++ b/src/char/int_homun.c
@@ -127,7 +127,7 @@ int inter_homun_init()
p = (struct s_homunculus*)aCalloc(sizeof(struct s_homunculus), 1);
if(p==NULL){
ShowFatalError("int_homun: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
if(inter_homun_fromstr(line,p)==0 && p->hom_id>0){
if( p->hom_id >= homun_newid)
diff --git a/src/char/int_party.c b/src/char/int_party.c
index 96181cd1b..4e6366807 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -194,7 +194,7 @@ int inter_party_init() {
p = (struct party_data*)aCalloc(sizeof(struct party_data), 1);
if (p == NULL){
ShowFatalError("int_party: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
memset(p, 0, sizeof(struct party_data));
if (inter_party_fromstr(line, &p->party) == 0 && p->party.party_id > 0) {
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index e7ff2aff2..8d0f53472 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -97,7 +97,7 @@ int inter_pet_init()
p = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1);
if(p==NULL){
ShowFatalError("int_pet: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
memset(p,0,sizeof(struct s_pet));
if(inter_pet_fromstr(line,p)==0 && p->pet_id>0){
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index 4d933d257..daee13134 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -211,7 +211,7 @@ int inter_storage_init()
s = (struct storage*)aCalloc(sizeof(struct storage), 1);
if(s==NULL){
ShowFatalError("int_storage: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
// memset(s,0,sizeof(struct storage)); aCalloc does this...
s->account_id=tmp_int;
@@ -240,7 +240,7 @@ int inter_storage_init()
gs = (struct guild_storage*)aCalloc(sizeof(struct guild_storage), 1);
if(gs==NULL){
ShowFatalError("int_storage: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
// memset(gs,0,sizeof(struct guild_storage)); aCalloc...
gs->guild_id=tmp_int;
diff --git a/src/char/inter.c b/src/char/inter.c
index 721017188..f7287eb99 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -118,7 +118,7 @@ int inter_accreg_init(void) {
reg = (struct accreg*)aCalloc(sizeof(struct accreg), 1);
if (reg == NULL) {
ShowFatalError("inter: accreg: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
if (inter_accreg_fromstr(line, reg) == 0 && reg->account_id > 0) {
idb_put(accreg_db, reg->account_id, reg);
diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c
index fd1f0c37c..f5afb1777 100644
--- a/src/char_sql/int_party.c
+++ b/src/char_sql/int_party.c
@@ -273,7 +273,7 @@ int inter_party_sql_init(void)
party_pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1);
if (!party_pt) {
ShowFatalError("inter_party_sql_init: Out of Memory!\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Uncomment the following if you want to do a party_db cleanup (remove parties with no members) on startup.[Skotlex]
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c
index 201605bd6..ab03e102b 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -356,7 +356,7 @@ int inter_init_sql(const char *file)
{
Sql_ShowDebug(sql_handle);
Sql_Free(sql_handle);
- exit(1);
+ exit(EXIT_FAILURE);
}
#ifndef TXT_SQL_CONVERT
else if (inter_sql_test()) {
@@ -371,7 +371,7 @@ int inter_init_sql(const char *file)
Sql_ShowDebug(lsql_handle);
Sql_Free(lsql_handle);
Sql_Free(sql_handle);
- exit(1);
+ exit(EXIT_FAILURE);
}
else
{
@@ -430,7 +430,7 @@ int inter_sql_test (void)
if( lsql_handle )
Sql_Free(lsql_handle);
Sql_Free(sql_handle);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
diff --git a/src/common/core.c b/src/common/core.c
index 15cc90228..49fbcec7d 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -78,7 +78,7 @@ static void sig_proc(int sn)
case SIGINT:
case SIGTERM:
if (++is_called > 3)
- exit(0);
+ exit(EXIT_SUCCESS);
runflag = 0;
break;
case SIGSEGV:
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 4e5da0a6a..ed2b84e3f 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -566,7 +566,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn) - 1) {
ShowFatalError("GRF file name %s is too long\n", fname);
aFree(grf_filelist);
- exit(1);
+ exit(EXIT_FAILURE);
}
srclen = 0;
if ((period_ptr = strrchr(fname, '.')) != NULL) {
@@ -637,7 +637,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn)-1) {
ShowFatalError("GRF file name %s is too long\n", fname);
aFree(grf_filelist);
- exit(1);
+ exit(EXIT_FAILURE);
}
ofs2 = ofs + (int)strlen(fname)+1;
type = grf_filelist[ofs2+12];
diff --git a/src/common/malloc.c b/src/common/malloc.c
index ff71a2c5e..414770156 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -18,7 +18,7 @@ void* aMalloc_(size_t size, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aMalloc error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
@@ -29,7 +29,7 @@ void* aMallocA_(size_t size, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aMallocA %d\n",file,line,func,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aMallocA error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
@@ -40,7 +40,7 @@ void* aCalloc_(size_t num, size_t size, const char *file, int line, const char *
// ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aCalloc error out of memory!\n", file, line, func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -50,7 +50,7 @@ void* aCallocA_(size_t num, size_t size, const char *file, int line, const char
// ShowMessage("%s:%d: in func %s: aCallocA %d %d\n",file,line,func,num,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aCallocA error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -60,7 +60,7 @@ void* aRealloc_(void *p, size_t size, const char *file, int line, const char *fu
// ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aRealloc error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -70,7 +70,7 @@ char* aStrdup_(const char *p, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aStrdup error out of memory!\n", file, line, func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -227,7 +227,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
return (char *)p + sizeof(struct unit_head_large) - sizeof(int);
} else {
ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -288,7 +288,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
// ここに来てはいけない。
ShowFatalError("Memory manager::memmgr_malloc() serious error (allocating %d+%d bytes at %s:%d)\n", sizeof(struct unit_head_large), size, file, line);
memmgr_info();
- exit(1);
+ exit(EXIT_FAILURE);
//return NULL;
};
@@ -485,14 +485,14 @@ static struct block* block_malloc(void)
char *pb = (char *)CALLOC(sizeof(struct block),BLOCK_ALLOC+1,file,line,func);
if(pb == NULL) {
ShowFatalError("Memory manager::block_alloc failed.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
// store original block address in chunk
chunk = (struct chunk *)MALLOC(sizeof(struct chunk),file,line,func);
if (chunk == NULL) {
ShowFatalError("Memory manager::block_alloc failed.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
chunk->block = pb;
chunk->next = (chunk_first) ? chunk_first : NULL;
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 2fa8c9fb8..0c275c41a 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -150,7 +150,7 @@ void mapindex_init(void)
fp=fopen(mapindex_cfgfile,"r");
if(fp==NULL){
ShowFatalError("Unable to read mapindex config file %s!\n", mapindex_cfgfile);
- exit(1); //Server can't really run without this file.
+ exit(EXIT_FAILURE); //Server can't really run without this file.
}
while(fgets(line, sizeof(line), fp))
{
diff --git a/src/common/socket.c b/src/common/socket.c
index c70c0cbaa..6b52dd402 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -297,7 +297,7 @@ int make_listen_bind(uint32 ip, uint16 port)
if (fd == INVALID_SOCKET) {
ShowError("socket() creation failed (code %d)!\n", s_errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ( fd >= FD_SETSIZE ) { //Not enough capacity for this socket
@@ -316,17 +316,17 @@ int make_listen_bind(uint32 ip, uint16 port)
result = bind(fd, (struct sockaddr*)&server_address, sizeof(server_address));
if( result == SOCKET_ERROR ) {
ShowError("bind failed (socket %d, code %d)!\n", fd, s_errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
result = listen( fd, 5 );
if( result == SOCKET_ERROR ) {
ShowError("listen failed (socket %d, code %d)!\n", fd, s_errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ( fd < 0 || fd > FD_SETSIZE )
{ //Crazy error that can happen in Windows? (info from Freya)
ShowFatalError("listen() returned invalid fd %d!\n",fd);
- exit(1);
+ exit(EXIT_FAILURE);
}
if(fd_max <= fd) fd_max = fd + 1;
@@ -469,7 +469,7 @@ int RFIFOSKIP(int fd, size_t len)
if ( s->rdata_size < s->rdata_pos + len ) {
//fprintf(stderr,"too many skip\n");
- //exit(1);
+ //exit(EXIT_FAILURE);
//better than a COMPLETE program abort // TEST! :)
ShowError("too many skip (%d) now skipped: %d (FD: %d)\n", len, RFIFOREST(fd), fd);
len = RFIFOREST(fd);
@@ -494,7 +494,7 @@ int WFIFOSET(int fd, size_t len)
fd, CONVIP(ip), len, s->wdata_size, s->max_wdata);
ShowDebug("Likely command that caused it: 0x%x\n", (*(unsigned short*)(s->wdata + s->wdata_size)));
// no other chance, make a better fifo model
- exit(1);
+ exit(EXIT_FAILURE);
}
s->wdata_size += len;
diff --git a/src/ladmin/ladmin.c b/src/ladmin/ladmin.c
index 025488f33..475bdcdeb 100644
--- a/src/ladmin/ladmin.c
+++ b/src/ladmin/ladmin.c
@@ -3215,7 +3215,7 @@ int prompt(void)
} else {
ShowMessage("Bye.\n");
}
- exit(0);
+ exit(EXIT_SUCCESS);
// unknown command
} else {
if (defaultlanguage == 'F') {
@@ -4199,7 +4199,7 @@ int Connect_login_server(void)
if (login_fd == -1)
{ //Might not be the most elegant way to handle this, but I've never used ladmin so I dunno what else you could do. [Skotlex]
ShowMessage("Error: Failed to connect to Login Server\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
if (passenc == 0) {
WFIFOHEAD(login_fd,28);
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index c64f14fcd..aa80f200a 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -299,7 +299,7 @@ int mmo_auth_sqldb_init(void)
{
Sql_ShowDebug(sql_handle);
Sql_Free(sql_handle);
- exit(1);
+ exit(EXIT_FAILURE);
}
else
{
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 7c24ea25d..ccf92a6cf 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -343,7 +343,7 @@ int chrif_connectack(int fd)
{
if (RFIFOB(fd,2)) {
ShowFatalError("Connection to char-server failed %d.\n", RFIFOB(fd,2));
- exit(1);
+ exit(EXIT_FAILURE);
}
ShowStatus("Successfully logged on to Char Server (Connection: '"CL_WHITE"%d"CL_RESET"').\n",fd);
chrif_state = 1;
@@ -368,7 +368,7 @@ int chrif_sendmapack(int fd)
{
if (RFIFOB(fd,2)) {
ShowFatalError("chrif : send map list to char server failed %d\n", RFIFOB(fd,2));
- exit(1);
+ exit(EXIT_FAILURE);
}
memcpy(wisp_server_name, RFIFOP(fd,3), NAME_LENGTH);
diff --git a/src/map/clif.c b/src/map/clif.c
index 02bfe2e95..58db07b2a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11776,7 +11776,7 @@ static int packetdb_readdb(void)
sprintf(line, "%s/packet_db.txt", db_path);
if( (fp=fopen(line,"r"))==NULL ){
ShowFatalError("can't read %s\n", line);
- exit(1);
+ exit(EXIT_FAILURE);
}
clif_config.packet_db_ver = MAX_PACKET_VER;
@@ -11886,7 +11886,7 @@ static int packetdb_readdb(void)
if(str[3]==NULL){
ShowError("packet_db: packet error\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
for(j=0,p2=str[3];p2;j++){
str2[j]=p2;
@@ -11928,7 +11928,7 @@ int do_init_clif(void)
set_defaultparse(clif_parse);
if (!make_listen_bind(bind_ip,map_port)) {
ShowFatalError("can't bind game port\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
add_timer_func_list(clif_waitclose, "clif_waitclose");
diff --git a/src/map/map.c b/src/map/map.c
index 2b9e94b23..0325ff839 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2394,7 +2394,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
if(ip == clif_getip() && port == clif_getport()) {
//That's odd, we received info that we are the ones with this map, but... we don't have it.
ShowFatalError("map_setipport : received info that this map-server SHOULD have map '%s', but it is not loaded.\n",mapindex_id2name(mapindex));
- exit(1);
+ exit(EXIT_FAILURE);
}
mdos->ip = ip;
mdos->port = port;
@@ -2606,7 +2606,7 @@ int map_readallmaps (void)
if( (fp = fopen(map_cache_file, "rb")) == NULL )
{
ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", map_cache_file);
- exit(1); //No use launching server if maps can't be read.
+ exit(EXIT_FAILURE); //No use launching server if maps can't be read.
}
}
@@ -2961,7 +2961,7 @@ int map_sql_init(void)
ShowInfo("Connecting to the Map DB Server....\n");
if( SQL_ERROR == Sql_Connect(mmysql_handle, map_server_id, map_server_pw, map_server_ip, map_server_port, map_server_db) )
- exit(1);
+ exit(EXIT_FAILURE);
ShowStatus("connect success! (Map Server Connection)\n");
if( strlen(default_codepage) > 0 )
@@ -2975,7 +2975,7 @@ int map_sql_init(void)
ShowInfo("Connecting to the Mail DB Server....\n");
if( SQL_ERROR == Sql_Connect(mail_handle, mail_server_id, mail_server_pw, mail_server_ip, mail_server_port, mail_server_db) )
- exit(1);
+ exit(EXIT_FAILURE);
if( strlen(default_codepage) > 0 )
if ( SQL_ERROR == Sql_SetEncoding(mail_handle, default_codepage) )
@@ -3015,7 +3015,7 @@ int log_sql_init(void)
ShowInfo(""CL_WHITE"[SQL]"CL_RESET": Connecting to the Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",log_db,log_db_ip);
if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db) )
- exit(1);
+ exit(EXIT_FAILURE);
ShowStatus(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", log_db);
if( strlen(default_codepage) > 0 )
@@ -3269,7 +3269,7 @@ void map_helpscreen(int flag)
puts(" (SQL Only)");
puts(" --version, --v, -v, /v Displays the server's version");
puts("\n");
- if (flag) exit(1);
+ if (flag) exit(EXIT_FAILURE);
}
/*======================================================
@@ -3285,7 +3285,7 @@ void map_versionscreen(int flag)
puts(CL_GREEN "IRC Channel:" CL_RESET "\tirc://irc.deltaanime.net/#athena");
puts("\nOpen " CL_WHITE "readme.html" CL_RESET " for more information.");
if (ATHENA_RELEASE_FLAG) ShowNotice("This version is not for release.\n");
- if (flag) exit(1);
+ if (flag) exit(EXIT_FAILURE);
}
/*======================================================
diff --git a/src/map/npc.c b/src/map/npc.c
index 177612b50..35515e33c 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -201,10 +201,10 @@ int npc_event_export(char* lname, void* data, va_list ap)
ev = (struct event_data *) aMalloc(sizeof(struct event_data));
if (ev==NULL) {
ShowFatalError("npc_event_export: out of memory !\n");
- exit(1);
+ exit(EXIT_FAILURE);
}else if (p==NULL || (p-lname)>NAME_LENGTH) {
ShowFatalError("npc_event_export: label name error !\n");
- exit(1);
+ exit(EXIT_FAILURE);
}else{
ev->nd = nd;
ev->pos = pos;
@@ -371,7 +371,7 @@ int npc_timerevent_import(char* lname, void* data, va_list ap)
else te= (struct npc_timerevent_list*)aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) );
if(te==NULL){
ShowFatalError("npc_timerevent_import: out of memory !\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
for(j=0;j<i;j++){
if(te[j].timer>t){
@@ -1604,7 +1604,7 @@ int npc_convertlabel_db(DBKey key, void* data, va_list ap)
// here we check if the label fit into the buffer
if (len > 23) {
ShowError("npc_parse_script: label name longer than 23 chars! '%s'\n (%s)", lname, current_file);
- exit(1);
+ exit(EXIT_FAILURE);
}
safestrncpy(lst[num].name, lname, NAME_LENGTH);
lst[num].pos = pos;
@@ -1658,7 +1658,7 @@ static void npc_parse_script_line(char* p, int* curly_count, int line)
}
if(string_flag) {
printf("Missing '\"' at file %s line %d\n", current_file, line);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
diff --git a/src/map/party.c b/src/map/party.c
index 90689a612..68a209172 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -121,7 +121,7 @@ int party_created(int account_id,int char_id,int fail,int party_id,char *name)
sd->status.party_id=party_id;
if(idb_get(party_db,party_id)!=NULL){
ShowFatalError("party: id already exists!\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
p=(struct party_data *)aCalloc(1,sizeof(struct party_data));
p->party.party_id=party_id;
diff --git a/src/map/path.c b/src/map/path.c
index 9f173fc54..48b62755a 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -59,7 +59,7 @@ static void update_heap_path(int *heap,struct tmp_path *tp,int index)
if( h == heap[0] )
{
ShowError("update_heap_path bug\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
for( i = (h-1)/2; h > 0 && tp[index].cost < tp[heap[i+1]].cost; i = (h-1)/2 )
diff --git a/src/map/pc.c b/src/map/pc.c
index 690477d10..99cde53d5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5946,7 +5946,7 @@ int pc_setregstr(struct map_session_data *sd,int reg,char *str)
sd->regstr = (struct script_regstr *) aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
if(sd->regstr==NULL){
ShowFatalError("out of memory : pc_setreg\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
memset(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr));
sd->regstr[i].index = reg;
diff --git a/src/tool/grfio.c b/src/tool/grfio.c
index 247395262..26cfb636f 100644
--- a/src/tool/grfio.c
+++ b/src/tool/grfio.c
@@ -570,7 +570,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn) - 1) {
printf("GRF file name %s is too long\n", fname);
free(grf_filelist);
- exit(1);
+ exit(EXIT_FAILURE);
}
srclen = 0;
if ((period_ptr = strrchr(fname, '.')) != NULL) {
@@ -641,7 +641,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn)-1) {
printf("GRF file name %s is too long\n", fname);
free(grf_filelist);
- exit(1);
+ exit(EXIT_FAILURE);
}
ofs2 = ofs + (int)strlen(fname)+1;
type = grf_filelist[ofs2+12];
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index 095245da4..b204cf7c7 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -274,7 +274,7 @@ int main(int argc, char *argv[])
map_cache_fp = fopen(map_cache_file, "r+b");
if(map_cache_fp == NULL) {
printf("Failure when opening map cache file %s\n", map_cache_file);
- exit(1);
+ exit(EXIT_FAILURE);
}
// Open the map list
@@ -282,7 +282,7 @@ int main(int argc, char *argv[])
list = fopen(map_list_file, "r");
if(list == NULL) {
printf("Failure when opening maps list file %s\n", map_list_file);
- exit(2);
+ exit(EXIT_FAILURE);
}
// Initialize the main header
diff --git a/src/txt-converter/login-converter.c b/src/txt-converter/login-converter.c
index 114ec7735..4a9b442f9 100644
--- a/src/txt-converter/login-converter.c
+++ b/src/txt-converter/login-converter.c
@@ -63,7 +63,7 @@ int read_gm_account()
p = (struct gm_account*)malloc(sizeof(struct gm_account));
if(p==NULL){
ShowFatalError("gm_account: out of memory!\n");
- exit(0);
+ exit(EXIT_FAILURE);
}
if(sscanf(line,"%d %d",&p->account_id,&p->level) != 2 || p->level <= 0) {
@@ -101,7 +101,7 @@ int convert_login(void)
{
Sql_ShowDebug(mysql_handle);
Sql_Free(mysql_handle);
- exit(1);
+ exit(EXIT_FAILURE);
}
ShowStatus("Connect: Success!\n");