HELP!

From: The Arrow (pt94jpi@student.hk-r.se)
Date: 02/16/97


Looks like my previous message didn't make it through somewhere...
So here it goes again.

Hi!
I have a small problem.  I'm trying to make an own OLC, mostly because I
have changed the area/world system quite a bit internally.  I have
among other things added an "area" file that defines base vnum for
areas, recomended levels, names and what world files to load.
The area editor (it is menu based) works perfect, except when I try to
save the area file to disk!

If anyone on this list knows what might be wrong, I'll be your personel
slave for the rest of my life!!! :)

Btw. I'm running on a Sun SPARCstation 4 with Solaris 2.5.1.

Here follows some output from gdb:

Sun Feb 16 05:50:24 :: Arrow retrieving crash-saved items and entering game.
area->vnum = 500, area->file = 'world/are/500.are'
aedit_save_file(): file opened successfully!
 
Program received signal SIGBUS, Bus error.
0x87ebc in malloc_unlocked ()
(gdb) bt
#0  0x87ebc in malloc_unlocked ()
#1  0x87b24 in malloc ()
#2  0xef6ab344 in _findbuf ()
#3  0xef6a08d4 in _doprnt ()
#4  0xef6aac4c in _fprintf ()
#5  0x3cd44 in aedit_save_file (ch=0x19a798, area=0x19e008) at aedit.c:249
#6  0x3cf20 in aedit_get_input (ch=0x19a798, arg=0xeffff238 "x") at aedit.c:290
#7  0x644bc in nanny (d=0x1999c0, arg=0xeffff238 "x") at nanny.c:695
#8  0x486e4 in comm_process () at descriptor.c:247
#9  0x1afa4 in game_loop () at shadow.c:316
#10 0x1ae70 in init_game () at shadow.c:261
#11 0x1ad78 in main (argc=763904, argv=0xeffff4fc) at shadow.c:213

... and the function that do the saving to file:

static int aedit_save_file(struct char_data *ch, struct area_data *area)
{
	FILE *fl = NULL;
	int cmd;

	if (!area->file)
	{
		sprintf(buf, "%s/%d.%s", ARE_PREFIX, area->vnum, ARE_SUFFIX);
		area->file = str_dup(buf);
	}

	printf("area->vnum = %d, area->file = '%s'\n", area->vnum, area->file);

	if (!(fl = fopen(area->file, "w")))
	{
		perror("aedit_save_file(): fopen");
		sprintf(buf, "Could not save area #%d.\r\n", area->vnum);
		send_to_char(buf, ch);
		return -1;
	}

	printf("aedit_save_file(): file opened successfully!\n");
	/* the function gets here allright... */

	/* write the header information */
	fprintf(fl, "#%d\n", area->vnum);  /* <-- it chrashes here! */
	printf("aedit_save_file(): first write successfully!\n");

	fprintf(fl, "%s~\n", area->name);
	fprintf(fl, "%s~\n", area->short_name);
	fprintf(fl, "%s~\n", area->creator);
	fprintf(fl, "%s~\n", area->email);
	fprintf(fl, "%d %d %d %ld %d\n", area->status, area->min_level,
		area->max_level, area->flags, area->base);
	fprintf(fl, "***********************************************\n");

	/* write all the commands */
	for (cmd = 0; cmd < area->num_cmds; cmd++)
	{
		fprintf(fl, "%c %s\n", UPPER(area->cmds[cmd].cmd),
			area->cmds[cmd].file);
	}
	fprintf(fl, "***********************************************\n");

	/* write out the end-of-file mark */
	fprintf(fl, "$\n");

	/* NOTE: Comments in the original files WILL be wiped! */

	fclose(fl);

	return 0;
}

Many thanks in advance!

/ Joachim
------------------------------------------------------------------------
  The Arrow              Arrow@Shadow World - mud.fukt.hk-r.se 4000

  Joachim Pileborg       Email: pilen@fukt.hk-r.se
  Tranbärsvägen 22:19
  37238 Ronneby          http://www.fukt.hk-r.se/~pilen/
  SWEDEN
------------------------------------------------------------------------

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST