mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-23 18:50:13 +01:00
Fixed Warnings for new GCC
This commit is contained in:
parent
fefa0eac1d
commit
64300c6036
19 changed files with 88 additions and 78 deletions
|
|
@ -35,6 +35,8 @@ export (QQ's a zone into a tarball)t
|
|||
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
|
||||
(lots of major bugfixes too)
|
||||
@
|
||||
[Dec 01 2008] - Fizban
|
||||
Now compiles warning free on GCC 4.3.2
|
||||
[Oct 09 2008] - Rumble
|
||||
Fixed a small bug in hedit. If CIRCLE_UNSIGNED_INDEX is 0, then new entries wo
|
||||
n't save correctly. (thanks Rhade)
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ ACMD(do_tell)
|
|||
{
|
||||
struct char_data *vict = NULL;
|
||||
char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
|
||||
int i;
|
||||
|
||||
half_chop(argument, buf, buf2);
|
||||
|
||||
|
|
@ -165,7 +166,7 @@ ACMD(do_tell)
|
|||
return;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "../bin/webster %s %d &", word, (int) getpid());
|
||||
system(buf);
|
||||
i = system(buf);
|
||||
last_webster_teller = GET_IDNUM(ch);
|
||||
send_to_char(ch, "You look up '%s' in Merriam-Webster.\r\n", word);
|
||||
} else if (GET_LEVEL(ch) < LVL_IMMORT && !(vict = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
|
||||
|
|
|
|||
|
|
@ -1212,7 +1212,7 @@ ACMD(do_who)
|
|||
if (short_list)
|
||||
send_to_char(ch, "Players\r\n-------\r\n");
|
||||
else
|
||||
send_to_char(ch, rank[i].disp);
|
||||
send_to_char(ch, "%s", rank[i].disp);
|
||||
|
||||
for (d = descriptor_list; d; d = d->next) {
|
||||
if (d->original)
|
||||
|
|
@ -1666,7 +1666,7 @@ ACMD(do_levels)
|
|||
}
|
||||
one_argument(argument, arg);
|
||||
|
||||
if (arg && *arg) {
|
||||
if (*arg) {
|
||||
if (isdigit(*arg)) {
|
||||
ret = sscanf(arg, "%d-%d", &min_lev, &max_lev);
|
||||
if (ret == 0) {
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ static void list_zone_commands_room(struct char_data *ch, room_vnum rvnum)
|
|||
}
|
||||
subcmd++;
|
||||
}
|
||||
send_to_char(ch, nrm);
|
||||
send_to_char(ch, "%s", nrm);
|
||||
if (!count)
|
||||
send_to_char(ch, "None!\r\n");
|
||||
}
|
||||
|
|
@ -1784,7 +1784,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
|
|||
FILE *fp;
|
||||
struct last_entry mlast;
|
||||
struct last_entry *llast;
|
||||
int size,recs,tmp;
|
||||
int size, recs, tmp, i;
|
||||
|
||||
if(!(fp=fopen(LAST_FILE,"r"))) {
|
||||
log("Error opening last_file for reading, will create.");
|
||||
|
|
@ -1799,7 +1799,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
|
|||
* do (like searching for the last shutdown/etc..) */
|
||||
for(tmp=recs-1; tmp > 0; tmp--) {
|
||||
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
|
||||
fread(&mlast,sizeof(struct last_entry),1,fp);
|
||||
i = fread(&mlast,sizeof(struct last_entry),1,fp);
|
||||
/*another one to keep that stepback */
|
||||
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
|
||||
|
||||
|
|
@ -1821,7 +1821,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
|
|||
static void mod_llog_entry(struct last_entry *llast,int type) {
|
||||
FILE *fp;
|
||||
struct last_entry mlast;
|
||||
int size,recs,tmp;
|
||||
int size, recs, tmp, i, j;
|
||||
|
||||
if(!(fp=fopen(LAST_FILE,"r+"))) {
|
||||
log("Error opening last_file for reading and writing.");
|
||||
|
|
@ -1837,7 +1837,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
|
|||
* do (like searching for the last shutdown/etc..) */
|
||||
for(tmp=recs; tmp > 0; tmp--) {
|
||||
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
|
||||
fread(&mlast,sizeof(struct last_entry),1,fp);
|
||||
i = fread(&mlast,sizeof(struct last_entry),1,fp);
|
||||
/* Another one to keep that stepback. */
|
||||
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
|
||||
|
||||
|
|
@ -1852,7 +1852,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
|
|||
}
|
||||
mlast.close_time=time(0);
|
||||
/*write it, and we're done!*/
|
||||
fwrite(&mlast,sizeof(struct last_entry),1,fp);
|
||||
j = fwrite(&mlast,sizeof(struct last_entry),1,fp);
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1867,6 +1867,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
|
|||
void add_llog_entry(struct char_data *ch, int type) {
|
||||
FILE *fp;
|
||||
struct last_entry *llast;
|
||||
int i;
|
||||
|
||||
/* so if a char enteres a name, but bad password, otherwise loses link before
|
||||
* he gets a pref assinged, we won't record it */
|
||||
|
|
@ -1893,7 +1894,7 @@ void add_llog_entry(struct char_data *ch, int type) {
|
|||
free(llast);
|
||||
return;
|
||||
}
|
||||
fwrite(llast,sizeof(struct last_entry),1,fp);
|
||||
i = fwrite(llast,sizeof(struct last_entry),1,fp);
|
||||
fclose(fp);
|
||||
} else {
|
||||
/* We've found a login - update it */
|
||||
|
|
@ -1905,7 +1906,7 @@ void add_llog_entry(struct char_data *ch, int type) {
|
|||
void clean_llog_entries(void) {
|
||||
FILE *ofp, *nfp;
|
||||
struct last_entry mlast;
|
||||
int recs;
|
||||
int recs, i, j;
|
||||
|
||||
if(!(ofp=fopen(LAST_FILE,"r")))
|
||||
return; /* no file, no gripe */
|
||||
|
|
@ -1930,8 +1931,8 @@ void clean_llog_entries(void) {
|
|||
|
||||
/* copy the rest */
|
||||
while (!feof(ofp)) {
|
||||
fread(&mlast,sizeof(struct last_entry),1,ofp);
|
||||
fwrite(&mlast,sizeof(struct last_entry),1,nfp);
|
||||
i = fread(&mlast,sizeof(struct last_entry),1,ofp);
|
||||
j = fwrite(&mlast,sizeof(struct last_entry),1,nfp);
|
||||
}
|
||||
fclose(ofp);
|
||||
fclose(nfp);
|
||||
|
|
@ -1945,18 +1946,19 @@ void list_llog_entries(struct char_data *ch)
|
|||
{
|
||||
FILE *fp;
|
||||
struct last_entry llast;
|
||||
int i;
|
||||
|
||||
if(!(fp=fopen(LAST_FILE,"r"))) {
|
||||
log("bad things.");
|
||||
send_to_char(ch, "Error! - no last log");
|
||||
}
|
||||
send_to_char(ch, "Last log\r\n");
|
||||
fread(&llast, sizeof(struct last_entry), 1, fp);
|
||||
i = fread(&llast, sizeof(struct last_entry), 1, fp);
|
||||
|
||||
while(!feof(fp)) {
|
||||
send_to_char(ch, "%10s\t%d\t%s\t%s", llast.username, llast.punique,
|
||||
last_array[llast.close_type], ctime(&llast.time));
|
||||
fread(&llast, sizeof(struct last_entry), 1, fp);
|
||||
i = fread(&llast, sizeof(struct last_entry), 1, fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1976,7 +1978,7 @@ ACMD(do_last)
|
|||
char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH];
|
||||
struct char_data *vict = NULL;
|
||||
struct char_data *temp;
|
||||
int recs, num = 0;
|
||||
int recs, i, num = 0;
|
||||
FILE *fp;
|
||||
time_t delta;
|
||||
struct last_entry mlast;
|
||||
|
|
@ -2038,7 +2040,7 @@ ACMD(do_last)
|
|||
send_to_char(ch, "Last log\r\n");
|
||||
while(num > 0 && recs > 0) {
|
||||
fseek(fp,-1* (sizeof(struct last_entry)),SEEK_CUR);
|
||||
fread(&mlast,sizeof(struct last_entry),1,fp);
|
||||
i = fread(&mlast,sizeof(struct last_entry),1,fp);
|
||||
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
|
||||
if(!*name ||(*name && !str_cmp(name, mlast.username))) {
|
||||
send_to_char(ch,"%10.10s %20.20s %16.16s - ",
|
||||
|
|
@ -3496,7 +3498,7 @@ ACMD (do_zcheck)
|
|||
CCCYN(ch, C_NRM), GET_MOB_VNUM(mob),
|
||||
CCYEL(ch, C_NRM), GET_NAME(mob),
|
||||
CCNRM(ch, C_NRM));
|
||||
send_to_char(ch, buf);
|
||||
send_to_char(ch, "%s", buf);
|
||||
}
|
||||
/* reset buffers and found flag */
|
||||
strcpy(buf, "");
|
||||
|
|
@ -3629,7 +3631,7 @@ ACMD (do_zcheck)
|
|||
/* Additional object checks. */
|
||||
if (found) {
|
||||
send_to_char(ch, "[%5d] %-30s: \r\n", GET_OBJ_VNUM(obj), obj->short_description);
|
||||
send_to_char(ch, buf);
|
||||
send_to_char(ch, "%s", buf);
|
||||
}
|
||||
strcpy(buf, "");
|
||||
len = 0;
|
||||
|
|
@ -3696,7 +3698,7 @@ ACMD (do_zcheck)
|
|||
if (found) {
|
||||
send_to_char(ch, "[%5d] %-30s: \r\n",
|
||||
world[i].number, world[i].name ? world[i].name : "An unnamed room");
|
||||
send_to_char(ch, buf);
|
||||
send_to_char(ch, "%s", buf);
|
||||
strcpy(buf, "");
|
||||
len = 0;
|
||||
found = 0;
|
||||
|
|
@ -3973,6 +3975,7 @@ ACMD(do_copyover)
|
|||
FILE *fp;
|
||||
struct descriptor_data *d, *d_next;
|
||||
char buf [100], buf2[100];
|
||||
int i;
|
||||
|
||||
fp = fopen (COPYOVER_FILE, "w");
|
||||
if (!fp) {
|
||||
|
|
@ -4012,7 +4015,7 @@ ACMD(do_copyover)
|
|||
sprintf (buf2, "-C%d", mother_desc);
|
||||
|
||||
/* Ugh, seems it is expected we are 1 step above lib - this may be dangerous! */
|
||||
chdir ("..");
|
||||
i = chdir ("..");
|
||||
|
||||
/* Close reserve and other always-open files and release other resources */
|
||||
execl (EXE_FILE, "circle", buf2, buf, (char *) NULL);
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
|
|||
/* Paste on the right border */
|
||||
strcpy(buf2, strpaste(buf2, buf1, " "));
|
||||
/* Print it all out */
|
||||
send_to_char(ch, buf2);
|
||||
send_to_char(ch, "%s", buf2);
|
||||
|
||||
send_to_char(ch, "@D `.-.__--.,-.__.-.-'@n\r\n");
|
||||
return;
|
||||
|
|
@ -493,14 +493,14 @@ void str_and_map(char *str, struct char_data *ch, room_vnum target_room ) {
|
|||
|
||||
/* Check MUDs map config options - if disabled, just show room decsription */
|
||||
if (!can_see_map(ch)) {
|
||||
send_to_char(ch, strfrmt(str, GET_SCREEN_WIDTH(ch), 1, FALSE, FALSE, FALSE));
|
||||
send_to_char(ch, "%s", strfrmt(str, GET_SCREEN_WIDTH(ch), 1, FALSE, FALSE, FALSE));
|
||||
return;
|
||||
}
|
||||
|
||||
worldmap = ROOM_FLAGGED(target_room, ROOM_WORLDMAP) ? TRUE : FALSE ;
|
||||
|
||||
if(!PRF_FLAGGED(ch, PRF_AUTOMAP)) {
|
||||
send_to_char(ch, strfrmt(str, GET_SCREEN_WIDTH(ch), 1, FALSE, FALSE, FALSE));
|
||||
send_to_char(ch, "%s", strfrmt(str, GET_SCREEN_WIDTH(ch), 1, FALSE, FALSE, FALSE));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -524,9 +524,9 @@ MapArea(target_room, ch, centre, centre, min, max, ns_size/2, ew_size/2, worldma
|
|||
char_size = 3*(size+1) + (size) + 4;
|
||||
|
||||
if(worldmap)
|
||||
send_to_char(ch, strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), WorldMap(centre, size, MAP_CIRCLE, MAP_COMPACT), " "));
|
||||
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), WorldMap(centre, size, MAP_CIRCLE, MAP_COMPACT), " "));
|
||||
else
|
||||
send_to_char(ch, strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), CompactStringMap(centre, size), " "));
|
||||
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), CompactStringMap(centre, size), " "));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
20
src/boards.c
20
src/boards.c
|
|
@ -411,7 +411,7 @@ int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj
|
|||
void board_save_board(int board_type)
|
||||
{
|
||||
FILE *fl;
|
||||
int i;
|
||||
int i, j;
|
||||
char *tmp1, *tmp2 = NULL;
|
||||
|
||||
if (!num_of_msgs[board_type]) {
|
||||
|
|
@ -422,7 +422,7 @@ void board_save_board(int board_type)
|
|||
perror("SYSERR: Error writing board");
|
||||
return;
|
||||
}
|
||||
fwrite(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
|
||||
j = fwrite(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
|
||||
|
||||
for (i = 0; i < num_of_msgs[board_type]; i++) {
|
||||
if ((tmp1 = MSG_HEADING(board_type, i)) != NULL)
|
||||
|
|
@ -437,11 +437,11 @@ void board_save_board(int board_type)
|
|||
else
|
||||
msg_index[board_type][i].message_len = strlen(tmp2) + 1;
|
||||
|
||||
fwrite(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
|
||||
j = fwrite(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
|
||||
if (tmp1)
|
||||
fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl);
|
||||
j = fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl);
|
||||
if (tmp2)
|
||||
fwrite(tmp2, sizeof(char), msg_index[board_type][i].message_len, fl);
|
||||
j = fwrite(tmp2, sizeof(char), msg_index[board_type][i].message_len, fl);
|
||||
}
|
||||
|
||||
fclose(fl);
|
||||
|
|
@ -450,7 +450,7 @@ void board_save_board(int board_type)
|
|||
void board_load_board(int board_type)
|
||||
{
|
||||
FILE *fl;
|
||||
int i, len1, len2;
|
||||
int i, j, len1, len2;
|
||||
char *tmp1, *tmp2;
|
||||
|
||||
if (!(fl = fopen(FILENAME(board_type), "rb"))) {
|
||||
|
|
@ -458,21 +458,21 @@ void board_load_board(int board_type)
|
|||
perror("SYSERR: Error reading board");
|
||||
return;
|
||||
}
|
||||
fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
|
||||
j = fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
|
||||
if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) {
|
||||
log("SYSERR: Board file %d corrupt. Resetting.", board_type);
|
||||
board_reset_board(board_type);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < num_of_msgs[board_type]; i++) {
|
||||
fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
|
||||
j = fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
|
||||
if ((len1 = msg_index[board_type][i].heading_len) <= 0) {
|
||||
log("SYSERR: Board file %d corrupt! Resetting.", board_type);
|
||||
board_reset_board(board_type);
|
||||
return;
|
||||
}
|
||||
CREATE(tmp1, char, len1);
|
||||
fread(tmp1, sizeof(char), len1, fl);
|
||||
j = fread(tmp1, sizeof(char), len1, fl);
|
||||
MSG_HEADING(board_type, i) = tmp1;
|
||||
|
||||
if ((MSG_SLOTNUM(board_type, i) = find_slot()) == -1) {
|
||||
|
|
@ -482,7 +482,7 @@ void board_load_board(int board_type)
|
|||
}
|
||||
if ((len2 = msg_index[board_type][i].message_len) > 0) {
|
||||
CREATE(tmp2, char, len2);
|
||||
fread(tmp2, sizeof(char), len2, fl);
|
||||
j = fread(tmp2, sizeof(char), len2, fl);
|
||||
msg_storage[MSG_SLOTNUM(board_type, i)] = tmp2;
|
||||
} else
|
||||
msg_storage[MSG_SLOTNUM(board_type, i)] = NULL;
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ void copyover_recover()
|
|||
struct descriptor_data *d;
|
||||
FILE *fp;
|
||||
char host[1024];
|
||||
int desc, player_i;
|
||||
int desc, i, player_i;
|
||||
bool fOld;
|
||||
char name[MAX_INPUT_LENGTH];
|
||||
long pref;
|
||||
|
|
@ -407,11 +407,11 @@ void copyover_recover()
|
|||
unlink (COPYOVER_FILE);
|
||||
|
||||
/* read boot_time - first line in file */
|
||||
fscanf(fp, "%ld\n", (long *)&boot_time);
|
||||
i = fscanf(fp, "%ld\n", (long *)&boot_time);
|
||||
|
||||
for (;;) {
|
||||
fOld = TRUE;
|
||||
fscanf (fp, "%d %ld %s %s\n", &desc, &pref, name, host);
|
||||
i = fscanf (fp, "%d %ld %s %s\n", &desc, &pref, name, host);
|
||||
if (desc == -1)
|
||||
break;
|
||||
|
||||
|
|
|
|||
28
src/db.c
28
src/db.c
|
|
@ -151,8 +151,9 @@ static int hsort(const void *a, const void *b);
|
|||
char *fread_action(FILE *fl, int nr)
|
||||
{
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
char *buf1;
|
||||
|
||||
fgets(buf, MAX_STRING_LENGTH, fl);
|
||||
buf1 = fgets(buf, MAX_STRING_LENGTH, fl);
|
||||
if (feof(fl)) {
|
||||
log("SYSERR: fread_action: unexpected EOF near action #%d", nr);
|
||||
/* SYSERR_DESC: fread_action() will fail if it discovers an end of file
|
||||
|
|
@ -170,8 +171,8 @@ char *fread_action(FILE *fl, int nr)
|
|||
void boot_social_messages(void)
|
||||
{
|
||||
FILE *fl;
|
||||
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1;
|
||||
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH];
|
||||
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1, i;
|
||||
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH], *buf;
|
||||
|
||||
if (CONFIG_NEW_SOCIALS == TRUE) {
|
||||
/* open social file */
|
||||
|
|
@ -185,7 +186,7 @@ void boot_social_messages(void)
|
|||
/* count socials */
|
||||
*next_soc = '\0';
|
||||
while (!feof(fl)) {
|
||||
fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
buf = fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
if (*next_soc == '~') top_of_socialt++;
|
||||
}
|
||||
} else { /* old style */
|
||||
|
|
@ -200,7 +201,7 @@ void boot_social_messages(void)
|
|||
}
|
||||
/* count socials */
|
||||
while (!feof(fl)) {
|
||||
fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
buf = fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
if (*next_soc == '\n' || *next_soc == '\r') top_of_socialt++; /* all socials are followed by a blank line */
|
||||
}
|
||||
}
|
||||
|
|
@ -212,7 +213,7 @@ void boot_social_messages(void)
|
|||
|
||||
/* now read 'em */
|
||||
for (;;) {
|
||||
fscanf(fl, " %s ", next_soc);
|
||||
i = fscanf(fl, " %s ", next_soc);
|
||||
if (*next_soc == '$') break;
|
||||
|
||||
if (CONFIG_NEW_SOCIALS == TRUE) {
|
||||
|
|
@ -753,11 +754,12 @@ static void reset_time(void)
|
|||
{
|
||||
time_t beginning_of_time = 0;
|
||||
FILE *bgtime;
|
||||
int i;
|
||||
|
||||
if ((bgtime = fopen(TIME_FILE, "r")) == NULL)
|
||||
log("No time file '%s' starting from the beginning.", TIME_FILE);
|
||||
else {
|
||||
fscanf(bgtime, "%ld\n", (long *)&beginning_of_time);
|
||||
i = fscanf(bgtime, "%ld\n", (long *)&beginning_of_time);
|
||||
fclose(bgtime);
|
||||
}
|
||||
|
||||
|
|
@ -870,7 +872,7 @@ void index_boot(int mode)
|
|||
{
|
||||
const char *index_filename, *prefix = NULL; /* NULL or egcs 1.1 complains */
|
||||
FILE *db_index, *db_file;
|
||||
int rec_count = 0, size[2];
|
||||
int rec_count = 0, size[2], i;
|
||||
char buf2[PATH_MAX], buf1[MAX_STRING_LENGTH];
|
||||
|
||||
switch (mode) {
|
||||
|
|
@ -915,13 +917,13 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
/* first, count the number of records in the file so we can malloc */
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
while (*buf1 != '$') {
|
||||
snprintf(buf2, sizeof(buf2), "%s%s", prefix, buf1);
|
||||
if (!(db_file = fopen(buf2, "r"))) {
|
||||
log("SYSERR: File '%s' listed in '%s/%s': %s", buf2, prefix,
|
||||
index_filename, strerror(errno));
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
continue;
|
||||
} else {
|
||||
if (mode == DB_BOOT_ZON)
|
||||
|
|
@ -933,7 +935,7 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
fclose(db_file);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
}
|
||||
|
||||
/* Exit if 0 records, unless this is shops */
|
||||
|
|
@ -987,7 +989,7 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
rewind(db_index);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
while (*buf1 != '$') {
|
||||
snprintf(buf2, sizeof(buf2), "%s%s", prefix, buf1);
|
||||
if (!(db_file = fopen(buf2, "r"))) {
|
||||
|
|
@ -1014,7 +1016,7 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
fclose(db_file);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
}
|
||||
fclose(db_index);
|
||||
|
||||
|
|
|
|||
12
src/fight.c
12
src/fight.c
|
|
@ -125,7 +125,7 @@ void load_messages(void)
|
|||
FILE *fl;
|
||||
int i, type;
|
||||
struct message_type *messages;
|
||||
char chk[128];
|
||||
char chk[128], *buf;
|
||||
|
||||
if (!(fl = fopen(MESS_FILE, "r"))) {
|
||||
log("SYSERR: Error reading combat message file %s: %s", MESS_FILE, strerror(errno));
|
||||
|
|
@ -139,12 +139,12 @@ void load_messages(void)
|
|||
}
|
||||
|
||||
while (!feof(fl)) {
|
||||
fgets(chk, 128, fl);
|
||||
buf = fgets(chk, 128, fl);
|
||||
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
|
||||
fgets(chk, 128, fl);
|
||||
buf = fgets(chk, 128, fl);
|
||||
|
||||
while (*chk == 'M') {
|
||||
fgets(chk, 128, fl);
|
||||
buf = fgets(chk, 128, fl);
|
||||
sscanf(chk, " %d\n", &type);
|
||||
for (i = 0; (i < MAX_MESSAGES) && (fight_messages[i].a_type != type) &&
|
||||
(fight_messages[i].a_type); i++);
|
||||
|
|
@ -170,9 +170,9 @@ void load_messages(void)
|
|||
messages->god_msg.attacker_msg = fread_action(fl, i);
|
||||
messages->god_msg.victim_msg = fread_action(fl, i);
|
||||
messages->god_msg.room_msg = fread_action(fl, i);
|
||||
fgets(chk, 128, fl);
|
||||
buf = fgets(chk, 128, fl);
|
||||
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
|
||||
fgets(chk, 128, fl);
|
||||
buf = fgets(chk, 128, fl);
|
||||
}
|
||||
}
|
||||
fclose(fl);
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ void check_mobile_string(mob_vnum i, char **string, const char *desc)
|
|||
if (*string == NULL || **string == '\0') {
|
||||
char smbuf[128];
|
||||
sprintf(smbuf, "GenOLC: Mob #%d has an invalid %s.", i, desc);
|
||||
mudlog(BRF, LVL_GOD, TRUE, smbuf);
|
||||
mudlog(BRF, LVL_GOD, TRUE, "%s", smbuf);
|
||||
if (*string)
|
||||
free(*string);
|
||||
*string = strdup("An undefined string.");
|
||||
|
|
|
|||
10
src/genolc.c
10
src/genolc.c
|
|
@ -310,7 +310,7 @@ ACMD(do_export_zone)
|
|||
zone_vnum zvnum;
|
||||
char sysbuf[MAX_INPUT_LENGTH];
|
||||
char zone_name[MAX_INPUT_LENGTH], *f;
|
||||
int success;
|
||||
int success, i;
|
||||
|
||||
/* system command locations are relative to
|
||||
* where the binary IS, not where it was run
|
||||
|
|
@ -335,7 +335,7 @@ ACMD(do_export_zone)
|
|||
* again. Do it silently though ( no logs ). */
|
||||
if (!export_info_file(zrnum)) {
|
||||
sprintf(sysbuf, "mkdir %s", path);
|
||||
system(sysbuf);
|
||||
i = system(sysbuf);
|
||||
}
|
||||
|
||||
if (!(success = export_info_file(zrnum)))
|
||||
|
|
@ -366,15 +366,15 @@ ACMD(do_export_zone)
|
|||
|
||||
/* Remove the old copy. */
|
||||
sprintf(sysbuf, "rm %s%s.tar.gz", path, f);
|
||||
system(sysbuf);
|
||||
i = system(sysbuf);
|
||||
|
||||
/* Tar the new copy. */
|
||||
sprintf(sysbuf, "tar -cf %s%s.tar %sqq.info %sqq.wld %sqq.zon %sqq.mob %sqq.obj %sqq.trg", path, f, path, path, path, path, path, path);
|
||||
system(sysbuf);
|
||||
i = system(sysbuf);
|
||||
|
||||
/* Gzip it. */
|
||||
sprintf(sysbuf, "gzip %s%s.tar", path, f);
|
||||
system(sysbuf);
|
||||
i = system(sysbuf);
|
||||
|
||||
send_to_char(ch, "Files tar'ed to \"%s%s.tar.gz\"\r\n", path, f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ void hedit_parse(struct descriptor_data *d, char *arg)
|
|||
case 'Y':
|
||||
snprintf(buf, sizeof(buf), "OLC: %s edits help for %s.", GET_NAME(d->character),
|
||||
OLC_HELP(d)->keywords);
|
||||
mudlog(TRUE, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, buf);
|
||||
mudlog(TRUE, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, "%s", buf);
|
||||
write_to_output(d, "Help saved to disk.\r\n");
|
||||
hedit_save_internally(d);
|
||||
|
||||
|
|
|
|||
10
src/house.c
10
src/house.c
|
|
@ -213,13 +213,14 @@ static int find_house(room_vnum vnum)
|
|||
static void House_save_control(void)
|
||||
{
|
||||
FILE *fl;
|
||||
int i;
|
||||
|
||||
if (!(fl = fopen(HCONTROL_FILE, "wb"))) {
|
||||
perror("SYSERR: Unable to open house control file.");
|
||||
return;
|
||||
}
|
||||
/* write all the house control recs in one fell swoop. Pretty nifty, eh? */
|
||||
fwrite(house_control, sizeof(struct house_control_rec), num_of_houses, fl);
|
||||
i = fwrite(house_control, sizeof(struct house_control_rec), num_of_houses, fl);
|
||||
|
||||
fclose(fl);
|
||||
}
|
||||
|
|
@ -231,6 +232,7 @@ void House_boot(void)
|
|||
struct house_control_rec temp_house;
|
||||
room_rnum real_house, real_atrium;
|
||||
FILE *fl;
|
||||
int i;
|
||||
|
||||
memset((char *)house_control,0,sizeof(struct house_control_rec)*MAX_HOUSES);
|
||||
|
||||
|
|
@ -242,7 +244,7 @@ void House_boot(void)
|
|||
return;
|
||||
}
|
||||
while (!feof(fl) && num_of_houses < MAX_HOUSES) {
|
||||
fread(&temp_house, sizeof(struct house_control_rec), 1, fl);
|
||||
i = fread(&temp_house, sizeof(struct house_control_rec), 1, fl);
|
||||
|
||||
if (feof(fl))
|
||||
break;
|
||||
|
|
@ -661,7 +663,7 @@ static int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
|
|||
FILE *in, *out;
|
||||
char infile[MAX_INPUT_LENGTH], *outfile;
|
||||
struct obj_data *tmp;
|
||||
int i, j=0;
|
||||
int i, j=0, k;
|
||||
|
||||
House_get_filename(vnum, infile, sizeof(infile));
|
||||
|
||||
|
|
@ -685,7 +687,7 @@ static int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
|
|||
|
||||
while (!feof(in)) {
|
||||
struct obj_file_elem object;
|
||||
fread(&object, sizeof(struct obj_file_elem), 1, in);
|
||||
k = fread(&object, sizeof(struct obj_file_elem), 1, in);
|
||||
if (ferror(in)) {
|
||||
perror("SYSERR: Reading house file in House_load");
|
||||
send_to_char(ch, "...read error in house rent file.\r\n");
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ void run_autowiz(void)
|
|||
if (CONFIG_USE_AUTOWIZ) {
|
||||
size_t res;
|
||||
char buf[256];
|
||||
int i;
|
||||
|
||||
#if defined(CIRCLE_UNIX)
|
||||
res = snprintf(buf, sizeof(buf), "nice ../bin/autowiz %d %s %d %s %d &",
|
||||
|
|
@ -208,7 +209,7 @@ void run_autowiz(void)
|
|||
/* Abusing signed -> unsigned conversion to avoid '-1' check. */
|
||||
if (res < sizeof(buf)) {
|
||||
mudlog(CMP, LVL_IMMORT, FALSE, "Initiating autowiz.");
|
||||
system(buf);
|
||||
i = system(buf);
|
||||
reboot_wizlists();
|
||||
} else
|
||||
log("Cannot run autowiz: command-line doesn't fit in buffer.");
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ static void medit_disp_mob_flags(struct descriptor_data *d)
|
|||
column_list(buf, sizeof(buf), 0, 0,
|
||||
2, action_bits, NUM_MOB_FLAGS, 0,
|
||||
"%s$2i%s) $20l", grn, nrm);
|
||||
write_to_output(d, buf);
|
||||
write_to_output(d, "%s", buf);
|
||||
|
||||
sprintbitarray(MOB_FLAGS(OLC_MOB(d)), action_bits, AF_ARRAY_MAX, buf);
|
||||
write_to_output(d, "\r\nCurrent flags : %s%s%s\r\nEnter mob flags (0 to quit) : ",
|
||||
|
|
@ -361,7 +361,7 @@ static void medit_disp_aff_flags(struct descriptor_data *d)
|
|||
column_list(buf, sizeof(buf), 0, 0,
|
||||
2, affected_bits, NUM_AFF_FLAGS, 1,
|
||||
"%s$2i%s) $20l", grn, nrm);
|
||||
write_to_output(d, buf);
|
||||
write_to_output(d, "%s", buf);
|
||||
|
||||
sprintbitarray(AFF_FLAGS(OLC_MOB(d)), affected_bits, AF_ARRAY_MAX, buf);
|
||||
write_to_output(d, "\r\nCurrent flags : %s%s%s\r\nEnter aff flags (0 to quit) : ",
|
||||
|
|
|
|||
|
|
@ -297,6 +297,6 @@ void send_cannot_edit(struct char_data *ch, zone_vnum zone)
|
|||
send_to_char(ch, "You do not have permission to edit zone %d.\r\n", zone);
|
||||
sprintf(buf, "OLC: %s tried to edit zone %d.", GET_NAME(ch), zone);
|
||||
}
|
||||
mudlog(BRF, LVL_IMPL, TRUE, buf);
|
||||
mudlog(BRF, LVL_IMPL, TRUE, "%s", buf);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_IN
|
|||
"%s Listen carefully to the instructions.", GET_NAME(ch));
|
||||
do_tell(qm, buf, cmd_tell, 0);
|
||||
set_quest(ch, rnum);
|
||||
send_to_char(ch, QST_INFO(rnum));
|
||||
send_to_char(ch, "%s", QST_INFO(rnum));
|
||||
if (QST_TIME(rnum) != -1)
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%s You have a time limit of %d turn%s to complete the quest.",
|
||||
|
|
|
|||
|
|
@ -1076,14 +1076,13 @@ static int read_type_list(FILE *shop_f, struct shop_buy_data *list,
|
|||
int new_format, int max)
|
||||
{
|
||||
int tindex, num, len = 0, error = 0;
|
||||
char *ptr;
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
char *ptr, buf[MAX_STRING_LENGTH], *buf1;
|
||||
|
||||
if (!new_format)
|
||||
return (read_list(shop_f, list, 0, max, LIST_TRADE));
|
||||
|
||||
do {
|
||||
fgets(buf, sizeof(buf), shop_f);
|
||||
buf1 = fgets(buf, sizeof(buf), shop_f);
|
||||
if ((ptr = strchr(buf, ';')) != NULL)
|
||||
*ptr = '\0';
|
||||
else
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ static void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum
|
|||
struct descriptor_data *dsc;
|
||||
|
||||
if ((result = create_new_zone(vzone_num, bottom, top, &error)) == NOWHERE) {
|
||||
write_to_output(ch->desc, error);
|
||||
write_to_output(ch->desc, "%s", error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue