7 /* Test string. Must NOT have duplicate characters! */
8 static char S[] = "Helo wrd!\n";
10 static char Found[256];
21 printf ("strchr(): ");
23 /* Get the length of the string */
26 /* Search for all characters in the string, including the terminator */
27 for (I = 0; I < Len+1; ++I) {
29 /* Search for this char */
32 /* Check if we found it */
33 if (P == 0 || (P - S) != I) {
34 printf ("Failed for code 0x%02X, offset %u!\n", S[I], I);
35 printf ("P = %04X offset = %04X\n", P, P-S);
39 /* Mark the char as checked */
43 /* Search for all other characters and make sure they aren't found */
44 for (I = 0; I < 256; ++I) {
46 if (strchr (S, (char)I) != 0) {
47 printf ("Failed for code 0x%02X\n", I);