mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Use binary-io module, O_BINARY, and "b" flag.
* admin/merge-gnulib (GNULIB_MODULES): Add binary-io. It was already present implicitly; this just makes the dependence explicit. * lib-src/etags.c, lib-src/hexl.c, lib-src/make-docfile.c: Include binary-io.h instead of fcntl.h and/or io.h. (main): Use set_binary_mode or SET_BINARY in place of handcrafted code. * lib-src/etags.c (main) [DOS_NT]: * lib-src/movemail.c (main) [WINDOWSNT]: Don't mess with _fmode. * lib-src/etags.c (main, process_file_name, analyse_regex): Use fopen/popen's "b" flag instead. * lib-src/movemail.c (main, popmail): Use open/lk_open/mkostemp's O_BINARY instead. * src/callproc.c (create_temp_file): Use mkostemp's O_BINARY flag. * src/emacs.c [MSDOS]: * src/emacs.c (main) [DOS_NT]: Don't mess with _fmode. (main) [MSDOS]: Use SET_BINARY instead of setmode. * src/minibuf.c: Include binary-io.h instead of fcntl.h. (read_minibuf_noninteractive): Use set_binary_mode instead of handcrafted code. Don't call emacs_set_tty if emacs_get_tty failed. * src/sysdep.c, src/systty.h (emacs_get_tty): Return int, not void. * src/sysdep.c (emacs_open, emacs_pipe): Use O_BINARY. * src/w32.c (pipe2): Adjust eassert to include O_BINARY. Fixes: debbugs:18006
This commit is contained in:
parent
091adafaac
commit
ba1ed52f0c
14 changed files with 93 additions and 117 deletions
|
|
@ -24,15 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#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
|
||||
|
|
@ -155,20 +148,12 @@ main (int argc, char **argv)
|
|||
|
||||
if (un_flag)
|
||||
{
|
||||
char buf[18];
|
||||
SET_BINARY (fileno (stdout));
|
||||
|
||||
#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
|
||||
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)
|
||||
|
||||
|
|
@ -210,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';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue