[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lynx-dev] DJGPP Patch for dev.18

From: Doug Kaufman
Subject: [Lynx-dev] DJGPP Patch for dev.18
Date: Wed, 2 Aug 2006 23:11:46 -0700 (PDT)

A user of the DOS port recently pointed out to me that entering data
for stdin from the keyboard ("lynx -" or "lynx -stdin") didn't work,
although piping the same data from a file did. It turns out that
setting stdout to O_BINARY also sets stdin to binary mode and puts the
console in raw mode. At that point there is no EOF to terminate the
input, since the DOS EOF (CTRL-Z) is now just an input character. Raw
console mode also disables SIGINT and SIGQUIT, so there is no way to
get out of the program.

With a few exceptions, the DJGPP console shouldn't be put into raw
mode. This patch keeps the console in text mode, while otherwise
allowing binary mode for stdin/stdout. Feel free to implement the same
idea in a different way.

I also fixed a minor problem with an undeclared DJGPP function
(ScreenClear) in LYCurses.c.

The MingW port seems to work with stdin without needing any similar


--- lynx2.8.6dev.18/lynx2-8-6/src/LYCurses.c.ori        2006-07-12 
21:29:02.000000000 -0800
+++ lynx2.8.6dev.18/lynx2-8-6/src/LYCurses.c    2006-08-02 22:09:54.000000000 
@@ -36,6 +36,10 @@
 extern int _NOSHARE(COLS);
 #endif /* VMS && __GNUC__ */
+#ifdef __DJGPP__
+#include <pc.h>
+#endif /* __DJGPP__ */
 #include <AttrList.h>
 #include <LYHash.h>
--- lynx2.8.6dev.18/lynx2-8-6/src/LYCurses.h.ori        2006-07-12 
21:29:02.000000000 -0800
+++ lynx2.8.6dev.18/lynx2-8-6/src/LYCurses.h    2006-08-02 07:37:08.000000000 
@@ -754,8 +754,11 @@
  * Note:  EMX has no corresponding variable like _fmode on DOS, but it does
  * have setmode.
-#if defined(_WINDOWS) || defined(DJGPP) || defined(__EMX__) || defined(WIN_EX)
+#if defined(_WINDOWS) || defined(__EMX__) || defined(WIN_EX)
 #define SetOutputMode(mode) fflush(stdout), setmode(fileno(stdout), mode)
+#elif defined(DJGPP)
+extern int setoutputmode(int);    
+#define SetOutputMode(mode) setoutputmode(mode)
 #define SetOutputMode(mode)    /* nothing */
--- lynx2.8.6dev.18/lynx2-8-6/src/LYUtils.c.ori 2006-07-12 21:29:02.000000000 
+++ lynx2.8.6dev.18/lynx2-8-6/src/LYUtils.c     2006-08-02 07:48:42.000000000 
@@ -7037,6 +7037,16 @@
 #ifdef __DJGPP__
+int setoutputmode(int mode)
+       if (isatty(fileno(stdout)))
+       {
+               fflush(stdout);
+               return setmode(fileno(stdout), O_TEXT);
+       }
+       fflush(stdout);
+       return setmode(fileno(stdout), mode);
 static char *escape_backslashes(char *source)
     char *result = 0;

Doug Kaufman
Internet: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]