X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/c8d3a25c0981020e1b8aa3bf96a4a0059be82431..6ffb560b2a940d19419ac5afe11418588ef8c61f:/lib-src/hexl.c
diff --git a/lib-src/hexl.c b/lib-src/hexl.c
index 08da007526..490f72731b 100644
--- a/lib-src/hexl.c
+++ b/lib-src/hexl.c
@@ -1,5 +1,5 @@
/* Convert files for Emacs Hexl mode.
- Copyright (C) 1989, 2001-2012 Free Software Foundation, Inc.
+ Copyright (C) 1989, 2001-2015 Free Software Foundation, Inc.
Author: Keith Gabryelski
(according to authors.el)
@@ -24,25 +24,14 @@ along with this program. If not, see . */
#include
#include
-#ifdef DOS_NT
-#include
-#if __DJGPP__ >= 2
-#include
-#endif
-#endif
-#ifdef WINDOWSNT
-#include
-#endif
+
+#include
#define DEFAULT_GROUPING 0x01
#define DEFAULT_BASE 16
-#undef TRUE
-#undef FALSE
-#define TRUE (1)
-#define FALSE (0)
-
-int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
+int base = DEFAULT_BASE;
+bool un_flag = false, iso_flag = false, endian = true;
int group_by = DEFAULT_GROUPING;
char *progname;
@@ -83,7 +72,7 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-un") || !strcmp (*argv, "-de"))
{
- un_flag = TRUE;
+ un_flag = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-hex"))
@@ -93,7 +82,7 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-iso"))
{
- iso_flag = TRUE;
+ iso_flag = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-oct"))
@@ -103,12 +92,12 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-big-endian"))
{
- endian = 1;
+ endian = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-little-endian"))
{
- endian = 0;
+ endian = false;
--argc; argv++;
}
else if (!strcmp (*argv, "-group-by-8-bits"))
@@ -129,7 +118,7 @@ main (int argc, char **argv)
else if (!strcmp (*argv, "-group-by-64-bits"))
{
group_by = 0x07;
- endian = 0;
+ endian = false;
--argc; argv++;
}
else
@@ -159,20 +148,12 @@ main (int argc, char **argv)
if (un_flag)
{
- char buf[18];
-
-#ifdef DOS_NT
-#if (__DJGPP__ >= 2) || (defined WINDOWSNT)
- if (!isatty (fileno (stdout)))
- setmode (fileno (stdout), O_BINARY);
-#else
- (stdout)->_flag &= ~_IOTEXT; /* print binary */
- _setmode (fileno (stdout), O_BINARY);
-#endif
-#endif
+ SET_BINARY (fileno (stdout));
+
for (;;)
{
- register int i, c = 0, d;
+ int i, c = 0, d;
+ char buf[18];
#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10)
@@ -214,15 +195,7 @@ main (int argc, char **argv)
}
else
{
-#ifdef DOS_NT
-#if (__DJGPP__ >= 2) || (defined WINDOWSNT)
- if (!isatty (fileno (fp)))
- setmode (fileno (fp), O_BINARY);
-#else
- (fp)->_flag &= ~_IOTEXT; /* read binary */
- _setmode (fileno (fp), O_BINARY);
-#endif
-#endif
+ SET_BINARY (fileno (fp));
address = 0;
string[0] = ' ';
string[17] = '\0';