|
DJGPP Patch for dev.18: msg#00004web.lynx.devel
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 changes. Doug --- 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 -0800 @@ -36,6 +36,10 @@ extern int _NOSHARE(COLS); #endif /* VMS && __GNUC__ */ +#ifdef __DJGPP__ +#include <pc.h> +#endif /* __DJGPP__ */ + #ifdef USE_COLOR_STYLE #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 -0800 @@ -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) #else #define SetOutputMode(mode) /* nothing */ #endif --- lynx2.8.6dev.18/lynx2-8-6/src/LYUtils.c.ori 2006-07-12 21:29:02.000000000 -0800 +++ lynx2.8.6dev.18/lynx2-8-6/src/LYUtils.c 2006-08-02 07:48:42.000000000 -0800 @@ -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: dkaufman@xxxxxxxxx _______________________________________________ Lynx-dev mailing list Lynx-dev@xxxxxxxxxx http://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: HTMLized description of settings?, Thomas Dickey |
|---|---|
| Next by Date: | Re: HTMLized description of settings?, Doug Kaufman |
| Previous by Thread: | HTMLized description of settings?, Doug Kaufman |
| Next by Thread: | POST problem, Philip Webb |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |