From: Jim Meyering Date: Sun, 5 Dec 2004 19:28:15 +0000 (+0000) Subject: Test the __fpending function. X-Git-Tag: v5.3.0~208 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff13a286c7769664614d835c09653c83fcb1cb6c;p=thirdparty%2Fcoreutils.git Test the __fpending function. This ensures that if there is an error in the definition of the PENDING_OUTPUT_N_BYTES expression, we'll find about it right away; that value is used only in the rare event that close_stdout's fclose fails with EBADF. --- diff --git a/lib/t-fpending.c b/lib/t-fpending.c new file mode 100644 index 0000000000..10335cdd03 --- /dev/null +++ b/lib/t-fpending.c @@ -0,0 +1,24 @@ +/* Ensure that __fpending works. */ + +#include +#include +#include + +#include "__fpending.h" + +int +main () +{ + if (__fpending (stdout) != 0) + abort (); + + fputs ("foo", stdout); + if (__fpending (stdout) != 3) + abort (); + + fflush (stdout); + if (__fpending (stdout) != 0) + abort (); + + exit (0); +}