From 9d4987c84b6455b8869f1b947caaf39a3c326ce2 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 16 Mar 1998 19:09:24 +0000 Subject: [PATCH] Mon Mar 16 13:03:45 1998 Pavel Roskin * cmd.c: Internal edit is used by default. vi may be confusing for some users. * tree.c: tree_rmdir_cmd() should not return any value, because it is not analyzed for errors. * main.c: NT code: use O_BINARY instead of _O_BINARY * util.c: DO not test for arguments that do not make sense under Windows NT. * file.c: utime.h always included for Windows NT port. * view.c: Events are flushed only if the ports supports it. Lots of Windows/NT changes, but I will let Pavlov write the ChangeLog entries. Mon Mar 16 13:05:47 1998 Pavel Roskin * tkview.c: Include stdio.h; Minor spelling corrections added. --- gnome/gdesktop.c | 1 + nt/Makefile | 2 +- nt/config.h | 34 ++++++++++++++++++++++------------ nt/cons.handler.nt.c | 12 +++++++++--- nt/util.debug.c | 1 + nt/utilnt.c | 20 ++++++++++++-------- src/ChangeLog | 17 +++++++++++++++++ src/cmd.c | 2 +- src/file.c | 11 ++--------- src/main.c | 2 +- src/tree.c | 12 ++++++------ src/util.c | 2 +- src/view.c | 2 +- tk/ChangeLog | 4 ++++ tk/tkview.c | 9 ++++++--- 15 files changed, 85 insertions(+), 46 deletions(-) diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 76f3b889c..dd62245e1 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -16,6 +16,7 @@ #include "global.h" #include "panel.h" #include "gscreen.h" +#include "ext.h" #include /* Types of desktop icons: diff --git a/nt/Makefile b/nt/Makefile index 02c2373dd..8455fedf9 100644 --- a/nt/Makefile +++ b/nt/Makefile @@ -10,7 +10,7 @@ include ../Make.common FILES = Makefile TODO dirent.c mc.ico bugs mc.rc config.h dirent.h \ Makefile.NT chmod.nt.c drive.nt.c slint.nt.c cons.handler.nt.c \ - key.nt.c utilnt.c Makefile.NT Makefile.VC4 \ + key.nt.c utilnt.c Makefile.NT Makefile.VC4 Makefile.BC5 \ util.WinNT.c util.debug.c util.Win32.c util.Win32.h util.debug.h \ drive.h diff --git a/nt/config.h b/nt/config.h index 51dc8c4c1..cbe16a3a8 100644 --- a/nt/config.h +++ b/nt/config.h @@ -94,10 +94,13 @@ // Typedefs (some useless under NT) typedef int gid_t; // Not defined in typedef int uid_t; -typedef int mode_t; typedef int pid_t; typedef unsigned int umode_t; + +#ifndef __BORLANDC__ +typedef int mode_t; typedef unsigned int nlink_t; +#endif #define INLINE #define inline @@ -106,15 +109,9 @@ typedef unsigned int nlink_t; // File attributes #define S_ISLNK(x) 0 -#ifdef _MSC_VER // Already defined in Watcom C headers -#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_IFLNK 0010000 +#ifndef __WATCOMC__ // Already defined in Watcom C headers -#define S_IRWXU 0000700 -#define S_IRUSR 0000400 -#define S_IWUSR 0000200 -#define S_IXUSR 0000100 +#define S_IFLNK 0010000 #define S_IRWXG 0000070 #define S_IRGRP 0000040 @@ -130,6 +127,16 @@ typedef unsigned int nlink_t; #define S_ISGID 0002000 #define S_ISVTX 0001000 +#ifndef __BORLANDC__ + +#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_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) @@ -137,6 +144,11 @@ typedef unsigned int nlink_t; #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 */ @@ -147,9 +159,7 @@ typedef unsigned int nlink_t; /* Missing Errno definitions */ #define ELOOP 40 /* Too many symbolic links encountered */ -/* Missing mask definition */ -#define O_ACCMODE 0003 -#endif //_MSC_VER +#endif /* not __WATCOMC__ */ // --------------------------------------------------------------------------- diff --git a/nt/cons.handler.nt.c b/nt/cons.handler.nt.c index 29eb524d1..f7e50894e 100644 --- a/nt/cons.handler.nt.c +++ b/nt/cons.handler.nt.c @@ -41,11 +41,17 @@ static HANDLE hSaved, hNew; void show_console_contents (int starty, unsigned char begin_line, unsigned char end_line) { DWORD dw; - COORD c0 = {0,0}; - COORD csize = {COLS, end_line-begin_line}; - SMALL_RECT rect = { 0, begin_line, COLS, end_line }; + COORD c0 = { 0, 0 }; + COORD csize; + SMALL_RECT rect; CHAR_INFO *pchar; + csize.X = COLS; + csize.Y = end_line-begin_line; + rect.Left = 0; + rect.Top = begin_line; + rect.Right = COLS; + rect.Bottom = end_line; // -- This code reads characters and attributes pchar = malloc (sizeof(CHAR_INFO) * (end_line-begin_line) * COLS); diff --git a/nt/util.debug.c b/nt/util.debug.c index a56e1f479..62f2f98e6 100644 --- a/nt/util.debug.c +++ b/nt/util.debug.c @@ -24,6 +24,7 @@ #ifdef _OS_NT #include #endif +#include #include "util.debug.h" /* Global variables */ diff --git a/nt/utilnt.c b/nt/utilnt.c index 5c262dbf4..c6b2fc1ed 100644 --- a/nt/utilnt.c +++ b/nt/utilnt.c @@ -38,6 +38,10 @@ #include #include "util.Win32.h" +#ifdef __BORLANDC__ +#define ENOTEMPTY ERROR_DIR_NOT_EMPTY +#endif + char *get_owner (int uid) { return "none"; @@ -135,11 +139,11 @@ int my_system (int as_shell_command, const char *shell, const char *command) if (as_shell_command) { /* It is only the shell, /c will not work */ if (command) - spawnlp (_P_WAIT, shell, shell, "/c", command, (char *) 0); + spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0); else - spawnlp (_P_WAIT, shell, (char *) 0); + spawnlp (P_WAIT, shell, (char *) 0); } else - spawnl (_P_WAIT, shell, shell, command, (char *) 0); + spawnl (P_WAIT, shell, shell, command, (char *) 0); if (win32_GetPlatform() == OS_Win95) { SetConsoleTitle ("GNU Midnight Commander"); /* title is gone after spawn... */ @@ -150,21 +154,21 @@ int my_system (int as_shell_command, const char *shell, const char *command) switch(win32_GetEXEType (shell)) { case EXE_win16: /* Windows 3.x archive or OS/2 */ case EXE_win32GUI: /* NT or Chicago GUI API */ - spawnlp (_P_NOWAIT, shell, shell, "/c", command, (char *) 0); /* don't wait for GUI programs to end */ + spawnlp (P_NOWAIT, shell, shell, "/c", command, (char *) 0); /* don't wait for GUI programs to end */ break; case EXE_otherCUI: /* DOS COM, MZ, ZM, Phar Lap */ case EXE_win32CUI: /* NT or Chicago Console API, also OS/2 */ case EXE_Unknown: default: - spawnlp (_P_WAIT, shell, shell, "/c", command, (char *) 0); + spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0); break; } } else - spawnlp (_P_WAIT, shell, shell, "/c", command, (char *) 0); + spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0); } else - spawnl (_P_WAIT, shell, shell, command, (char *) 0); + spawnl (P_WAIT, shell, shell, command, (char *) 0); if (win32_GetPlatform() == OS_Win95) { SetConsoleTitle ("GNU Midnight Commander"); /* title is gone after spawn... */ @@ -405,7 +409,7 @@ int mc_unlink (char *pathName) } } - _chmod(pathName, _S_IWRITE); /* make it writable */ + chmod(pathName, S_IWRITE); /* make it writable */ rc = DeleteFile(pathName); returnError = GetLastError(); if (rc == FALSE) { diff --git a/src/ChangeLog b/src/ChangeLog index 21c9e6a21..2ac8979ed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +Mon Mar 16 13:03:45 1998 Pavel Roskin + + * cmd.c: Internal edit is used by default. vi may be + confusing for some users. + + * tree.c: tree_rmdir_cmd() should not return any value, + because it is not analyzed for errors. + + * main.c: NT code: use O_BINARY instead of _O_BINARY + + * util.c: DO not test for arguments that do not make sense under + Windows NT. + + * file.c: utime.h always included for Windows NT port. + + * view.c: Events are flushed only if the ports supports it. + Mon Mar 16 12:30:39 1998 Stas Maximov * hotlist.c: Defaults on the hotlist add-current and new-entry is diff --git a/src/cmd.c b/src/cmd.c index 447542982..5a5b53897 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -99,7 +99,7 @@ int output_starts_shell = 0; int source_route = 0; /* If set, use the builtin editor */ -int use_internal_edit = 0; +int use_internal_edit = 1; /* Ugly hack in order to distinguish between left and right panel in menubar */ int is_right; diff --git a/src/file.c b/src/file.c index e36faa013..7722f4fe4 100644 --- a/src/file.c +++ b/src/file.c @@ -60,12 +60,10 @@ #include #include #include -#ifdef __os2__ +#ifdef OS2_NT # include -# include #endif - #include #include "tty.h" #include @@ -81,12 +79,7 @@ # include /* alex: for struct timeb, used in time.h */ #endif /* SCO_FLAVOR */ #include -#ifdef OS2_NT -# include -# include -#else -# include -#endif +#include #include "mad.h" #include "regex.h" #include "util.h" diff --git a/src/main.c b/src/main.c index 7159fa8ec..1650a4623 100644 --- a/src/main.c +++ b/src/main.c @@ -2222,7 +2222,7 @@ OS_Setup () shell = get_default_shell (); /* Default opening mode for files is binary, not text (CR/LF translation) */ - _fmode = _O_BINARY; + _fmode = O_BINARY; mc_home = get_mc_lib_dir (); } diff --git a/src/tree.c b/src/tree.c index 9eb46210e..dd539a772 100644 --- a/src/tree.c +++ b/src/tree.c @@ -1176,15 +1176,15 @@ static int tree_mkdir_cmd (WTree *tree) return 1; } -static int tree_rmdir_cmd (WTree *tree) +static void tree_rmdir_cmd (WTree *tree) { char old_dir [MC_MAXPATHLEN]; if (tree->selected_ptr){ if (!mc_get_current_wd (old_dir, MC_MAXPATHLEN)) - return 0; + return; if (mc_chdir (PATH_SEP_STR)) - return 0; + return; if (confirm_delete){ char *cmd_buf; int result; @@ -1195,7 +1195,7 @@ static int tree_rmdir_cmd (WTree *tree) result = query_dialog (" Delete ", cmd_buf, 3, 2, "&Yes", "&No"); free (cmd_buf); if (result != 0){ - return 0; + return; } } create_op_win (OP_DELETE, 0); @@ -1203,9 +1203,9 @@ static int tree_rmdir_cmd (WTree *tree) tree_forget_cmd (tree); destroy_op_win (); mc_chdir (old_dir); - return 1; + return; } else - return 0; + return; } #if 0 diff --git a/src/util.c b/src/util.c index ea4015c20..d875cf7ba 100644 --- a/src/util.c +++ b/src/util.c @@ -321,7 +321,7 @@ char *string_perm (mode_t mode_bits) if (ismode (mode_bits, S_IXUSR)) mode [3] = 'x'; if (ismode (mode_bits, S_IWUSR)) mode [2] = 'w'; if (ismode (mode_bits, S_IRUSR)) mode [1] = 'r'; -#ifndef __os2__ +#ifndef OS2_NT if (ismode (mode_bits, S_ISUID)) mode [3] = (mode [3] == 'x') ? 's' : 'S'; if (ismode (mode_bits, S_ISGID)) mode [6] = (mode [6] == 'x') ? 's' : 'S'; if (ismode (mode_bits, S_IFCHR)) mode [0] = 'c'; diff --git a/src/view.c b/src/view.c index af93181fe..58bdf4007 100644 --- a/src/view.c +++ b/src/view.c @@ -1483,7 +1483,7 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int)) update_activate = 0; for (; ; isatbeg = 1, free (s)){ -#ifdef HAVE_X +#ifdef PORT_HAS_FLUSH_EVENTS static int count; if ((count++ % 32) == 0) diff --git a/tk/ChangeLog b/tk/ChangeLog index fcf2d9361..9e2d48c0c 100644 --- a/tk/ChangeLog +++ b/tk/ChangeLog @@ -1,3 +1,7 @@ +Mon Mar 16 13:05:47 1998 Pavel Roskin + + * tkview.c: Include stdio.h; Minor spelling corrections added. + 1998-03-04 Federico Mena Quintero * tkconf.h (PORT_HAS_FILTER_CHANGED): New flag for conditional compilation. diff --git a/tk/tkview.c b/tk/tkview.c index 81bf634a3..01694d457 100644 --- a/tk/tkview.c +++ b/tk/tkview.c @@ -23,6 +23,9 @@ code so that the code knows about the window resize. */ +#include + +#define WANT_WIDGETS #include "dlg.h" #include "view.h" #include "tkmain.h" @@ -128,7 +131,7 @@ view_percent (WView *view, int p, int w) static int current_color; void -view_set_color (int font) +view_set_color (WView *view, int font) { current_color = font; } @@ -152,7 +155,7 @@ void view_add_string (WView *view, char *s) { while (*s) - add_character (view, *s++); + view_add_character (view, *s++); } static char * @@ -262,4 +265,4 @@ view_gotoyx (WView *view, int row, int col) } view->last_col = col; } -#endif +