From cd1ec86bc5a464538e0773af976d362fc0945370 Mon Sep 17 00:00:00 2001 From: wlemb Date: Thu, 19 Feb 2004 08:27:15 +0000 Subject: * font/devlj4/Makefile.sub (DEVFILES): Updated to contain all new font and mapping files. * src/include/nonposix.h (FLUSH_INPUT_PIPE): New macro to empty an input pipe. This is needed for the MSVC compiler to make troff's `-o' option work. * src/roff/troff/div.cpp: Include nonposix.h. (cleanup_and_exit): Call FLUSH_INPUT_PIPE. --- src/include/nonposix.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/include') diff --git a/src/include/nonposix.h b/src/include/nonposix.h index a9e78cc4..a4f05c48 100644 --- a/src/include/nonposix.h +++ b/src/include/nonposix.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Eli Zaretskii (eliz@is.elta.co.il) This file is part of groff. @@ -29,8 +29,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if defined(__MSDOS__) || defined(__EMX__) \ || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__)) -/* Binary I/O nuisances. Note: "setmode" is right for DJGPP and - Borland; Windows compilers might need _setmode or some such. */ +/* Binary I/O nuisances. */ # include # include # ifdef HAVE_UNISTD_H @@ -57,7 +56,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # define setmode(f,m) _setmode(f,m) # define WAIT(s,p,m) _cwait(s,p,m) # define creat(p,m) _creat(p,m) -# define read(f,b,s) _read(f,b,s) +# define read(f,b,s) _read(f,b,s) +# define isatty(f) _isatty(f) # endif # define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0) # define FOPEN_RB "rb" @@ -120,6 +120,18 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #endif +#if defined(_WIN32) && !defined(__CYGWIN__) +# define FLUSH_INPUT_PIPE(fd) \ + do if (!isatty(fd)) \ + { \ + char drain[BUFSIZ]; \ + while (read(fd, drain, sizeof(drain)) > 0) \ + ; \ + } while (0) +#else +# define FLUSH_INPUT_PIPE(fd) do {} while(0) +#endif + /* Defaults, for Posix systems. */ #ifndef SET_BINARY -- cgit v1.2.1