2017-02-15 Paul Eggert <eggert@cs.ucla.edu>
+ tests: Adjust to recent SET_BINARY change
+ * tests/test-binary-io.c (main):
+ * tests/test-binary-io.sh: Remove test for SET_BINARY.
+ * tests/test-closein.c, tests/test-fflush2.c, tests/test-ftell.c:
+ * tests/test-ftello.c, tests/test-nonblocking-pipe-child.c:
+ * tests/test-yesno.c: Use set_binary_mode, not SET_BINARY.
+
xsetmode: new module
This is to fix a problem noted by Eric Blake.
Code was using xfreopen to change files to binary mode, but this
fputs ("Hello\n", stdout);
break;
- case '2':
- /* Test the SET_BINARY macro. */
- SET_BINARY (1);
- fputs ("Hello\n", stdout);
- break;
-
default:
break;
}
tmpfiles="$tmpfiles t-bin-out0.tmp t-bin-out1.tmp t-bin-out2.tmp"
./test-binary-io${EXEEXT} 1 > t-bin-out1.tmp || exit 1
cmp t-bin-out0.tmp t-bin-out1.tmp > /dev/null || exit 1
-./test-binary-io${EXEEXT} 2 > t-bin-out2.tmp || exit 1
-cmp t-bin-out0.tmp t-bin-out2.tmp > /dev/null || exit 1
rm -fr $tmpfiles
/* close_stdin currently relies on ftell, but mingw ftell is
unreliable on text mode input. */
- SET_BINARY (0);
+ set_binary_mode (0, O_BINARY);
if (argc > 2)
close (0);
/* Avoid the well-known bugs of fflush() on streams in O_TEXT mode
on native Windows platforms. */
- SET_BINARY (0);
+ set_binary_mode (0, O_BINARY);
if (argc > 1)
switch (argv[1][0])
}
/* mingw ftell is unreliable on text mode input. */
- SET_BINARY (0);
+ set_binary_mode (0, O_BINARY);
/* Simple tests. */
ASSERT (ftell (stdin) == 0);
}
/* mingw ftell is unreliable on text mode input. */
- SET_BINARY (0);
+ set_binary_mode (0, O_BINARY);
/* Simple tests. For each test, make sure ftell and ftello agree. */
ASSERT (ftell (stdin) == 0);
/* STDIN_FILENO was created as binary in the parent process. But since an
fd's mode is stored in the process, not in the kernel, on native Windows
we need to set it as binary in the child process again. */
- SET_BINARY (STDIN_FILENO);
+ set_binary_mode (STDIN_FILENO, O_BINARY);
main_reader_loop (test, PIPE_DATA_BLOCK_SIZE, STDIN_FILENO);
position and the last filled buffer end position. (I.e. the repositioning
from the end-of-buffer to the expected position does not work if the input
file contains end-of-line markers in Unix convention.) */
- SET_BINARY (0);
+ set_binary_mode (0, O_BINARY);
if (1 < argc)
i = atoi (argv[1]);