summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-01-01 22:41:58 +0000
committerJim Meyering <jim@meyering.net>1999-01-01 22:41:58 +0000
commit59998135d08d667353977036c6d532d88373f767 (patch)
treeaa3cf8751dd914f9b627ec813b964baf08be60cb /src
parent87f9e231c340b939bf691842df8fb30e88402acd (diff)
downloadcoreutils-59998135d08d667353977036c6d532d88373f767.tar.xz
(unexpand): Use binary I/O where appropriate.
Diffstat (limited to 'src')
-rw-r--r--src/unexpand.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/unexpand.c b/src/unexpand.c
index ebb875ce4..5c4702494 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -1,5 +1,5 @@
/* unexpand - convert spaces to tabs
- Copyright (C) 89, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 89, 91, 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -229,6 +229,9 @@ unexpand (void)
if (fp == NULL)
return;
+ /* Binary I/O will preserve the original EOL style (DOS/Unix) of files. */
+ SET_BINARY2 (fileno (fp), STDOUT_FILENO);
+
for (;;)
{
c = getc (fp);
@@ -315,7 +318,10 @@ unexpand (void)
if (fp == NULL)
break; /* No more files. */
else
- continue;
+ {
+ SET_BINARY2 (fileno (fp), STDOUT_FILENO);
+ continue;
+ }
}
if (convert)