From 8665ccd219809d9fb758249454c03b9a914bf017 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Mon, 23 Mar 1998 05:27:15 +0000 Subject: [PATCH] Numerous OS/2 and NT fixes. Borland C++ for OS/2 supported --- gnome/gtools.c | 1 + nt/ChangeLog | 4 + nt/Makefile.NT | 1 - nt/key.nt.c | 283 ++++++++++++----------------------------------- nt/slint.nt.c | 46 +------- os2/ChangeLog | 11 ++ os2/Makefile | 2 +- os2/Makefile.EMX | 4 - os2/config.h | 68 +++++++----- os2/key.os2.c | 41 ++++--- os2/slint.os2.c | 46 +------- os2/util.os2.c | 8 +- slang/slgetkey.c | 8 +- src/ChangeLog | 14 +++ src/main.c | 28 ++--- src/myslang.h | 6 +- src/util.h | 2 + 17 files changed, 190 insertions(+), 383 deletions(-) diff --git a/gnome/gtools.c b/gnome/gtools.c index 4e339d67b..eabe01028 100644 --- a/gnome/gtools.c +++ b/gnome/gtools.c @@ -3,6 +3,7 @@ * * Written by Miguel de Icaza */ +#include #include "util.h" #include #include diff --git a/nt/ChangeLog b/nt/ChangeLog index dc6e187bc..a3f796ba3 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +Mon Mar 23 08:16:12 1998 Pavel Roskin + + * nt/key.nt.c: cleanup, more keys work (not all) + Sat Mar 7 14:43:27 1998 Pavel Roskin * nt/Makefile.NT, nt/Makefile.VC4: rewritten for GNU make. diff --git a/nt/Makefile.NT b/nt/Makefile.NT index e314641ee..d12a77cc6 100644 --- a/nt/Makefile.NT +++ b/nt/Makefile.NT @@ -113,7 +113,6 @@ SRCS= $(EXTRA_MC_SRCS) \ dirhist.c \ main.c \ popt.c \ - mouse.c \ text.c \ screen.c diff --git a/nt/key.nt.c b/nt/key.nt.c index 504106bd6..cd3208928 100644 --- a/nt/key.nt.c +++ b/nt/key.nt.c @@ -44,15 +44,6 @@ int double_click_speed; /* they are here to keep linker happy */ int mou_auto_repeat; int use_8th_bit_as_meta = 0; -/* Prototypes */ -static int EscapeKey (char* seq); -static int ControlKey (char* seq); -static int AltKey (char *seq); - -static int VKtoCurses (int vkcode); -static int correct_key_code (int c); - - /* Static Tables */ struct { int key_code; @@ -81,13 +72,6 @@ struct { { KEY_IC, VK_INSERT }, { KEY_DC, VK_DELETE }, { KEY_BACKSPACE, VK_BACK }, - { '\t', VK_TAB }, -// { KEY_ENTER, VK_RETURN }, -// { KEY_ENTER, VK_EXECUTE }, - { '\n', VK_RETURN }, - { '\n', VK_EXECUTE }, - { ' ', VK_SPACE }, -// { KEY_PRINT, VK_SNAPSHOT }, { KEY_PPAGE, VK_PRIOR }, // Movement keys { KEY_NPAGE, VK_NEXT }, @@ -98,72 +82,78 @@ struct { { KEY_HOME, VK_HOME }, { KEY_END, VK_END }, - { KEY_KP_MULTIPLY, VK_MULTIPLY }, // Numeric pad - { KEY_KP_ADD, VK_ADD }, - { KEY_KP_SUBTRACT, VK_SUBTRACT }, + { ALT('*'), VK_MULTIPLY }, // Numeric pad + { ALT('+'), VK_ADD }, + { ALT('-'), VK_SUBTRACT }, -/* Control key codes */ - { 0, VK_CONTROL }, /* Control */ - { 0, VK_MENU }, /* Alt */ -// { 0, VK_ESCAPE }, /* ESC */ - { ESC_CHAR, VK_ESCAPE }, /* ESC */ + { ESC_CHAR, VK_ESCAPE }, /* ESC */ -/* Key codes to ignore */ - { -1, VK_SHIFT }, /* Shift when released generates a key event */ - { -1, VK_CAPITAL }, /* Caps-lock */ - -#if WINVER >= 0x400 /* new Chicago key codes (not in 3.x headers) */ - { -1, VK_APPS }, /* "Application key" */ - { -1, VK_LWIN }, /* Left "Windows" key */ - { -1, VK_RWIN }, /* Right "Windows" key */ -#endif { 0, 0} }; -/* Special handlers for control key codes - Note that howmany must be less than seq_buffer len -*/ -struct { - int vkcode; - int (*func_hdlr)(char *); - int howmany; -} key_control_table[] = { - { VK_ESCAPE, EscapeKey, 1 }, - { VK_CONTROL, ControlKey, 1 }, - { VK_MENU, AltKey, 1 }, - { 0, NULL, 0}, -}; - /* init_key - Called in main.c to initialize ourselves Get handle to console input */ void init_key (void) { - win32APICALL_HANDLE (hConsoleInput, /* = */ GetStdHandle (STD_INPUT_HANDLE)); + win32APICALL_HANDLE (hConsoleInput, GetStdHandle (STD_INPUT_HANDLE)); } -/* The maximum sequence length (32 + null terminator) */ -static int seq_buffer[33]; -static int *seq_append = 0; - -static int push_char (int c) +int ctrl_pressed () { - if (!seq_append) - seq_append = seq_buffer; - - if (seq_append == &(seq_buffer [sizeof (seq_buffer)-2])) + return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED); +} + +int shift_pressed () +{ + return dwSaved_ControlState & SHIFT_PRESSED; +} + +int alt_pressed () +{ + return dwSaved_ControlState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED); +} + +static int VKtoCurses (int a_vkc) +{ + int i; + + for (i = 0; key_table[i].vkcode != 0; i++) + if (a_vkc == key_table[i].vkcode) { + return key_table[i].key_code; + } + return 0; +} + +static int translate_key_code(int asc, int scan) +{ + int c; + c = VKtoCurses (scan); + if (!asc && !c) return 0; - *(seq_append++) = c; - *seq_append = 0; - return 1; + if (asc && c) + return c; + if (!asc) + { + if (shift_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(10))) + c += 10; + if (alt_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(2))) + c += 10; + if (alt_pressed() && (c == KEY_F(7))) + c = ALT('?'); + if (ctrl_pressed() && c == '\t') + c = ALT('\t'); + return c; + } + if (ctrl_pressed()) + return XCTRL(asc); + if (alt_pressed()) + return ALT(asc); + if (asc == 13) + return 10; + return asc; } -void define_sequence (int code, char* vkcode, int action) -{ -} - -static int *pending_keys; - int get_key_code (int no_delay) { INPUT_RECORD ir; /* Input record */ @@ -178,18 +168,6 @@ int get_key_code (int no_delay) return 0; } - -pend_send: - if (pending_keys) { - int d = *pending_keys++; - if (!*pending_keys){ - pending_keys = 0; - seq_append = 0; - } - return d; - } - - do { win32APICALL(ReadConsoleInput(hConsoleInput, &ir, 1, &dw)); switch (ir.EventType) { @@ -200,9 +178,10 @@ pend_send: vkcode = ir.Event.KeyEvent.wVirtualKeyCode; ch = ir.Event.KeyEvent.uChar.AsciiChar; dwSaved_ControlState = ir.Event.KeyEvent.dwControlKeyState; - - j = VKtoCurses(vkcode); - return j ? j : ch; + j = translate_key_code (ch, vkcode); + if (j) + return j; + break; case MOUSE_EVENT: // Save event as a GPM-like event @@ -226,58 +205,6 @@ pend_send: return 0; } -static int VKtoCurses (int a_vkc) -{ - int i; - - // Replace key code with that in table - for (i=0; key_table[i].vkcode != 0 || key_table[i].key_code != 0; i++) - if (a_vkc == key_table[i].vkcode) { - if (key_table[i].key_code) - return correct_key_code (key_table[i].key_code); - } - return 0; -} - -static int correct_key_code (int c) -{ - /* Check Control State */ - if (ctrl_pressed()) - if (c == '\t') - /* Make Ctrl-Tab same as reserved Alt-Tab */ - c = ALT('\t'); - else - c = XCTRL(c); - - if (alt_pressed()) - c = ALT(c); - - if (shift_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(10))) - c += 10; - if (alt_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(2))) - c += 10; - if (alt_pressed() && (c == KEY_F(7))) - c = ALT('?'); - switch (c) { - case KEY_KP_ADD: - c = alternate_plus_minus ? ALT('+') : '+'; - break; - case KEY_KP_SUBTRACT: - c = alternate_plus_minus ? ALT('-') : '-'; - break; - case KEY_KP_MULTIPLY: - c = alternate_plus_minus ? ALT('*') : '*'; - break; - case -1: - c = 0; - break; - default: - break; - } - - return c; -} - static int getch_with_delay (void) { int c; @@ -292,9 +219,6 @@ static int getch_with_delay (void) return c; } - -extern int max_dirt_limit; - /* Returns a character read from stdin with appropriate interpretation */ int get_event (Gpm_Event *event, int redo_event, int block) { @@ -311,25 +235,11 @@ int get_event (Gpm_Event *event, int redo_event, int block) vfs_timeout_handler (); - /* Repeat if using mouse */ -#ifdef HAVE_SLANG - while ((xmouse_flag) && !pending_keys) - { -// SLms_GetEvent (event); - *event = evSaved_Event; - } -#endif - - c = block ? getch_with_delay () : get_key_code (1); - if (!c) { /* Code is 0, so this is a Control key or mouse event */ -#ifdef HAVE_SLANG -// SLms_GetEvent (event); - *event = evSaved_Event; -#else - ms_GetEvent (event); /* my curses */ -#endif - return EV_NONE; /* FIXME: when should we return EV_MOUSE ? */ + + if (!c) { + /* Code is 0, so this is a Control key or mouse event */ + return EV_NONE; /* FIXME: mouse not supported */ } return c; @@ -346,44 +256,6 @@ int mi_getch () return key; } -/* - Special handling of ESC key when old_esc_mode: - ESC+ a-z,\n\t\v\r! = ALT(c) - ESC + ' '|ESC = ESC - ESC+0-9 = F(c-'0') -*/ -static int EscapeKey (char* seq) -{ - int c = *seq; - - if (old_esc_mode) { - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') - || (c == '\n') || (c == '\t') || (c == XCTRL('h')) - || (c == KEY_BACKSPACE) || (c == '!') || (c == '\r') - || c == 127 || c == '+' || c == '-' || c == '\\' - || c == '?') - c = ALT(c); - else if (isdigit(c)) - c = KEY_F (c-'0'); - else if (c == ' ') - c = ESC_CHAR; - return c; - } - else - return 0; /* i.e. return esc then c */ -} - -/* Control and Alt - */ -static int ControlKey (char* seq) -{ - return XCTRL(*seq); -} -static int AltKey (char *seq) -{ - return ALT(*seq); -} - /* is_idle - A function to check if we're idle. It checks for any waiting event (that can be a Key, Mouse event, @@ -418,23 +290,8 @@ int get_modifier() return retval; } -int ctrl_pressed () -{ - return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED); -} - -int shift_pressed () -{ - return dwSaved_ControlState & SHIFT_PRESSED; -} - -int alt_pressed () -{ - return dwSaved_ControlState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED); -} - -/* void functions for UNIX copatibility */ -void try_channels (int set_timeout) +/* void functions for UNIX compatibility */ +void define_sequence (int code, char* vkcode, int action) { } void channels_up() @@ -443,11 +300,11 @@ void channels_up() void channels_down() { } -void learn_keys() -{ - message (1, "Learn Keys", "Sorry, no learn keys on Win32"); -} void init_key_input_fd (void) { } +/* mouse is not yet supported, sorry */ +void init_mouse (void) {} +void shut_mouse (void) {} + #endif /* _OS_NT */ diff --git a/nt/slint.nt.c b/nt/slint.nt.c index 9db359bd6..f96b3a1f9 100644 --- a/nt/slint.nt.c +++ b/nt/slint.nt.c @@ -30,48 +30,6 @@ #ifdef HAVE_SLANG -/* {{{ Copied from ../slang/slgetkey.c, removed the DEC_8Bit_HACK, */ -extern unsigned int SLang_Input_Buffer_Len; -extern unsigned char SLang_Input_Buffer []; -extern unsigned int SLsys_getkey (void); -extern int SLsys_input_pending (int); - -static unsigned int SLang_getkey2 (void) -{ - unsigned int imax; - unsigned int ch; - - if (SLang_Input_Buffer_Len) - { - ch = (unsigned int) *SLang_Input_Buffer; - SLang_Input_Buffer_Len--; - imax = SLang_Input_Buffer_Len; - - memcpy ((char *) SLang_Input_Buffer, - (char *) (SLang_Input_Buffer + 1), imax); - return(ch); - } - else return(SLsys_getkey ()); -} - -static int SLang_input_pending2 (int tsecs) -{ - int n; - unsigned char c; - if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len; - - n = SLsys_input_pending (tsecs); - - if (n <= 0) return 0; - - c = (unsigned char) SLang_getkey2 (); - SLang_ungetkey_string (&c, 1); - - return n; -} -/* }}} */ - -//?? static void slang_sigterm () { SLsmg_reset_smg (); @@ -233,10 +191,10 @@ void load_terminfo_keys () int getch () { if (no_slang_delay) - if (SLang_input_pending2 (0) == 0) + if (SLang_input_pending (0) == 0) return -1; - return SLang_getkey2 (); + return SLang_getkey (); } extern int slow_terminal; diff --git a/os2/ChangeLog b/os2/ChangeLog index ec05ae847..e7713d2c8 100644 --- a/os2/ChangeLog +++ b/os2/ChangeLog @@ -1,3 +1,14 @@ +Mon Mar 23 08:10:28 1998 Pavel Roskin + + * os2/Makefile.BC2: new file for Borland C++ version 2 + + * os2/key.os2.c: cleanup, more keys work (not all) + + * os2/util.os2.c: Windows' programs temporaly disabled + in order to make mc work without PM + + * os2/config.h: Borland C++ fixes + Sat Mar 7 14:19:29 1998 Pavel Roskin * os2/Makefile.OS2, os2/Makefile.EMX: new files. Use diff --git a/os2/Makefile b/os2/Makefile index 1072da0ae..d22a8aa74 100644 --- a/os2/Makefile +++ b/os2/Makefile @@ -8,7 +8,7 @@ include ../Make.common -FILES = Makefile Makefile.EMX Makefile.OS2 chmod.os2.c config.h \ +FILES = Makefile Makefile.EMX Makefile.BC2 Makefile.OS2 chmod.os2.c config.h \ cons.handler.os2.c cons.saver.h direct.h dirent.h dirent.os2.c \ drive.h drive.os2.c inst.cmd key.os2.c mc.def mc.ico slint.os2.c \ util.os2.c diff --git a/os2/Makefile.EMX b/os2/Makefile.EMX index 47c86aa69..72e87ca44 100644 --- a/os2/Makefile.EMX +++ b/os2/Makefile.EMX @@ -10,10 +10,6 @@ MC_LIBS= -# ---- Path (case-sensitive!) is searched for executables -# If the command line contains quotes, it is passed to shell -# Errors are ignored in this case! -Path=d:/emx/bin CC=gcc.exe # Just comment RSC out if you have problems with resources # RSC=rc.exe diff --git a/os2/config.h b/os2/config.h index b363ff72b..20a5ad355 100644 --- a/os2/config.h +++ b/os2/config.h @@ -56,10 +56,11 @@ // --------------------------------------------------------------------------- // Headers #define STDC_HEADERS +#define HAVE_STDLIB_H #define HAVE_STRING_H #define HAVE_DIRENT_H #define HAVE_LIMITS_H - +#define HAVE_FCNTL_H #define NO_UNISTD_H // --------------------------------------------------------------------------- @@ -72,13 +73,11 @@ #define HAVE_STRDUP #define HAVE_STRERROR #define HAVE_TRUNCATE + #define REGEX_MALLOC #define NO_TERM #define NO_INFOMOUNT -#ifndef __EMX__ -#define HAVE_SHORT_MKDIR -#endif // --------------------------------------------------------------------------- // Windowing library @@ -92,34 +91,29 @@ // --------------------------------------------------------------------------- // Typedefs (some useless under NT) -typedef unsigned int umode_t; #ifndef __EMX__ typedef int gid_t; // Not defined in typedef int uid_t; -typedef int mode_t; typedef int pid_t; +#endif +typedef unsigned int umode_t; + +#ifndef __BORLANDC__ +typedef int mode_t; typedef unsigned int nlink_t; +#endif #define INLINE #define inline -#define ENOTDIR -1 -#endif /* not __EMX__ */ // --------------------------------------------------------------------------- // File attributes -#define S_ISBLK(m) 0 /* Some of these are not actual values*/ -#define S_ISLNK(x) 0 -#ifndef __EMX__ +#define S_ISLNK(x) 0 + +#ifndef __WATCOMC__ // Already defined in Watcom C headers -#define S_ISFIFO(x) 0 -#define S_IFBLK 0010000 /* but don't worry, these are yet not possible on NT */ #define S_IFLNK 0010000 -#define S_IRWXU 0000700 -#define S_IRUSR 0000400 -#define S_IWUSR 0000200 -#define S_IXUSR 0000100 - #define S_IRWXG 0000070 #define S_IRGRP 0000040 #define S_IWGRP 0000020 @@ -134,24 +128,40 @@ typedef unsigned int nlink_t; #define S_ISGID 0002000 #define S_ISVTX 0001000 -#define S_IFMT 0xFF00 +#ifndef __BORLANDC__ -#ifndef FILE_DIRECTORY -# define FILE_DIRECTORY 0x0010 -#endif +#define S_ISBLK( m ) 0 /* Some of these are not actual values*/ +#define S_IFBLK 0010000 /* but don't worry, these are yet not possible on NT */ -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISDIR(m) ( (m & 0xF000) ? m & S_IFDIR : m & FILE_DIRECTORY) -/* .ado: 0x8000 is regular file. 0x4xxx is DIR */ -#define S_ISREG(m) (((m) & 0x8000) == S_IFREG) -/* #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) */ +#define S_IRWXU 0000700 +#define S_IRUSR 0000400 +#define S_IWUSR 0000200 +#define S_IXUSR 0000100 + +#define S_IFIFO _S_IFIFO /* pipe */ + +#define S_ISCHR( m ) (((m) & S_IFMT) == S_IFCHR) +#define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR) +#define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) +#define S_ISFIFO( m ) (((m) & S_IFMT) == S_IFIFO) + +/* Missing mask definition */ +#define O_ACCMODE 0003 + +#endif /* not __BORLANDC__ */ /* Symbolic constants for the access() function */ #define R_OK 4 /* Test for read permission */ #define W_OK 2 /* Test for write permission */ #define X_OK 1 /* Test for execute permission */ #define F_OK 0 /* Test for existence of file */ -#endif /* __EMX__ */ + + +/* Missing Errno definitions */ +#define ELOOP 40 /* Too many symbolic links encountered */ + +#endif /* not __WATCOMC__ */ + // --------------------------------------------------------------------------- // Inline definitions @@ -167,4 +177,4 @@ typedef unsigned int nlink_t; # define MAX_PATH 260 #endif -#endif /* Config.h */ +#endif //__CONFIG_H diff --git a/os2/key.os2.c b/os2/key.os2.c index 96b343607..c6eeba6be 100644 --- a/os2/key.os2.c +++ b/os2/key.os2.c @@ -40,8 +40,6 @@ #include "../vfs/vfs.h" #include "tty.h" -KBDINFO initialKbdInfo; /* keyboard info */ - /* Code to read keystrokes in a separate thread */ typedef struct kbdcodes { @@ -240,7 +238,7 @@ int get_key_code (int no_delay) if (no_delay) { /* Check if any input pending, otherwise return */ nodelay (stdscr, TRUE); - inp_ch = SLsys_input_pending(); + inp_ch = SLang_input_pending(0); if (inp_ch == 0) { return 0; } /* endif */ @@ -264,7 +262,9 @@ int get_key_code (int no_delay) } /* endif */ do { - inp_ch = SLsys_getkey(); + inp_ch = SLang_getkey(); + if (!inp_ch) + inp_ch = (SLang_getkey() << 8); if (inp_ch) return (VKtoCurses(inp_ch)); } while (!no_delay); return 0; @@ -315,7 +315,7 @@ static int VKtoCurses (int a_vkc) } /* endif */ // Scan Movement codes - if (asciiCode == 0xE0) { + if (asciiCode == 0) { // Replace key code with that in table for (i=0; movement[i].vkcode != 0 || movement[i].key_code != 0; i++) if (scanCode == movement[i].vkcode) @@ -328,7 +328,7 @@ static int VKtoCurses (int a_vkc) if (scanCode == fkt_table[i].vkcode) return (fkt_table[i].key_code); // ALT - KEY - if (altState) { + /* if (altState) */ { for (i=0; ALT_table[i].vkcode != 0 || ALT_table[i].key_code != 0; i++) if (scanCode == ALT_table[i].vkcode) return (ALT_table[i].key_code); @@ -357,20 +357,18 @@ static int getch_with_delay (void) return c; } - -extern int max_dirt_limit; - -/* Returns a character read from stdin with appropriate interpretation */ -/* Also takes care of generated mouse events */ -/* Returns 0 if it is a mouse event */ -/* The current behavior is to block allways */ int get_event (Gpm_Event *event, int redo_event, int block) { int c; + static int flag; /* Return value from select */ + static int dirty = 3; - /* .ado: For OS/2, for each event a refresh is required */ - mc_refresh (); - doupdate (); + if ((dirty == 1) || is_idle ()){ + refresh (); + doupdate (); + dirty = 1; + } else + dirty++; vfs_timeout_handler (); @@ -384,7 +382,7 @@ int get_event (Gpm_Event *event, int redo_event, int block) #endif - c = getch_with_delay (); + c = block ? getch_with_delay () : get_key_code (1); if (!c) { /* Code is 0, so this is a Control key or mouse event */ #ifdef HAVE_SLANG // SLms_GetEvent (event); @@ -392,6 +390,7 @@ int get_event (Gpm_Event *event, int redo_event, int block) #else ms_GetEvent (event); /* my curses */ #endif + return EV_NONE; /* FIXME: when should we return EV_MOUSE ? */ } return c; @@ -441,11 +440,11 @@ void channels_up() void channels_down() { } -void learn_keys() -{ - message (1, "Learn Keys", "Sorry, no learn keys on OS/2"); -} void init_key_input_fd (void) { } +/* mouse is not yet supported, sorry */ +void init_mouse (void) {} +void shut_mouse (void) {} + #endif /* __os2__ */ diff --git a/os2/slint.os2.c b/os2/slint.os2.c index 9db359bd6..f96b3a1f9 100644 --- a/os2/slint.os2.c +++ b/os2/slint.os2.c @@ -30,48 +30,6 @@ #ifdef HAVE_SLANG -/* {{{ Copied from ../slang/slgetkey.c, removed the DEC_8Bit_HACK, */ -extern unsigned int SLang_Input_Buffer_Len; -extern unsigned char SLang_Input_Buffer []; -extern unsigned int SLsys_getkey (void); -extern int SLsys_input_pending (int); - -static unsigned int SLang_getkey2 (void) -{ - unsigned int imax; - unsigned int ch; - - if (SLang_Input_Buffer_Len) - { - ch = (unsigned int) *SLang_Input_Buffer; - SLang_Input_Buffer_Len--; - imax = SLang_Input_Buffer_Len; - - memcpy ((char *) SLang_Input_Buffer, - (char *) (SLang_Input_Buffer + 1), imax); - return(ch); - } - else return(SLsys_getkey ()); -} - -static int SLang_input_pending2 (int tsecs) -{ - int n; - unsigned char c; - if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len; - - n = SLsys_input_pending (tsecs); - - if (n <= 0) return 0; - - c = (unsigned char) SLang_getkey2 (); - SLang_ungetkey_string (&c, 1); - - return n; -} -/* }}} */ - -//?? static void slang_sigterm () { SLsmg_reset_smg (); @@ -233,10 +191,10 @@ void load_terminfo_keys () int getch () { if (no_slang_delay) - if (SLang_input_pending2 (0) == 0) + if (SLang_input_pending (0) == 0) return -1; - return SLang_getkey2 (); + return SLang_getkey (); } extern int slow_terminal; diff --git a/os2/util.os2.c b/os2/util.os2.c index 3a52c9824..ec70d7faf 100644 --- a/os2/util.os2.c +++ b/os2/util.os2.c @@ -48,6 +48,10 @@ #include #include +#ifdef __BORLANDC__ +#define ENOTEMPTY ERROR_DIR_NOT_EMPTY +#endif + char * get_owner (int uid) { @@ -108,6 +112,7 @@ check_error_pipe (void) static int StartWindowsProg (char *name, SHORT type) { +#if 0 /* FIXME: PM DDL's should be loaded (or not loaded) at run time */ PROGDETAILS pDetails; memset(&pDetails, 0, sizeof(PROGDETAILS)) ; @@ -140,6 +145,7 @@ StartWindowsProg (char *name, SHORT type) NULL, NULL, SAF_INSTALLEDCMDLINE|SAF_STARTCHILDAPP) ; +#endif return 0; } @@ -669,7 +675,7 @@ vfs_file_is_ftp (char *filename) } int -mc_utime (char *path, struct utimbuf *times) +mc_utime (char *path, void *times) { return 0; } diff --git a/slang/slgetkey.c b/slang/slgetkey.c index 869e53bc8..5a43f8554 100644 --- a/slang/slgetkey.c +++ b/slang/slgetkey.c @@ -26,7 +26,7 @@ int SLang_Ignore_User_Abort = 0; # endif #endif -#if 0 /* see the replacement in src/slint.c */ +#ifdef OS2_NT /* see the replacement in src/slint.c */ unsigned int SLang_getkey (void) { unsigned int imax; @@ -58,7 +58,7 @@ unsigned int SLang_getkey (void) #endif return(ch); } -#endif /* 0 */ +#endif /* OS2_NT */ void SLang_ungetkey_string (unsigned char *s, unsigned int n) { @@ -89,7 +89,7 @@ void SLang_ungetkey (unsigned char ch) SLang_ungetkey_string(&ch, 1); } -#if 0 /* see the replacement in src/slint.c */ +#ifdef OS2_NT /* see the replacement in src/slint.c */ int SLang_input_pending (int tsecs) { int n; @@ -105,7 +105,7 @@ int SLang_input_pending (int tsecs) return n; } -#endif /* 0 */ +#endif /* OS2_NT */ void SLang_flush_input (void) { diff --git a/src/ChangeLog b/src/ChangeLog index 4ad35e230..00d7ccb1d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +Mon Mar 23 08:17:55 1998 Pavel Roskin + + * src/main.c: mcedit can be named mce or mcedit.exe - only + 3 first letters are significant. The same for mcview. + Console is always saved in do_execute() if it was saved there. + + * src/util.h: STRNOMP introduced (strncmp on unix and strnicmp + on OS2_NT) + + * slang/slgetkey.c: SLang_getkey() and SLang_input_pending() + enabled for OS2_NT + + * myslang.h: using fast one_vline() and one_hline() for OS2_NT + 1998-03-19 Miguel de Icaza * screen.c: Remove KEY_DC forever. This should have never been diff --git a/src/main.c b/src/main.c index f3fc4cb34..a1975bc7f 100644 --- a/src/main.c +++ b/src/main.c @@ -749,16 +749,6 @@ do_execute (const char *shell, const char *command, int internal_command) #ifndef HAVE_GNOME if (!internal_command){ - /* .ado: ask Juan why CONSOLE_SAVE not work here */ -#ifndef _OS_NT - if (console_flag){ - if (output_lines && keybar_visible) - putchar('\n'); - fflush(stdout); - handle_console (CONSOLE_SAVE); - } -#endif - if ((pause_after_run == pause_always || (pause_after_run == pause_on_dumb_terminals && !xterm_flag && !console_flag)) && !quit){ @@ -768,16 +758,17 @@ do_execute (const char *shell, const char *command, int internal_command) mc_raw_mode (); xgetch (); } -#ifdef _OS_NT if (console_flag){ - if (output_lines && keybar_visible) + if (output_lines && keybar_visible) { putchar('\n'); - handle_console (CONSOLE_SAVE); + fflush(stdout); + } } -#endif } #endif + if (console_flag) + handle_console (CONSOLE_SAVE); edition_post_exec (); #ifdef HAVE_SUBSHELL_SUPPORT @@ -2665,13 +2656,14 @@ static void handle_args (int argc, char *argv []) * directory from the command line arguments */ tmp = poptGetArg (optCon); - if (strstr (argv[0], "mcedit") == argv[0] + strlen(argv[0]) - 6) { + if (!STRNCOMP (argv [0], "mce", 3)) { edit_one_file = ""; if (tmp) edit_one_file = strdup (tmp); - } else if (strstr (argv [0], "mcview") == argv [0] + strlen (argv [0]) - 6) { - if (tmp) - view_one_file = strdup (tmp); + } else + if (!STRNCOMP (argv [0], "mcv", 3)) { + if (tmp) + view_one_file = strdup (tmp); } else { /* sets the current dir and the other dir */ if (tmp) { diff --git a/src/myslang.h b/src/myslang.h index 5d61bdb75..f0d169b49 100644 --- a/src/myslang.h +++ b/src/myslang.h @@ -126,9 +126,9 @@ void init_pair (int, char *, char *); #define SLsmg_draw_double_box(r,c,dr,dc) SLsmg_draw_box ((r), (c), (dr), (dc)) -#if 0 -# define one_vline() {acs (); addch (ACS_VLINE); noacs ();} -# define one_hline() {acs (); addch (ACS_HLINE); noacs ();} +#ifdef OS2_NT +# define one_vline() addch(ACS_VLINE) +# define one_hline() addch(ACS_HLINE) /* This is fast, but unusefull if ! pc_system - doesn't use Alt_Char_Pairs [] :( */ #else diff --git a/src/util.h b/src/util.h index ae9f4127d..e2ed1db0c 100644 --- a/src/util.h +++ b/src/util.h @@ -184,6 +184,7 @@ void tell_parent (int msg); # define PATH_ENV_SEP ';' # define OS_SORT_CASE_SENSITIVE_DEFAULT 0 # define STRCOMP stricmp +# define STRNCOMP strnicmp # define MC_ARCH_FLAGS REG_ICASE char *get_default_shell (void); char *get_default_editor (void); @@ -195,6 +196,7 @@ void tell_parent (int msg); # define get_default_editor() "vi" # define OS_SORT_CASE_SENSITIVE_DEFAULT 1 # define STRCOMP strcmp +# define STRNCOMP strncmp # define MC_ARCH_FLAGS 0 #endif