bug-hsearch1.c 507 B

12345678910111213141516171819202122232425262728293031
  1. #include <search.h>
  2. #include <stdio.h>
  3. static int
  4. do_test (void)
  5. {
  6. if (hcreate (1) == 0)
  7. {
  8. puts ("hcreate failed");
  9. return 1;
  10. }
  11. ENTRY e;
  12. e.key = (char *) "a";
  13. e.data = (char *) "b";
  14. if (hsearch (e, ENTER) == NULL)
  15. {
  16. puts ("ENTER failed");
  17. return 1;
  18. }
  19. ENTRY s;
  20. s.key = (char *) "c";
  21. if (hsearch (s, FIND) != NULL)
  22. {
  23. puts ("FIND succeeded");
  24. return 1;
  25. }
  26. return 0;
  27. }
  28. #define TEST_FUNCTION do_test ()
  29. #include "../test-skeleton.c"