aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/hexl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src/hexl.c')
-rw-r--r--lib-src/hexl.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/lib-src/hexl.c b/lib-src/hexl.c
index 9e21ddf9de6..51744ab08a2 100644
--- a/lib-src/hexl.c
+++ b/lib-src/hexl.c
@@ -24,15 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 24
25#include <stdio.h> 25#include <stdio.h>
26#include <ctype.h> 26#include <ctype.h>
27#ifdef DOS_NT 27
28#include <fcntl.h> 28#include <binary-io.h>
29#if __DJGPP__ >= 2
30#include <io.h>
31#endif
32#endif
33#ifdef WINDOWSNT
34#include <io.h>
35#endif
36 29
37#define DEFAULT_GROUPING 0x01 30#define DEFAULT_GROUPING 0x01
38#define DEFAULT_BASE 16 31#define DEFAULT_BASE 16
@@ -155,20 +148,12 @@ main (int argc, char **argv)
155 148
156 if (un_flag) 149 if (un_flag)
157 { 150 {
158 char buf[18]; 151 SET_BINARY (fileno (stdout));
159 152
160#ifdef DOS_NT
161#if (__DJGPP__ >= 2) || (defined WINDOWSNT)
162 if (!isatty (fileno (stdout)))
163 setmode (fileno (stdout), O_BINARY);
164#else
165 (stdout)->_flag &= ~_IOTEXT; /* print binary */
166 _setmode (fileno (stdout), O_BINARY);
167#endif
168#endif
169 for (;;) 153 for (;;)
170 { 154 {
171 register int i, c = 0, d; 155 int i, c = 0, d;
156 char buf[18];
172 157
173#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) 158#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10)
174 159
@@ -210,15 +195,7 @@ main (int argc, char **argv)
210 } 195 }
211 else 196 else
212 { 197 {
213#ifdef DOS_NT 198 SET_BINARY (fileno (fp));
214#if (__DJGPP__ >= 2) || (defined WINDOWSNT)
215 if (!isatty (fileno (fp)))
216 setmode (fileno (fp), O_BINARY);
217#else
218 (fp)->_flag &= ~_IOTEXT; /* read binary */
219 _setmode (fileno (fp), O_BINARY);
220#endif
221#endif
222 address = 0; 199 address = 0;
223 string[0] = ' '; 200 string[0] = ' ';
224 string[17] = '\0'; 201 string[17] = '\0';