So, I recently started converting my heavily modified SmaugFUSS 1.6 from compiling with GCC to G++. I used the most recent SmaugFUSS 1.9 as a reference, and FINALLY got it all compiling and linking properly today. Now, the problem is... the interpreter is crashing when trying to allocate memory for a temporary pointer to convert input from a normal character pointer to a constant.
Just as in the regular SmaugFUSS 1.9, I'm using this function for that:
In GDB, this is what I get:
Just as in the regular SmaugFUSS 1.9, I'm using this function for that:
(225) void interpret( CHAR_DATA * ch, const char* argument)
(226) {
(227) char *temp = strdup(argument);
(228) interpret(ch, temp);
(229) free(temp);
(230) }In GDB, this is what I get:
#0 0xb7b6086c in _int_malloc () from /lib/libc.so.6
#1 0xb7b6250f in calloc () from /lib/libc.so.6
#2 0x080f47a0 in str_dup (str=0x86531f8 "who") at db.c:3447
#3 0x0812d775 in interpret (ch=0x83a73e8, argument=0x86531f8 "who") at interp.c:227
#4 0x0812d789 in interpret (ch=0x83a73e8, argument=0x86531e8 "who") at interp.c:228
#5 0x0812d789 in interpret (ch=0x83a73e8, argument=0x86531d8 "who") at interp.c:228