const char *ext_flag_string2( EXT_BV * bitvector, const char *const flagarray[] ) {
static char buf[MAX_STRING_LENGTH];
int x;
buf[0] = '\0';
// prints all bits.
for( x = 0; x < MAX_BITS; ++x ) {
if flagarray[x] {
mudstrlcat( buf, flagarray[x], MAX_STRING_LENGTH );
mudstrlcat( buf, " ", MAX_STRING_LENGTH );
}
}
if( ( x = strlen( buf ) ) > 0 )
buf[–x] = '\0';
return buf;
}
Program received signal SIGSEGV, Segmentation fault.
0x0812f85f in mudstrlcat (
dst=0x82d4180 "dark death nomob indoors lawful neutral chaotic nomagic tunnel private safe solitary petshop norecall donation nodropall silence
logspeech nodrop clanstoreroom nosummon noastral teleport teleshowdesc "…, src=0x776f6c67 <Address 0x776f6c67 out of bounds>, siz=4096) at db.c:9025
9025 while( *s != '\0' )
Current language: auto; currently c++
(gdb) bt
#0 0x0812f85f in mudstrlcat (
dst=0x82d4180 "dark death nomob indoors lawful neutral chaotic nomagic tunnel private safe solitary petshop norecall donation nodropall silence
logspeech nodrop clanstoreroom nosummon noastral teleport teleshowdesc "…, src=0x776f6c67 <Address 0x776f6c67 out of bounds>, siz=4096) at db.c:9025
#1 0x080f9a70 in list_flag_string (flagarray=0x82616a0) at build.c:309
#2 0x080fa89a in do_redit (ch=0x849c430, argument=0xbff2239b "") at build.c:4783
#3 0x0817a7bf in interpret (ch=0x849c430, argument=0xbff22396 "flags") at interp.c:548
#4 0x0812a183 in game_loop () at comm.c:867
#5 0x0812c071 in main (argc=2, argv=0xbff22884) at comm.c:536
(gdb)
if flagarray[x] {
void list_array(CHAR_DATA* ch, const char* const* list, int size, const char* prefix){
int ct = 0;
int ind;
for(ind = 0; ind < size; ++ind){
if(!prefix || str_prefix(prefix, list[ind]) || !is_number(list[ind]+strlen(prefix))){
ch_printf(ch, " %-16.16s", list[ind]);
if(ct%4 == 3)
send_to_char("\r\n", ch);
++ct;
}
}
if(ct%4 != 0)
send_to_char("\r\n", ch);
}
list_array(ch, r_flags, SIZE(r_flags), "r");
#define SIZE(ar) ((int)(sizeof(ar)/sizeof((ar)[0])))