Date: Sun, 20 Oct 1996 07:32:09 +0200 (IST) From: Eli Zaretskii To: DJ Delorie Cc: djgpp-workers AT delorie DOT com Subject: Textutils patch Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII The following patch is needed to correct the text/binary mode hassles with two of the programs in the Textutils package. Without the patch, you will have extra ^M characters added sometimes. *** gnu/txtutil1.19/src/tail.c~1 Sun Aug 4 15:30:34 1996 --- gnu/txtutil1.19/src/tail.c Fri Oct 18 19:43:30 1996 *************** main (int argc, char **argv) *** 1014,1020 **** /* We need binary I/O, since `tail' relies on `lseek' and byte counts. */ _fmode = O_BINARY; if (!isatty (0)) ! setmode (0, O_BINARY); #endif if (n_files == 0) --- 1014,1024 ---- /* We need binary I/O, since `tail' relies on `lseek' and byte counts. */ _fmode = O_BINARY; if (!isatty (0)) ! { ! setmode (0, O_BINARY); ! if (!isatty (1)) ! setmode (1, O_BINARY); ! } #endif if (n_files == 0) *** gnu/txtutil1.19/src/tac.c~1 Sun Aug 4 15:36:42 1996 --- gnu/txtutil1.19/src/tac.c Fri Oct 18 19:43:54 1996 *************** main (int argc, char **argv) *** 632,641 **** /* We need binary input, since `tac' relies on `lseek' and byte counts. */ _fmode = O_BINARY; if (!isatty (0)) ! setmode (0, O_BINARY); ! /* Binary output will leave the lines' ends (NL or CR/LF) intact. */ ! if (!isatty (STDOUT_FILENO)) ! setmode (STDOUT_FILENO, O_BINARY); #endif if (sentinel_length == 0) --- 632,643 ---- /* We need binary input, since `tac' relies on `lseek' and byte counts. */ _fmode = O_BINARY; if (!isatty (0)) ! { ! setmode (0, O_BINARY); ! /* Binary output will leave the lines' ends (NL or CR/LF) intact. */ ! if (!isatty (STDOUT_FILENO)) ! setmode (STDOUT_FILENO, O_BINARY); ! } #endif if (sentinel_length == 0)