tst-strtok.c 437 B

1234567891011121314151617181920212223
  1. /* Testcase for strtok reported by Andrew Church <achurch@achurch.org>. */
  2. #include <stdio.h>
  3. #include <string.h>
  4. int
  5. main (void)
  6. {
  7. char buf[1] = { 0 };
  8. int result = 0;
  9. if (strtok (buf, " ") != NULL)
  10. {
  11. puts ("first strtok call did not return NULL");
  12. result = 1;
  13. }
  14. else if (strtok (NULL, " ") != NULL)
  15. {
  16. puts ("second strtok call did not return NULL");
  17. result = 1;
  18. }
  19. return result;
  20. }