From b4d6bac9a4d623a9b32188458b26ae424d374bb3 Mon Sep 17 00:00:00 2001 From: ultramage Date: Fri, 25 May 2007 15:21:53 +0000 Subject: Corrected some weird fgets() statements, plus reformatted them git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10616 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/map/atcommand.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 642a1f97e..87bf2a4d5 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -822,7 +822,8 @@ int msg_config_read(const char *cfgName) if ((--called) == 0) memset(msg_table, 0, sizeof(msg_table[0]) * MAX_MSG); - while(fgets(line, sizeof(line)-1, fp)) { + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) { @@ -884,7 +885,8 @@ int atcommand_config_read(const char *cfgName) return 1; } - while (fgets(line, sizeof(line)-1, fp)) { + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; @@ -2713,7 +2715,7 @@ int atcommand_help(const int fd, struct map_session_data* sd, const char* comman if ((fp = fopen(help_txt, "r")) != NULL) { clif_displaymessage(fd, msg_txt(26)); // Help commands: gm_level = pc_isGM(sd); - while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { + while(fgets(buf, sizeof(buf), fp) != NULL) { if (buf[0] == '/' && buf[1] == '/') continue; for (i = 0; buf[i] != '\0'; i++) { @@ -2751,7 +2753,7 @@ int atcommand_help2(const int fd, struct map_session_data* sd, const char* comma if ((fp = fopen(help2_txt, "r")) != NULL) { clif_displaymessage(fd, msg_txt(26)); // Help commands: gm_level = pc_isGM(sd); - while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { + while(fgets(buf, sizeof(buf), fp) != NULL) { if (buf[0] == '/' && buf[1] == '/') continue; for (i = 0; buf[i] != '\0'; i++) { @@ -7778,13 +7780,14 @@ int atcommand_gmotd(const int fd, struct map_session_data* sd, const char* comma char buf[256]; FILE *fp; nullpo_retr(-1, sd); - if( (fp = fopen(motd_txt, "r"))!=NULL){ - while (fgets(buf, 250, fp) != NULL){ + if((fp = fopen(motd_txt, "r"))!=NULL){ + while(fgets(buf, sizeof(buf), fp) != NULL) + { int i; if (buf[0] == '/' && buf[1] == '/') continue; - for( i=0; buf[i]; i++){ - if( buf[i]=='\r' || buf[i]=='\n'){ + for(i=0; buf[i]; i++){ + if(buf[i]=='\r' || buf[i]=='\n'){ buf[i]=0; break; } -- cgit v1.2.3-60-g2f50