1 // fgets must not modify the buffer on eof
7 #define ASSERT(c) do { if (!(c)) t_error("%s failed\n", #c); } while(0)
15 ASSERT((f = fmemopen(buf, sizeof buf, "r")) != 0);
16 ASSERT(fgets(s, sizeof s, f) == s);
17 ASSERT(strcmp(s, buf) == 0);
18 ASSERT(fgets(s, sizeof s, f) == 0);
20 t_error("fgets modified the buffer after eof\n");