14 Aug, 2010, Zula110100100 wrote in the 1st comment:
Votes: 0
From code(copy from Rom24c):
bool str_prefix( const char *astr, const char *bstr )
{
if ( astr == NULL )
{
return FALSE;
}

if ( bstr == NULL )
{
return FALSE;
}

for ( ; *astr; )
{
if ( LOWER(*astr) != LOWER(*bstr) )
{
return FALSE;
}
*astr++;
*bstr++;
}

return TRUE;
}


All I did to it was swap FALSE for TRUE, and it was already running weird, with the *astr++, *bstr++ in the for line. So i moved them down, should still work fine, but I get this.

Quote
Breakpoint 1, str_prefix (astr=0xbf8e90f0 "l\r\n", bstr=0x804971c "look") at mud.c:256
256 if ( astr == NULL )
(gdb) step
261 if ( bstr == NULL )
(gdb)
266 for ( ; *astr; )
(gdb)
268 if ( LOWER(*astr) != LOWER(*bstr) )
(gdb)
266 for ( ; *astr; )
(gdb)
273 *bstr++;
(gdb)
268 if ( LOWER(*astr) != LOWER(*bstr) )
(gdb)
277 }
(gdb)


So why does it skip the *astr++ and *bstr++.



Yeah…minus the *'s
14 Aug, 2010, Zula110100100 wrote in the 2nd comment:
Votes: 0
Changed the for loop back and here is how the gdb looks for the two, astr is still not incrementing.




for ( ; *astr; astr++, bstr++)
{
if ( LOWER(*astr) != LOWER(*bstr) )
{
return FALSE;
}
}





Quote
Breakpoint 1, str_prefix (astr=0xbf935140 "look\r\n", bstr=0x804971c "look") at mud.c:256
256 if ( astr == NULL )
(gdb) step
261 if ( bstr == NULL )
(gdb)
266 for ( ; *astr; astr++, bstr++)
(gdb) print *astr
$1 = 108 'l'
(gdb) print *bstr
$2 = 108 'l'
(gdb) step
268 if ( LOWER(*astr) != LOWER(*bstr) )
(gdb) step
266 for ( ; *astr; astr++, bstr++)
(gdb) print *astr
$3 = 108 'l'
(gdb) print *bstr
$4 = 108 'l'
(gdb) step
268 if ( LOWER(*astr) != LOWER(*bstr) )
(gdb) print *astr
$5 = 108 'l'
(gdb) print *bstr
$6 = 111 'o'
(gdb)
14 Aug, 2010, Rarva.Riendf wrote in the 3rd comment:
Votes: 0
I suggest you refresh your editors and recompile everything anew because there is no reason it should not work in the first place.
0.0/3