ps2lib strchr bug
Posted: Thu Apr 08, 2004 3:55 pm
I think I've found a bug in the ps2lib's strchr function.
I have the following code...
strchr finds the = in a1 fine, but fails to find the = in a2, and returns NULL.
FYI, I'm in the process of porting XBlast to run on the PS2, more as an exercise in programing the PS2 than anything else.
I have the following code...
Code: Select all
int
main (int argc, char *argv[])
{
static char *a1 = "test=hello";
static char *a2 = "gameMode=R234--STDL";
char *p;
char msg[80];
InitPS2();
p = strchr(a1, '=');
if (p == NULL) {
PS2_Display_Error("Could not find = in a1", PS2_NON_FATAL);
}
else {
sprintf(msg, "= is at position %d in a1", p - a1);
PS2_Display_Error(msg, PS2_NON_FATAL);
}
p = strchr(a2, '=');
if (p == NULL) {
PS2_Display_Error("Could not find = in a2", PS2_NON_FATAL);
}
else {
sprintf(msg, "= is at position %d in a2", p - a2);
PS2_Display_Error(msg, PS2_NON_FATAL);
}
return 0;
} /* main */
FYI, I'm in the process of porting XBlast to run on the PS2, more as an exercise in programing the PS2 than anything else.