2 #define _XOPEN_SOURCE 700
11 #define TEST(c) do { \
14 error("%s failed (errno = %d)\n", #c, errno); \
19 char tmp[] = "/tmp/testsuite-XXXXXX";
24 TEST((fd = mkstemp(tmp)) > 2);
25 TEST(write(fd, "hello", 6)==6);
26 TEST(f = fdopen(fd, "rb"));
29 TEST(fseeko(f, 0, SEEK_SET)==0);
30 TEST(fgets(foo, sizeof foo, f));
31 if (strcmp(foo,"hello") != 0)
32 error("fgets read back: \"%s\"; wanted: \"hello\"\n", foo);
36 TEST(unlink(tmp) != -1);