From 1a9884eb13d1b1eb7f35959ec0e55a559ef5345d Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sat, 7 Mar 1998 20:12:44 +0000 Subject: [PATCH] Sat Mar 7 14:19:29 1998 Pavel Roskin * os2/Makefile.OS2, os2/Makefile.EMX: new files. Use "gmake -f Makefile.EMX" to compile * os2/slint.os2.c: copied from ../nt/slint.nt.c * os2/direct.h: dummy file. Replaces douzen of other dummy files :-) * os2/Makefile: list of distibution files corrected * os2/drive.os2.c, os2/chmod.os2.c: button_new() calls updated * os2/*: many minor changes for EMX. --- os2/ChangeLog | 17 +++++++++++++ os2/Makefile | 15 ++++------- os2/chmod.os2.c | 25 +++++++++--------- os2/config.h | 51 +++++++++++++++++++++++++++++-------- os2/cons.handler.os2.c | 4 +-- os2/dirent.os2.c | 3 +++ os2/drive.os2.c | 17 ++++++------- os2/key.os2.c | 11 +++++--- os2/slint.os2.c | 57 +++++++++++++++++++++++++++++++++++++----- os2/sys/param.h | 7 +++++- os2/util.os2.c | 24 ++++++++++++------ 11 files changed, 168 insertions(+), 63 deletions(-) create mode 100644 os2/ChangeLog diff --git a/os2/ChangeLog b/os2/ChangeLog new file mode 100644 index 000000000..ec05ae847 --- /dev/null +++ b/os2/ChangeLog @@ -0,0 +1,17 @@ +Sat Mar 7 14:19:29 1998 Pavel Roskin + + * os2/Makefile.OS2, os2/Makefile.EMX: new files. Use + "gmake -f Makefile.EMX" to compile + + * os2/slint.os2.c: copied from ../nt/slint.nt.c + + * os2/direct.h: dummy file. Replaces douzen of other dummy + files :-) + + * os2/Makefile: list of distibution files corrected + + * os2/drive.os2.c, os2/chmod.os2.c: button_new() calls + updated + + * os2/*: many minor changes for EMX. + diff --git a/os2/Makefile b/os2/Makefile index ff9b6f754..1072da0ae 100644 --- a/os2/Makefile +++ b/os2/Makefile @@ -8,16 +8,13 @@ include ../Make.common -FILES = coollocal.h gpm-xterm.h lkeysym.h pwd.h Makefile coolwidget.h grp.h \ - makefile.debug slint.os2.c chmod.os2.c dirent.h inst.cmd \ - makefile.release config.h dirent.os2.c mc.def termios.h \ - cons.handler.os2.c drive.h key.os2.c mc.ico unistd.h cons.saver.h \ - drive.os2.c learn.h util.os2.c +FILES = Makefile Makefile.EMX 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 -FILESSYS = sys/param.h sys/time.h sys/wait.h +FILESSYS = sys/param.h sys/time.h -FILESEDIT = os2edit/copyright.h os2edit/dirtools.h \ - os2edit/makefile.debug os2edit/makefile.release os2edit/makefile.rf all: TAGS: $(FILES) @@ -38,5 +35,3 @@ distcopy: $(CP) $(FILES) ../../mc-$(VERSION)/os2 -mkdir ../../mc-$(VERSION)/os2/sys $(CP) $(FILESSYS) ../../mc-$(VERSION)/os2/sys - -mkdir ../../mc-$(VERSION)/os2/os2edit - $(CP) $(FILESEDIT) ../../mc-$(VERSION)/os2/os2edit diff --git a/os2/chmod.os2.c b/os2/chmod.os2.c index 5730d0f69..e64eebf2a 100644 --- a/os2/chmod.os2.c +++ b/os2/chmod.os2.c @@ -16,19 +16,19 @@ */ +#include #ifndef __os2__ #error This file is for the OS/2 operating system. #else -#include #define INCL_DOSFILEMGR #include #include #include /* for chmod and stat */ #include -#include #include +#include #include "tty.h" #include "mad.h" #include "util.h" @@ -104,28 +104,27 @@ struct { }; struct { - int ret_cmd, y, x; - char *text; - int hkey, hpos; + int ret_cmd, flags, y, x; + char *text; } chmod_but[BUTTONS] = { { - B_CANCEL, 2, 33, "[ Cancel ]", 'c', 2, + B_CANCEL, NORMAL_BUTTON, 2, 33, "&Cancel", }, { - B_ENTER, 2, 17, "[ Set ]", 's', 2, + B_ENTER, DEFPUSH_BUTTON, 2, 17, "&Set", }, { - B_CLRMRK, 0, 42, "[ Clear marked ]", 'l', 3, + B_CLRMRK, NORMAL_BUTTON, 0, 42, "C&lear marked", }, { - B_SETMRK, 0, 27, "[ Set marked ]", 'e', 3, + B_SETMRK, NORMAL_BUTTON, 0, 27, "S&et marked", }, { - B_MARKED, 0, 12, "[ Marked all ]", 'm', 2, + B_MARKED, NORMAL_BUTTON, 0, 12, "&Marked all", }, { - B_ALL, 0, 0, "[ Set all ]", 'a', 6, + B_ALL, NORMAL_BUTTON, 0, 0, "Set &all", }, }; @@ -240,7 +239,7 @@ static void init_chmod (void) x_set_dialog_title (ch_dlg, "Chmod command"); #define XTRACT(i) BY+chmod_but[i].y-single_set, BX+chmod_but[i].x, \ - chmod_but[i].ret_cmd, chmod_but[i].text, chmod_but[i].hkey, chmod_but[i].hpos, 0, 0, NULL + chmod_but[i].ret_cmd, chmod_but[i].flags, chmod_but[i].text, 0, 0, NULL tk_new_frame (ch_dlg, "b."); for (i = 0; i < BUTTONS; i++) { @@ -251,7 +250,7 @@ static void init_chmod (void) } -#define XTRACT2(i) 0, check_perm [i].text, 0, -1, NULL +#define XTRACT2(i) 0, check_perm [i].text, NULL tk_new_frame (ch_dlg, "c."); for (i = 0; i < PERMISSIONS; i++) { check_perm[i].check = check_new (PY + (PERMISSIONS - i), PX + 2, diff --git a/os2/config.h b/os2/config.h index e657e61ab..b363ff72b 100644 --- a/os2/config.h +++ b/os2/config.h @@ -31,7 +31,27 @@ #ifndef __CONFIG_H //Prevent multiple includes #define __CONFIG_H -#include "../VERSION" +#ifndef __BORLANDC__ +# include <../VERSION> +#else +# include <../VERSION.> +#endif + +#ifndef OS2 +# define OS2 +#endif + +#ifndef __os2__ +# define __os2__ +#endif + +#ifndef pc_system +# define pc_system +#endif + +#define OS2_NT +#define FLOAT_TYPE +#define MIDNIGHT // --------------------------------------------------------------------------- // Headers @@ -44,17 +64,21 @@ // --------------------------------------------------------------------------- // "Standard" Library -#define HAS_MEMSET -#define HAS_MEMCHR -#define HAS_MEMCPY -#define HAS_MEMCMP +#define HAVE_MEMSET +#define HAVE_MEMCHR +#define HAVE_MEMCPY +#define HAVE_MEMCMP +#define HAVE_MEMMOVE #define HAVE_STRDUP #define HAVE_STRERROR -#define HAVE_MEMMOVE +#define HAVE_TRUNCATE #define REGEX_MALLOC #define NO_TERM #define NO_INFOMOUNT +#ifndef __EMX__ +#define HAVE_SHORT_MKDIR +#endif // --------------------------------------------------------------------------- // Windowing library @@ -68,22 +92,25 @@ // --------------------------------------------------------------------------- // 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; -typedef unsigned int umode_t; typedef unsigned int nlink_t; #define INLINE #define inline -#define OS2_NT 1 #define ENOTDIR -1 +#endif /* not __EMX__ */ + // --------------------------------------------------------------------------- // File attributes -#define S_ISLNK(x) 0 - #define S_ISBLK(m) 0 /* Some of these are not actual values*/ +#define S_ISLNK(x) 0 +#ifndef __EMX__ + #define S_ISFIFO(x) 0 #define S_IFBLK 0010000 /* but don't worry, these are yet not possible on NT */ #define S_IFLNK 0010000 @@ -124,15 +151,17 @@ typedef unsigned int nlink_t; #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__ */ // --------------------------------------------------------------------------- // Inline definitions // Pipes +#ifndef __EMX__ #define popen _popen #define pclose _pclose #define pipe(p) _pipe(p, 4096, 0x8000 /*_O_BINARY*/) +#endif #ifndef MAX_PATH # define MAX_PATH 260 diff --git a/os2/cons.handler.os2.c b/os2/cons.handler.os2.c index cea4d54e8..e6aa34e09 100644 --- a/os2/cons.handler.os2.c +++ b/os2/cons.handler.os2.c @@ -1,4 +1,4 @@ -/* Client interface for General purpose OS/2 console save/restore server. +/* Client interface for General purpose OS/2 console save/restore server. /* Client interface for General purpose OS/2 console save/restore server. 1997 Alexander Dong Having the same interface as its Linux counterpart: @@ -20,6 +20,7 @@ */ +#include #ifndef __os2__ #error This file is for OS/2 operating systems. #else @@ -32,7 +33,6 @@ #define INCL_SUB #define INCL_DOSERRORS -#include #include #include "tty.h" diff --git a/os2/dirent.os2.c b/os2/dirent.os2.c index a258f0bfe..bf057a795 100644 --- a/os2/dirent.os2.c +++ b/os2/dirent.os2.c @@ -1,6 +1,9 @@ #define INCL_DOSFILEMGR #define INCL_DOSERRORS +#ifdef HAVE_CONFIG_H +#include +#endif #include #include #include diff --git a/os2/drive.os2.c b/os2/drive.os2.c index fea1ea428..9c6f22fd8 100644 --- a/os2/drive.os2.c +++ b/os2/drive.os2.c @@ -16,13 +16,13 @@ */ +#include #ifndef __os2__ #error This file is for the OS/2 operating systems. #else #define INCL_DOSDEVICES /* Device values */ #define INCL_DOSERRORS /* Error values */ -#include #include #include #include @@ -109,7 +109,7 @@ static void drive_cmd() int x_pos; /* X-Position for the dialog */ int y_pos = (LINES-6)/2-3; /* Center on y */ int y_height; - int x_width; + int x_width; int m_drv; void *widget; @@ -123,7 +123,7 @@ static void drive_cmd() message(0, " ERROR ", " Internal Error with drive_cmd "); return; } /* endif */ - + j = 0; for (i=0; i < 26; i++) { if ( (uDriveMap<<(31-i)) >> 31) { @@ -163,9 +163,9 @@ static void drive_cmd() add_widgetl (drive_dlg, button_new (5, (m_drv-i-1)*2+4 - (MAX_LGH*2 - nDrivesAvail) * 2, B_DRIVE_BASE+((int) szTempBuf[0] - (int) 'A'), - szTempBuf, - szTempBuf[0], - 0, NULL, NULL, NULL), + HIDDEN_BUTTON, + szTempBuf, + 0, NULL, NULL), XV_WLAY_RIGHTOF); } } @@ -176,10 +176,9 @@ static void drive_cmd() button_new (3, (m_drv-i-1)*2+4, B_DRIVE_BASE+((int)szTempBuf[0] - (int) 'A'), - szTempBuf, - szTempBuf[0], + HIDDEN_BUTTON, + szTempBuf, 0, - NULL, NULL, NULL), XV_WLAY_RIGHTOF); diff --git a/os2/key.os2.c b/os2/key.os2.c index eb4da0022..96b343607 100644 --- a/os2/key.os2.c +++ b/os2/key.os2.c @@ -19,6 +19,7 @@ */ +#include #ifndef __os2__ #error This file is for OS/2 systems. #else @@ -31,7 +32,6 @@ #define INCL_DOSERRORS #define INCL_WININPUT #include -#include #include #include "mouse.h" #include "global.h" @@ -240,7 +240,7 @@ int get_key_code (int no_delay) if (no_delay) { /* Check if any input pending, otherwise return */ nodelay (stdscr, TRUE); - inp_ch = SLsys_getkey_ndelay(); + inp_ch = SLsys_input_pending(); if (inp_ch == 0) { return 0; } /* endif */ @@ -364,7 +364,7 @@ extern int max_dirt_limit; /* 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 get_event (Gpm_Event *event, int redo_event, int block) { int c; @@ -403,7 +403,7 @@ int mi_getch () Gpm_Event ev; int key; - while ((key = get_event (&ev, 0)) == 0) + while ((key = get_event (&ev, 0, 1)) == 0) ; return key; } @@ -445,4 +445,7 @@ void learn_keys() { message (1, "Learn Keys", "Sorry, no learn keys on OS/2"); } +void init_key_input_fd (void) +{ +} #endif /* __os2__ */ diff --git a/os2/slint.os2.c b/os2/slint.os2.c index c58fb5354..9db359bd6 100644 --- a/os2/slint.os2.c +++ b/os2/slint.os2.c @@ -1,4 +1,4 @@ -/* Slang interface to the Midnight Commander for OS/2 +/* Slang interface to the Midnight Commander for Windows NT and OS/2 This emulates some features of ncurses on top of slang S-lang is not fully consistent between its Unix and non-Unix versions. @@ -17,9 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" +#include #include -#include #include "tty.h" #include "mad.h" #include "color.h" @@ -31,6 +30,47 @@ #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 () { @@ -41,7 +81,7 @@ static int slinterrupt; void enable_interrupt_key(void) { -// SLang_set_abort_signal(NULL); + SLang_set_abort_signal(NULL); slinterrupt = 1; } void disable_interrupt_key(void) @@ -83,7 +123,7 @@ void slang_shutdown () { slang_shell_mode (); do_exit_ca_mode (); -// SLang_reset_tty (); + SLang_reset_tty (); /* reset the colors to those that were * active when the program was started up @@ -192,7 +232,11 @@ void load_terminfo_keys () int getch () { - return _getch(); + if (no_slang_delay) + if (SLang_input_pending2 (0) == 0) + return -1; + + return SLang_getkey2 (); } extern int slow_terminal; @@ -208,6 +252,7 @@ int got_interrupt () void mc_refresh (void) { +/* if (!we_are_background) (no background mode yet) */ refresh (); } diff --git a/os2/sys/param.h b/os2/sys/param.h index c20eeaba4..5e2a01c23 100644 --- a/os2/sys/param.h +++ b/os2/sys/param.h @@ -1,2 +1,7 @@ -/* Nothing, just dummy */ +/* Systems having sys/param.h should not include this file */ +#ifdef HAVE_PARAM_H +#error Remove this file if you have real sys/param.h +#else +/* FIXME: We should warn, that this file should not be included */ +#endif diff --git a/os2/util.os2.c b/os2/util.os2.c index 568e8793d..3a52c9824 100644 --- a/os2/util.os2.c +++ b/os2/util.os2.c @@ -33,10 +33,7 @@ #include #include #include -#include -#include #include -#include #include #include #include @@ -45,7 +42,6 @@ #include /* INT_MAX */ #include /* select: timeout */ #include -#include #include #include #include @@ -366,12 +362,13 @@ char *tilde_expand (char *directory) return strdup (directory); } +#ifndef __EMX__ void sleep(unsigned long dwMiliSecs) { DosSleep(dwMiliSecs); } - +#endif /* Canonicalize path, and return a new path. Do everything in situ. @@ -690,6 +687,7 @@ geteuid(void) return 0; } +#ifndef __EMX__ char * getcwd(char *buffer, int size) { @@ -717,6 +715,7 @@ getcwd(char *buffer, int size) return NULL; } /* endif */ } +#endif int mc_chdir(char *pathname) @@ -762,7 +761,7 @@ conv_os2_unx_rc(int os2rc) case ERROR_SHARING_VIOLATION: case ERROR_SHARING_BUFFER_EXCEEDED: case ERROR_ACCESS_DENIED: - errCode = EOS2ERR; + errCode = EACCES; break; case ERROR_INVALID_PARAMETER: errCode = EINVAL; @@ -876,7 +875,7 @@ getpid (void) int errno_dir_not_empty (int err) { - if (err == EACCESS) + if (err == ENOTEMPTY) return 1; return 0; } @@ -891,3 +890,14 @@ get_mc_lib_dir () return mchome; } /* endif */ } + +int get_user_rights (struct stat *buf) +{ + return 2; +} +void init_groups (void) +{ +} +void delete_groups (void) +{ +}