+static UINT8 BitMask[] = {\r
+ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80\r
+ };\r
+\r
+#define WHICH8(c) ((unsigned char)(c) >> 3)\r
+#define WHICH_BIT(c) (BitMask[((c) & 0x7)])\r
+#define BITMAP64 ((UINT64 *)bitmap)\r
+\r
+static\r
+void\r
+BuildBitmap(unsigned char * bitmap, const char *s2, int n)\r
+{\r
+ unsigned char bit;\r
+ int index;\r
+\r
+ // Initialize bitmap. Bit 0 is always 1 which corresponds to '\0'\r
+ for (BITMAP64[0] = index = 1; index < n; index++) {\r
+ BITMAP64[index] = 0;\r
+ }\r
+\r
+ // Set bits in bitmap corresponding to the characters in s2\r
+ for (; *s2 != '\0'; s2++) {\r
+ index = WHICH8(*s2);\r
+ bit = WHICH_BIT(*s2);\r
+ bitmap[index] = bitmap[index] | bit;\r
+ }\r
+}\r
+\r
+/** The strpbrk function locates the first occurrence in the string pointed to\r
+ by s1 of any character from the string pointed to by s2.\r
+\r
+ @return The strpbrk function returns a pointer to the character, or a\r
+ null pointer if no character from s2 occurs in s1.\r
+**/\r
+char *\r
+strpbrk(const char *s1, const char *s2)\r
+{\r
+ UINT8 bitmap[ (((UCHAR_MAX + 1) / CHAR_BIT) + (CHAR_BIT - 1)) & ~7U];\r
+ UINT8 bit;\r
+ int index;\r
+\r
+ BuildBitmap( bitmap, s2, sizeof(bitmap) / sizeof(UINT64));\r
+\r
+ for( ; *s1 != '\0'; ++s1) {\r
+ index = WHICH8(*s1);\r
+ bit = WHICH_BIT(*s1);\r
+ if( (bitmap[index] & bit) != 0) {\r
+ return (char *)s1;\r
+ }\r
+ }\r
+ return NULL;\r
+}\r
+\r
+/** The strerror function maps the number in errnum to a message string.\r
+ Typically, the values for errnum come from errno, but strerror shall map\r
+ any value of type int to a message.\r
+\r
+ The implementation shall behave as if no library function calls the\r
+ strerror function.\r
+\r
+ @return The strerror function returns a pointer to the string, the\r
+ contents of which are locale specific. The array pointed to\r
+ shall not be modified by the program, but may be overwritten by\r
+ a subsequent call to the strerror function.\r
+**/\r
+char *\r
+strerror(int errnum)\r
+{\r
+ return errnum_message;\r
+}\r
+\r