diff options
author | Dai Sato <satodai@w3m.jp> | 2006-04-05 14:18:53 +0000 |
---|---|---|
committer | Dai Sato <satodai@w3m.jp> | 2006-04-05 14:18:53 +0000 |
commit | bc7f9c90263523dc9c19c63c520cbc8f46c3cbdb (patch) | |
tree | e7632ff276fbfed9e41e487bad1375f46c1f4fa7 /terms.c | |
parent | replace pclose passed to localcgi_post/get() with fclose in openURL() (diff) | |
download | w3m-bc7f9c90263523dc9c19c63c520cbc8f46c3cbdb.tar.gz w3m-bc7f9c90263523dc9c19c63c520cbc8f46c3cbdb.zip |
apply multiple patches on w3m-dev(-en) ML since Jun 2005 to Jan 2006.
Diffstat (limited to '')
-rw-r--r-- | terms.c | 121 |
1 files changed, 120 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: terms.c,v 1.53 2005/01/18 16:38:01 ukai Exp $ */ +/* $Id: terms.c,v 1.54 2006/04/05 14:18:54 inu Exp $ */ /* * An original curses library for EUC-kanji by Akinori ITO, December 1989 * revised by Akinori ITO, January 1995 @@ -15,7 +15,11 @@ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif +#ifndef __MINGW32_VERSION #include <sys/ioctl.h> +#else +#include <winsock.h> +#endif /* __MINGW32_VERSION */ #ifdef USE_MOUSE #ifdef USE_GPM #include <gpm.h> @@ -287,6 +291,42 @@ typedef struct sgttyb TerminalMode; #define MODEFLAG(d) ((d).sg_flags) #endif /* HAVE_SGTTY_H */ +#ifdef __MINGW32_VERSION +/* dummy struct */ +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + }; +typedef struct termios TerminalMode; +#define TerminalSet(fd,x) (0) +#define TerminalGet(fd,x) (0) +#define MODEFLAG(d) (0) + +/* dummy defines */ +#define SIGHUP (0) +#define SIGQUIT (0) +#define ECHO (0) +#define ISIG (0) +#define VEOF (0) +#define ICANON (0) +#define IXON (0) +#define IXOFF (0) + +char *ttyname(int); +#endif /* __MINGW32_VERSION */ + #define MAX_LINE 200 #define MAX_COLUMN 400 @@ -511,6 +551,7 @@ set_tty(void) void ttymode_set(int mode, int imode) { +#ifndef __MINGW32_VERSION TerminalMode ioval; TerminalGet(tty, &ioval); @@ -525,11 +566,13 @@ ttymode_set(int mode, int imode) printf("Error occured while set %x: errno=%d\n", mode, errno); reset_exit(SIGNAL_ARGLIST); } +#endif } void ttymode_reset(int mode, int imode) { +#ifndef __MINGW32_VERSION TerminalMode ioval; TerminalGet(tty, &ioval); @@ -544,6 +587,7 @@ ttymode_reset(int mode, int imode) printf("Error occured while reset %x: errno=%d\n", mode, errno); reset_exit(SIGNAL_ARGLIST); } +#endif /* __MINGW32_VERSION */ } #ifndef HAVE_SGTTY_H @@ -1830,6 +1874,44 @@ getch(void) return c; } +#ifdef USE_REMOTE +char +getch_select(int fd, int *fdn) +{ + int maxfd = tty; + fd_set rset; + + if (fd < 0 || fd == tty) { + *fdn = 0; + return getch(); + } + + if (maxfd < fd) + maxfd = fd; + + maxfd++; + + FD_ZERO(&rset); + FD_SET(tty, &rset); + FD_SET(fd, &rset); + + while (select(maxfd, &rset, NULL, NULL, NULL) < 1) { + FD_ZERO(&rset); + FD_SET(tty, &rset); + FD_SET(fd, &rset); + } + + if (FD_ISSET(tty, &rset)) { + *fdn = 0; + return getch(); + } else if (FD_ISSET(fd, &rset)) { + *fdn = 1; + } + return 0; +} +#endif + + #ifdef USE_MOUSE #ifdef USE_GPM char @@ -2172,3 +2254,40 @@ touch_cursor() #endif } #endif + +#ifdef __MINGW32_VERSION + +int tgetent(char *bp, char *name) +{ + return 0; +} + +int tgetnum(char *id) +{ + return -1; +} + +int tgetflag(char *id) +{ + return 0; +} + +char *tgetstr(char *id, char **area) +{ + id = ""; +} + +char *tgoto(char *cap, int col, int row) +{ +} + +int tputs(char *str, int affcnt, int (*putc)(char)) +{ +} + +char *ttyname(int tty) +{ + return "CON"; +} + +#endif /* __MINGW32_VERSION */ |