/* Convert files for Emacs Hexl mode.
- Copyright (C) 1989, 2001-2015 Free Software Foundation, Inc.
+ Copyright (C) 1989, 2001-2016 Free Software Foundation, Inc.
-Author: Keith Gabryelski
-(according to authors.el)
+Author: Keith Gabryelski (according to authors.el)
This file is not considered part of GNU Emacs.
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
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <stdio.h>
#include <ctype.h>
-#ifdef DOS_NT
-#include <fcntl.h>
-#if __DJGPP__ >= 2
-#include <io.h>
-#endif
-#endif
-#ifdef WINDOWSNT
-#include <io.h>
-#endif
+
+#include <binary-io.h>
#define DEFAULT_GROUPING 0x01
#define DEFAULT_BASE 16
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)
}
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';
else
{
if (!i)
- printf ("%08lx: ", address);
+ printf ("%08lx: ", address + 0ul);
if (iso_flag)
string[i+1] =
else
string[i+1] = (c < 0x20 || c >= 0x7F) ? '.' : c;
- printf ("%02x", c);
+ printf ("%02x", c + 0u);
}
if ((i&group_by) == group_by)