From b52d3a73ca5b925108642b3a203e899a36043937 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sat, 7 Mar 1998 20:27:44 +0000 Subject: [PATCH] Sat Mar 7 14:33:38 1998 Pavel Roskin * src/complete.c: obsolete hack for OS/2 and NT removed. Completion works for NT now (not very good) * src/main.c: HOME variable is respected by NT and OS/2 versions. If it is missing, we use LIBDIR on OS2_NT and "/" on Unix. * src/key.h: SHIFT_PRESSED is set to 0x0010 on NT. This value doesn't conflict with definitions for ALT and CTRL, but it is SDK-compatible. * vfs/vfs.h: Minor changes for OS/2. EMX defines mkdir with 2 arguments * vfs/tcputil,c, vfs/utilvfs.c: signal.h was includes twice. * vfs/Makefile.in: undelfs.h is not used and should disapper * slang/slos2tty.c: new file, copied from SLang-0.99.38, needed for OS/2 port * slang/Makefile.in: added slos2tty.c * vfs/extfs/README: annoying spell errors corrected * src/main.c: --termcap disabled for OS2_NT because it doesn't (and cannot) work. ARCH_FLAGS is not needed anymore. * src/text.c: most includes removed. Added a warning is someone compiles this file with HAVE_X. Improved color scheme for consoles with 16 background colors (e.g. OS/2). Hack for OS/2 removed. * src/util.c, src/util.h: STRCOMP and MC_ARCH_FLAGS are moved to util.h. It may be useful to use them for filenames' completion on OS2_NT --- slang/Makefile.in | 2 +- src/ChangeLog | 39 ++++++++++++ src/complete.c | 9 +-- src/key.h | 8 ++- src/main.c | 48 ++++----------- src/text.c | 148 ++++------------------------------------------ src/util.c | 11 ---- src/util.h | 4 ++ vfs/Makefile.in | 2 +- vfs/extfs/README | 2 +- vfs/tcputil.c | 1 - vfs/utilvfs.c | 1 - vfs/vfs.h | 13 ++-- 13 files changed, 83 insertions(+), 205 deletions(-) diff --git a/slang/Makefile.in b/slang/Makefile.in index e6b4616d8..babcaf4d5 100644 --- a/slang/Makefile.in +++ b/slang/Makefile.in @@ -13,7 +13,7 @@ AR = @AR@ SLANGSRCS = sldisply.c slerr.c slsmg.c slutty.c slgetkey.c slmemcpy.c \ slmemset.c sltermin.c sltoken.c slsignal.c \ - slvideo.c slw32tty.c + slvideo.c slw32tty.c slos2tty.c SLANGHDRS = slang.h _slang.h sl-feat.h jdmacros.h diff --git a/src/ChangeLog b/src/ChangeLog index 008152cc7..271200a82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,42 @@ +Sat Mar 7 14:33:38 1998 Pavel Roskin + + * src/complete.c: obsolete hack for OS/2 and NT removed. + Completion works for NT now (not very good) + + * src/main.c: HOME variable is respected by NT and OS/2 + versions. If it is missing, we use LIBDIR on OS2_NT and "/" + on Unix. + + * src/key.h: SHIFT_PRESSED is set to 0x0010 on NT. This value + doesn't conflict with definitions for ALT and CTRL, but it is + SDK-compatible. + + * vfs/vfs.h: Minor changes for OS/2. EMX defines mkdir with + 2 arguments + + * vfs/tcputil,c, vfs/utilvfs.c: signal.h was includes twice. + + * vfs/Makefile.in: undelfs.h is not used and should disapper + + * slang/slos2tty.c: new file, copied from SLang-0.99.38, + needed for OS/2 port + + * slang/Makefile.in: added slos2tty.c + + * vfs/extfs/README: annoying spell errors corrected + + * src/main.c: --termcap disabled for OS2_NT because it doesn't + (and cannot) work. ARCH_FLAGS is not needed anymore. + + * src/text.c: most includes removed. Added a warning is someone + compiles this file with HAVE_X. Improved color scheme for + consoles with 16 background colors (e.g. OS/2). Hack for OS/2 + removed. + + * src/util.c, src/util.h: STRCOMP and MC_ARCH_FLAGS are moved + to util.h. It may be useful to use them for filenames' completion + on OS2_NT + Fri Mar 6 19:29:54 1998 Miguel de Icaza * find.c: Simplify header files: use the fs.h include file. diff --git a/src/complete.c b/src/complete.c index ffea978e8..c6e2f675b 100644 --- a/src/complete.c +++ b/src/complete.c @@ -166,12 +166,6 @@ char *filename_completion_function (char *text, int state) strcat (tmp, PATH_SEP_STR); strcat (tmp, entry->d_name); canonicalize_pathname (tmp); -#ifdef OS2_NT - if (!stat (tmp, &tempstat)){ - if (tempstat.st_mode & S_IEXEC) - isexec = 1; - } -#else /* Unix version */ if (!stat (tmp, &tempstat)){ uid_t my_uid = getuid (); @@ -186,7 +180,6 @@ char *filename_completion_function (char *text, int state) isexec = 1; } } -#endif free (tmp); } switch (look_for_executables) @@ -284,7 +277,7 @@ char *username_completion_function (char *text, int state) } extern char **environ; -#endif /* _OS_NT */ +#endif /* OS2_NT */ /* We assume text [0] == '$' and want to have a look at text [1], if it is equal to '{', so that we should append '}' at the end */ diff --git a/src/key.h b/src/key.h index ccb947e29..c55eeb4dd 100644 --- a/src/key.h +++ b/src/key.h @@ -17,7 +17,13 @@ int mi_getch (void); /* Used to get the modifier information */ /* Currently, it just works on the Linux console */ -#define SHIFT_PRESSED 1 +#ifdef _OS_NT +# ifndef SHIFT_PRESSED +# define SHIFT_PRESSED 0x0010 +# endif +#else +# define SHIFT_PRESSED 1 +#endif #define ALTR_PRESSED 2 #define CONTROL_PRESSED 4 #define ALTL_PRESSED 8 diff --git a/src/main.c b/src/main.c index 6702a7d5f..cba2cdbd5 100644 --- a/src/main.c +++ b/src/main.c @@ -2426,14 +2426,8 @@ init_sigchld (void) #endif /* _OS_NT, __os2__, UNIX */ -#ifdef HAVE_SLANG -#ifdef OS2_NT -#define ARCH_FLAGS "S:" - static -#else - extern -#endif - int SLtt_Try_Termcap; +#if defined(HAVE_SLANG) && !defined(OS2_NT) + extern int SLtt_Try_Termcap; #endif static struct poptOption argumentTable[] = { @@ -2472,7 +2466,7 @@ static struct poptOption argumentTable[] = { #ifdef HAVE_SUBSHELL_SUPPORT { "subshell", 'U', POPT_ARG_NONE, NULL, 'U' }, #endif -#ifdef HAVE_SLANG +#if defined(HAVE_SLANG) && !defined(OS2_NT) { "termcap", 't', 0, &SLtt_Try_Termcap, 0 }, #endif { "version", 'V', POPT_ARG_NONE, NULL, 'V'}, @@ -2482,8 +2476,6 @@ static struct poptOption argumentTable[] = { { NULL, 0, 0, NULL, 0 } }; -#define ARCH_FLAGS "" - static void print_usage (void) { @@ -2510,7 +2502,7 @@ print_usage (void) " default.\n" "-P, --printwd At exit, print the last working directory.\n" "-s, --slow Disables verbose operation (for slow terminals).\n" -#ifdef HAVE_SLANG +#if defined(HAVE_SLANG) && !defined(OS2_NT) "-t, --termcap Activate support for the TERMCAP variable.\n" #endif #ifdef USE_NETCODE @@ -2829,34 +2821,14 @@ int main (int argc, char *argv []) init_sigfatals (); /* This variable is used by the subshell */ -#if defined _OS_NT - home_dir = copy_strings (getenv ("HOMEDRIVE"), getenv ("HOMEPATH"), NULL); - /* we need to malloc something (we free(home_dir)) */ - if (!home_dir) { - home_dir = malloc(MAX_PATH); - GetWindowsDirectory(home_dir, MAX_PATH); - } -#elif defined(__os2__) - drv = getenv ("HOMEDRIVE"); - drv_path = getenv ("HOMEPATH"); - - if ((!drv) || (!drv_path)){ - char *p; - home_dir = getenv("USER_INI"); - if (!home_dir) { - message(1, "Error", "HOMEDRIVE and HOMEPATH must be set!"); - return -1; - } else { - p = strstr(home_dir, "OS2.INI"); - *(--p) = (char) 0; - } - } else { - home_dir = copy_strings (drv, drv_path, NULL); - } -#else home_dir = getenv ("HOME"); - home_dir = home_dir ? home_dir : PATH_SEP_STR; + if (!home_dir) { +#ifndef OS2_NT + home_dir = PATH_SEP_STR; +#else + home_dir = mc_home; /* LIBDIR, calculated in OS_Setup() */ #endif + } compatibility_move_mc_files (); diff --git a/src/text.c b/src/text.c index 9fc4c0209..51164d99b 100644 --- a/src/text.c +++ b/src/text.c @@ -4,139 +4,20 @@ * */ #include -#include -#ifdef _OS_NT -# include +#ifdef HAVE_X +#error This file is for text-mode editions only. #endif -#ifdef __os2__ -# define INCL_DOS -# define INCL_DOSFILEMGR -# define INCL_DOSERRORS -# include -# include -# include -#endif - -#include "tty.h" #include -#include -#include -#include -#include -#include - -#ifdef HAVE_UNISTD_H -# include -#endif - -/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */ -#if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION) -# include -# define NLENGTH(dirent) (strlen ((dirent)->d_name)) -#else -# define dirent direct -# define NLENGTH(dirent) ((dirent)->d_namlen) - -# ifdef HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ - -# ifdef HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ - -# ifdef HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -#endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */ - -#if HAVE_SYS_WAIT_H -# include /* For waitpid() */ -#endif - -#include -#ifndef OS2_NT -# include -#endif -#include -#include /* For O_RDWR */ -#include - -/* Program include files */ -#include "mad.h" -#include "dir.h" -#include "color.h" -#include "global.h" -#include "util.h" -#include "dialog.h" -#include "menu.h" -#include "file.h" -#include "panel.h" #define WANT_WIDGETS -#include "main.h" #include "win.h" -#include "user.h" -#include "mem.h" -#include "mouse.h" -#include "option.h" -#include "tree.h" -#include "cons.saver.h" -#include "subshell.h" -#include "key.h" /* For init_key() and mi_getch() */ -#include "setup.h" /* save_setup() */ -#include "profile.h" /* free_profiles() */ -#include "boxes.h" -#include "layout.h" -#include "cmd.h" /* Normal commands */ -#include "hotlist.h" -#include "panelize.h" -#ifndef __os2__ -# include "learn.h" -#endif -#include "listmode.h" -#include "background.h" -#include "dirhist.h" -#include "ext.h" /* For flush_extension_file() */ - -/* Listbox for the command history feature */ +#include "tty.h" +#include "key.h" #include "widget.h" -#include "command.h" -#include "wtools.h" -#include "complete.h" /* For the free_completion */ - -#include "chmod.h" -#include "chown.h" - -#ifdef OS2_NT -# include -#endif - -#include "../vfs/vfs.h" -#include "../vfs/extfs.h" - -#ifdef HAVE_XVIEW -# include "../xv/xvmain.h" -#endif - -#ifdef HAVE_TK -# include "tkmain.h" -#endif - -#include "popt.h" - -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif - -#ifndef USE_VFS -#ifdef USE_NETCODE -#undef USE_NETCODE -#endif -#endif - +#include "main.h" +#include "cons.saver.h" char *default_edition_colors = "normal=lightgray,blue:" @@ -145,23 +26,18 @@ char *default_edition_colors = "markselect=yellow,cyan:" "errors=white,red:" "menu=white,cyan:" -"reverse=black,white:" -"dnormal=black,white:" +"reverse=black,lightgray:" +"dnormal=black,lightgray:" "dfocus=black,cyan:" -#if defined(__os2__) -"dhotnormal=magenta,white:" /* .ado: yellow */ -"dhotfocus=magenta,cyan:" -#else -"dhotnormal=yellow,white:" +"dhotnormal=yellow,lightgray:" "dhotfocus=yellow,cyan:" -#endif "viewunderline=brightred,blue:" "menuhot=yellow,cyan:" "menusel=white,black:" "menuhotsel=yellow,black:" -"helpnormal=black,white:" -"helpitalic=red,white:" -"helpbold=blue,white:" +"helpnormal=black,lightgray:" +"helpitalic=red,lightgray:" +"helpbold=blue,lightgray:" "helplink=black,cyan:" "helpslink=yellow,blue:" "gauge=white,black:" diff --git a/src/util.c b/src/util.c index 16bc44aa7..ea4015c20 100644 --- a/src/util.c +++ b/src/util.c @@ -477,17 +477,6 @@ char *convert_pattern (char *pattern, int match_type, int do_group) return pattern; } -/* 1 if string matches - 0 if string doesn't match - -1 if error in pattern */ -#ifdef OS2_NT -# define STRCOMP stricmp -# define MC_ARCH_FLAGS REG_ICASE -#else -# define STRCOMP strcmp -# define MC_ARCH_FLAGS 0 -#endif - int regexp_match (char *pattern, char *string, int match_type) { static regex_t r; diff --git a/src/util.h b/src/util.h index 0852ff301..d7d90bc3d 100644 --- a/src/util.h +++ b/src/util.h @@ -183,6 +183,8 @@ void tell_parent (int msg); # define PATH_SEP_STR "\\" # define PATH_ENV_SEP ';' # define OS_SORT_CASE_SENSITIVE_DEFAULT 0 +# define STRCOMP stricmp +# define MC_ARCH_FLAGS REG_ICASE char *get_default_shell (void); char *get_default_editor (void); int lstat (const char* pathname, struct stat *buffer); @@ -192,6 +194,8 @@ void tell_parent (int msg); # define PATH_ENV_SEP ':' # define get_default_editor() "vi" # define OS_SORT_CASE_SENSITIVE_DEFAULT 1 +# define STRCOMP strcmp +# define MC_ARCH_FLAGS 0 #endif /* GNOME provides the internationalization code as well */ diff --git a/vfs/Makefile.in b/vfs/Makefile.in index e21e9e985..8a890e0b7 100644 --- a/vfs/Makefile.in +++ b/vfs/Makefile.in @@ -24,7 +24,7 @@ VFSSRCS = local.c vfs.c mcfs.c tcputil.c tar.c names.c \ ftpfs.c container.c mcserv.c extfs.c undelfs.c utilvfs.c VFSHDRS = vfs.h mcfs.h tcputil.h tar.h container.h ftpfs.h names.h \ - extfs.h undelfs.h + extfs.h VFSOBJS = $(NONETFILES) @NETFILES@ diff --git a/vfs/extfs/README b/vfs/extfs/README index 63bf07dbe..1546bb579 100644 --- a/vfs/extfs/README +++ b/vfs/extfs/README @@ -25,7 +25,7 @@ prefix=space_separated_extensions e.g. zip=.zip .ZIP -The second one my require some your knowledges of shell/c programming: +The second one may require some your knowledge of shell/c programming: You have to create a program (with executable permissions) prefix in $(libdir)/extfs (in our example $(libdir)/extfs/zip). diff --git a/vfs/tcputil.c b/vfs/tcputil.c index ae099fbf9..dde0d270a 100644 --- a/vfs/tcputil.c +++ b/vfs/tcputil.c @@ -42,7 +42,6 @@ #include #endif -#include #include #include "tcputil.h" #include "../src/dialog.h" /* for message () */ diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c index cf66d110c..3cca97668 100644 --- a/vfs/utilvfs.c +++ b/vfs/utilvfs.c @@ -37,7 +37,6 @@ #include #endif -#include #include #ifndef test_get_host_and_username diff --git a/vfs/vfs.h b/vfs/vfs.h index 551a79861..b3ecef368 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -250,15 +250,16 @@ #ifdef _OS_NT # undef mc_rmdir # undef mc_rename -# undef mc_mkdir +#endif + +#ifdef OS2_NT # undef mc_ctl # undef mc_unlink # define mc_ctl(a,b,c) 0 -#endif - -/* .ado: OS2 and NT */ -#if defined(OS2_NT) -# define mc_mkdir(a,b) mkdir(a) +# ifndef __EMX__ +# undef mc_mkdir +# define mc_mkdir(a,b) mkdir(a) +# endif #endif #endif /* USE_VFS */