This is the second time ive sent this message so either it didnt get through or i am being ignored, sorry if the latter is the case :P I have been having a problem with a function I wrote recently. I only run into it when I am compiling the mud on my Linux machine at home, it works fine on Sun/Solaris. It is running kernel 2.0.0, Slackware distribution 3.1. The computer is a 486DX266 with 10 megs of RAM. The problem only occurs when I call set_bracket with NULL as the second argument, this is the gdb backtrace: #0 0x40060032 in strcat () #1 0x80a5ac0 in cmd_info () #2 0x805fd62 in advance_level (ch=0x811ae58, class=0, num=57) at class.c:455 #3 0x8068941 in init_char (ch=0x811ae58) at db.c:2363 #4 0x80711a1 in nanny (d=0x811a6c0, arg=0xbffff7f8 "") at interpreter.c:1887 #5 0x80614d7 in game_loop (mother_desc=3) at comm.c:608 #6 0x8060c84 in init_game (port=4111) at comm.c:244 #7 0x8060c10 in main (argc=4, argv=0xbffffbe8) at comm.c:214 #8 0x804932b in ___crt_dummy__ () Line 455 in class.c is simply: set_bracket(ch, NULL); This is the set_bracket function: void set_bracket(struct char_data * ch, char *bracket) { int k; int offset = 0; char spaces[MAX_BRACKET_LENGTH] = {'\0'}; char end[MAX_BRACKET_LENGTH] = {'\0'}; if (bracket == NULL) bracket = READ_BRACKET(ch); if (strlen(bracket) % 2) strcat(bracket, " "); if (strlen(bracket) < 12) { offset = (12 - strlen(bracket)) / 2; for (k = 0; k < offset; k++) strcat(spaces, " "); strcpy(end, spaces); strcat(end, bracket); strcat(end, spaces); } else strcpy(end, bracket); if (strlen(end) > MAX_BRACKET_LENGTH) end[MAX_BRACKET_LENGTH] = '\0'; if (GET_BRACKET(ch) != NULL) free(GET_BRACKET(ch)); GET_BRACKET(ch) = str_dup(end); } and if it matters this is READ_BRACKET: #define READ_BRACKET(ch) ((GET_LEVEL(ch) == LVL_IMMORT) ? "Immortal" : ( \ (GET_LEVEL(ch) == LVL_DEMIGOD) ? "Demigod" : ( \ (GET_LEVEL(ch) == LVL_GOD) ? "God" : ( \ (GET_LEVEL(ch) == LVL_GRGOD) ? "Greater God" : ( \ (GET_LEVEL(ch) == LVL_DEITY) ? "Deity" : ( \ (GET_LEVEL(ch) == LVL_CREATOR) ? "Creator" : ( \ (GET_LEVEL(ch) == LVL_IMPL) ? "Implementor" : \ "Mortal" ) ) ) ) ) ) ) If any one can see my problem and point it out it would be greatly apppreciated. Hopefully, and most likely, it is just something small overlooked but I'm not completely used to the Linux environment yet so I could use some help. Thanks, Chris Shaft the Implementor of zeroMUD (still in alpha test stages) +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST