Fix *nix builds

This commit is contained in:
Stas Degteff 2006-02-18 14:06:59 +00:00
parent 6920dc1246
commit 3c82e53d5f
3 changed files with 20 additions and 13 deletions

View File

@ -482,7 +482,7 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea)
FILE *pipe_in; FILE *pipe_in;
std::string pipe_buff; std::string pipe_buff;
if ((pipe_in = _popen(argbeg, "rt")) != NULL ) if ((pipe_in = popen(argbeg, "rt")) != NULL )
{ {
char buffer[1024]; char buffer[1024];
while (!feof(pipe_in)) while (!feof(pipe_in))
@ -491,7 +491,7 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea)
pipe_buff += buffer; pipe_buff += buffer;
} }
_pclose(pipe_in); pclose(pipe_in);
} }
*argend = '`'; *argend = '`';

View File

@ -101,6 +101,13 @@
#define NL "\n" #define NL "\n"
#endif #endif
/* ----------------------------------------------------------------*/
#if defined(_MSC_VER)
#define popen(f,m) _popen(f,m)
#define pclose(fh) _pclose(fh)
#endif
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
// Spellchecker using dynamic library load */ // Spellchecker using dynamic library load */
#if !defined(GCFG_NOSPELLDLL) && !defined(__WIN32__) #if !defined(GCFG_NOSPELLDLL) && !defined(__WIN32__)

View File

@ -181,7 +181,7 @@ GKbd::GKbd() {
Init(); Init();
#if defined(__UNIX__) && !defined(__USE_NCURSES__) && !defined(__BEOS__) #if defined(__UNIX__) && !defined(__USE_NCURSES__) && !defined(__BEOS__)
gkbd_keymap_init(); gkbd_keymap_init();
@ -288,7 +288,7 @@ GKbd::GKbd() {
gkbd_define_keysym("\033\x09", Key_A_Tab); gkbd_define_keysym("\033\x09", Key_A_Tab);
#elif defined(__BEOS__) #elif defined(__BEOS__)
gkbd_keymap_init(); gkbd_keymap_init();
char escseq[2]; char escseq[2];
@ -349,17 +349,17 @@ GKbd::GKbd() {
GKbd::~GKbd() { GKbd::~GKbd() {
#if defined(__USE_NCURSES__) #if defined(__USE_NCURSES__)
if(0 == (--curses_initialized)) if(0 == (--curses_initialized))
endwin(); endwin();
#elif defined(__WIN32__) #elif defined(__WIN32__)
if(gkbd_kbdmode & KBD_TEXTMODE) if(gkbd_kbdmode & KBD_TEXTMODE)
SetConsoleMode(gkbd_hin, gkbd_kbdmode); SetConsoleMode(gkbd_hin, gkbd_kbdmode);
#elif defined(__UNIX__) #elif defined(__UNIX__)
gkbd_keymap_reset(); gkbd_keymap_reset();
gkbd_tty_reset(); gkbd_tty_reset();
@ -1072,7 +1072,7 @@ gkey kbxget_raw(int mode) {
} }
return key; return key;
} }
// Get keystroke // Get keystroke
key = gkbd_cursgetch(mode); key = gkbd_cursgetch(mode);
if(key == ERR) if(key == ERR)
@ -1105,7 +1105,7 @@ gkey kbxget_raw(int mode) {
} }
if((key2 != ERR) and (mode == 1)) if((key2 != ERR) and (mode == 1))
ungetch(key2); ungetch(key2);
} }
// Curses sequence; lookup in nice table above // Curses sequence; lookup in nice table above
else if((key >= KEY_MIN) and (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int))) else if((key >= KEY_MIN) and (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int)))
@ -1118,7 +1118,7 @@ gkey kbxget_raw(int mode) {
k = Key_Space; k = Key_Space;
else else
k = key; k = key;
if(mode == 1) if(mode == 1)
ungetch(key); ungetch(key);
@ -1377,7 +1377,7 @@ gkey kbxget_raw(int mode) {
if(mode == 2) { if(mode == 2) {
int key; int key;
#ifdef __linux__ #if defined(__linux__)
// Under Linux we could use TIOCLINUX fn. 6 to read shift states on console // Under Linux we could use TIOCLINUX fn. 6 to read shift states on console
// Of course it is very unportable but should produce good results :-) // Of course it is very unportable but should produce good results :-)
key = 6; key = 6;