patch 7.4.2048
Problem:    There is still code and help for unsupported systems.
Solution:   Remove the code and text. (Hirohito Higashi)
diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak
index 3a11c8f..84637de 100644
--- a/src/Make_bc5.mak
+++ b/src/Make_bc5.mak
@@ -1,7 +1,7 @@
 #
 # Makefile for Vim.
 # Compiler: Borland C++ 5.0 and later 32-bit compiler
-#  Targets: Dos16 or Win32 (Windows NT and Windows 95) (with/without GUI)
+#  Targets: Win32 (Windows NT and Windows 95) (with/without GUI)
 #
 # NOTE: THIS IS OLD AND PROBABLY NO LONGER WORKS.
 #
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 646f7ec..853a597 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7713,11 +7713,7 @@
  * list. This function takes over responsibility for freeing the list.
  *
  * XXX The list is made into the argument list. This is freed using
- * FreeWild(), which does a series of vim_free() calls, unless the two defines
- * __EMX__ and __ALWAYS_HAS_TRAILING_NUL_POINTER are set. In this case, a
- * routine _fnexplodefree() is used. This may cause problems, but as the drop
- * file functionality is (currently) not in EMX this is not presently a
- * problem.
+ * FreeWild(), which does a series of vim_free() calls.
  */
     void
 handle_drop(
@@ -7851,7 +7847,7 @@
 # endif
 #endif
 
-#if (!defined(UNIX) && !defined(__EMX__)) || defined(PROTO)
+#if !defined(UNIX) || defined(PROTO)
 /*
  * Expand the file names in the global argument list.
  * If "fnum_list" is not NULL, use "fnum_list[fnum_len]" as a list of buffer
diff --git a/src/feature.h b/src/feature.h
index 2a090ab..9dc7dc2 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -56,8 +56,7 @@
 /*
  * For Unix, Mac and Win32 use +huge by default.  These days CPUs are fast and
  * Memory is cheap.
- * Use +big for older systems: Other MS-Windows, dos32, OS/2 and VMS.
- * The dos16 version has very little RAM available, use +small.
+ * Use +big for older systems: Other MS-Windows and VMS.
  * Otherwise use +normal
  */
 #if !defined(FEAT_TINY) && !defined(FEAT_SMALL) && !defined(FEAT_NORMAL) \
diff --git a/src/fileio.c b/src/fileio.c
index 235b412..e9dca0c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -367,7 +367,7 @@
      */
     if (sfname == NULL)
 	sfname = fname;
-#if defined(UNIX) || defined(__EMX__)
+#if defined(UNIX)
     fname = sfname;
 #endif
 
@@ -3150,7 +3150,7 @@
     int		    prev_got_int = got_int;
     int		    file_readonly = FALSE;  /* overwritten file is read-only */
     static char	    *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions')";
-#if defined(UNIX) || defined(__EMX__XX)	    /*XXX fix me sometime? */
+#if defined(UNIX)			    /*XXX fix me sometime? */
     int		    made_writable = FALSE;  /* 'w' bit has been set */
 #endif
 					/* writing everything */
@@ -7320,12 +7320,7 @@
     {
 	if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL)
 	    STRCPY(buf, tempdir);
-# ifdef __EMX__
-	if (vim_strchr(buf, '/') != NULL)
-	    STRCAT(buf, "/");
-	else
-# endif
-	    add_pathsep(buf);
+	add_pathsep(buf);
 	vim_tempdir = vim_strsave(buf);
 	vim_free(buf);
     }
@@ -7385,15 +7380,7 @@
 	    if (itmp[0] != '$' && mch_isdir(itmp))
 	    {
 		/* directory exists */
-# ifdef __EMX__
-		/* If $TMP contains a forward slash (perhaps using bash or
-		 * tcsh), don't add a backslash, use a forward slash!
-		 * Adding 2 backslashes didn't work. */
-		if (vim_strchr(itmp, '/') != NULL)
-		    STRCAT(itmp, "/");
-		else
-# endif
-		    add_pathsep(itmp);
+		add_pathsep(itmp);
 
 # ifdef HAVE_MKDTEMP
 		{
diff --git a/src/globals.h b/src/globals.h
index b89cac2..3c92510 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -197,7 +197,7 @@
 #endif
 
 EXTERN int	quit_more INIT(= FALSE);    /* 'q' hit at "--more--" msg */
-#if defined(UNIX) || defined(__EMX__) || defined(VMS) || defined(MACOS_X)
+#if defined(UNIX) || defined(VMS) || defined(MACOS_X)
 EXTERN int	newline_on_exit INIT(= FALSE);	/* did msg in altern. screen */
 EXTERN int	intr_char INIT(= 0);	    /* extra interrupt character */
 #endif
diff --git a/src/main.c b/src/main.c
index 26941bd..5c3e9f9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -75,7 +75,7 @@
     char_u	*serverStrEnc;		/* encoding of serverStr */
     char_u	*servername;		/* allocated name for our server */
 #endif
-#if !defined(UNIX) && !defined(__EMX__)
+#if !defined(UNIX)
 # define EXPAND_FILENAMES
     int		literal;		/* don't expand file names */
 #endif
@@ -183,7 +183,7 @@
 
 #if defined(WIN32) && defined(FEAT_MBYTE)
     /*
-     * MingW expands command line arguments, which confuses our code to
+     * MinGW expands command line arguments, which confuses our code to
      * convert when 'encoding' changes.  Get the unexpanded arguments.
      */
     argc = get_cmd_argsW(&argv);
@@ -231,10 +231,6 @@
 #endif
     starttime = time(NULL);
 
-#ifdef __EMX__
-    _wildcard(&params.argc, &params.argv);
-#endif
-
 #ifdef FEAT_MBYTE
     (void)mb_init();	/* init mb_bytelen_tab[] to ones */
 #endif
@@ -3216,7 +3212,7 @@
     int		n,	/* one of the ME_ defines */
     char_u	*str)	/* extra argument or NULL */
 {
-#if defined(UNIX) || defined(__EMX__) || defined(VMS)
+#if defined(UNIX) || defined(VMS)
     reset_signals();		/* kill us with CTRL-C here, if you like */
 #endif
 
@@ -3269,7 +3265,7 @@
 #endif
     };
 
-#if defined(UNIX) || defined(__EMX__) || defined(VMS)
+#if defined(UNIX) || defined(VMS)
     reset_signals();		/* kill us with CTRL-C here, if you like */
 #endif
 
diff --git a/src/memfile.c b/src/memfile.c
index 6b1a341..e2fadc2 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -602,16 +602,7 @@
 # ifdef HAVE_FSYNC
 	/*
 	 * most Unixes have the very useful fsync() function, just what we need.
-	 * However, with OS/2 and EMX it is also available, but there are
-	 * reports of bad problems with it (a bug in HPFS.IFS).
-	 * So we disable use of it here in case someone tries to be smart
-	 * and changes os_os2_cfg.h... (even though there is no __EMX__ test
-	 * in the #if, as __EMX__ does not have sync(); we hope for a timely
-	 * sync from the system itself).
 	 */
-#  if defined(__EMX__)
-   error "Don't use fsync with EMX! Read emxdoc.doc or emxfix01.doc for info."
-#  endif
 	if (STRCMP(p_sws, "fsync") == 0)
 	{
 	    if (fsync(mfp->mf_fd))
diff --git a/src/memline.c b/src/memline.c
index bf1e91e..f7c68b2 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -2038,7 +2038,7 @@
 }
 #endif
 
-#if (defined(UNIX) || defined(__EMX__) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
+#if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
 static int process_still_running;
 #endif
 
@@ -2126,7 +2126,7 @@
 		{
 		    MSG_PUTS(_("\n        process ID: "));
 		    msg_outnum(char_to_long(b0.b0_pid));
-#if defined(UNIX) || defined(__EMX__)
+#if defined(UNIX)
 		    /* EMX kill() not working correctly, it seems */
 		    if (kill((pid_t)char_to_long(b0.b0_pid), 0) == 0)
 		    {
@@ -4445,7 +4445,7 @@
 		    }
 #endif
 
-#if (defined(UNIX) || defined(__EMX__) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
+#if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
 		    process_still_running = FALSE;
 #endif
 #ifdef FEAT_AUTOCMD
@@ -4497,13 +4497,13 @@
 				    name == NULL
 					?  (char_u *)_("Swap file already exists!")
 					: name,
-# if defined(UNIX) || defined(__EMX__) || defined(VMS)
+# if defined(UNIX) || defined(VMS)
 				    process_still_running
 					? (char_u *)_("&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort") :
 # endif
 					(char_u *)_("&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort"), 1, NULL, FALSE);
 
-# if defined(UNIX) || defined(__EMX__) || defined(VMS)
+# if defined(UNIX) || defined(VMS)
 			if (process_still_running && choice >= 4)
 			    choice++;	/* Skip missing "Delete it" button */
 # endif
diff --git a/src/menu.c b/src/menu.c
index 2802de3..af50a7a 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1818,7 +1818,7 @@
  * defined.  This is done once here.  add_menu_path() may have already been
  * called to define these menus, and may be called again.  This function calls
  * itself recursively.	Should be called at the top level with:
- * gui_create_initial_menus(root_menu, NULL);
+ * gui_create_initial_menus(root_menu);
  */
     void
 gui_create_initial_menus(vimmenu_T *menu)
diff --git a/src/misc1.c b/src/misc1.c
index a39658e..293ac9e 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -11135,17 +11135,9 @@
 {
     if (count <= 0 || files == NULL)
 	return;
-#if defined(__EMX__) && defined(__ALWAYS_HAS_TRAILING_NULL_POINTER) /* XXX */
-    /*
-     * Is this still OK for when other functions than expand_wildcards() have
-     * been used???
-     */
-    _fnexplodefree((char **)files);
-#else
     while (count--)
 	vim_free(files[count]);
     vim_free(files);
-#endif
 }
 
 /*
diff --git a/src/misc2.c b/src/misc2.c
index 23b6090..281f4af 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -851,7 +851,7 @@
     char_u *
 alloc_check(unsigned size)
 {
-#if !defined(UNIX) && !defined(__EMX__)
+#if !defined(UNIX)
     if (sizeof(int) == 2 && size > 0x7fff)
     {
 	/* Don't hide this message */
diff --git a/src/option.c b/src/option.c
index fbf0760..288c01b 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2004,11 +2004,7 @@
 #if defined(AMIGA) || defined(MSWIN)
 			    (char_u *)".,,",
 #else
-# if defined(__EMX__)
-			    (char_u *)".,/emx/include,,",
-# else /* Unix, probably */
 			    (char_u *)".,/usr/include,,",
-# endif
 #endif
 				(char_u *)0L} SCRIPTID_INIT},
 #if defined(DYNAMIC_PERL)
@@ -2344,7 +2340,7 @@
     {"shellxquote", "sxq",  P_STRING|P_VI_DEF|P_SECURE,
 			    (char_u *)&p_sxq, PV_NONE,
 			    {
-#if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
+#if defined(UNIX) && defined(USE_SYSTEM)
 			    (char_u *)"\"",
 #else
 			    (char_u *)"",
@@ -3184,9 +3180,6 @@
      */
     if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
 #if defined(MSWIN)
-# ifdef __EMX__
-	    || ((p = mch_getenv((char_u *)"EMXSHELL")) != NULL && *p != NUL)
-# endif
 	    || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
 # ifdef WIN3264
 	    || ((p = (char_u *)default_shell()) != NULL && *p != NUL)
diff --git a/src/option.h b/src/option.h
index 8f75993..f05a466 100644
--- a/src/option.h
+++ b/src/option.h
@@ -21,20 +21,16 @@
 # if defined(WIN3264)
 #  define DFLT_EFM	"%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%f|%l| %m"
 # else
-#  if defined(__EMX__)	/* put most common here (i.e. gcc format) at front */
-#   define DFLT_EFM	"%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f(%l:%c) : %m,%f|%l| %m"
+#  if defined(__QNX__)
+#   define DFLT_EFM	"%f(%l):%*[^WE]%t%*\\D%n:%m,%f|%l| %m"
 #  else
-#   if defined(__QNX__)
-#    define DFLT_EFM	"%f(%l):%*[^WE]%t%*\\D%n:%m,%f|%l| %m"
-#   else
-#    ifdef VMS
-#     define DFLT_EFM	"%A%p^,%C%%CC-%t-%m,%Cat line number %l in file %f,%f|%l| %m"
-#    else /* Unix, probably */
-#     ifdef EBCDIC
+#   ifdef VMS
+#    define DFLT_EFM	"%A%p^,%C%%CC-%t-%m,%Cat line number %l in file %f,%f|%l| %m"
+#   else /* Unix, probably */
+#    ifdef EBCDIC
 #define DFLT_EFM	"%*[^ ] %*[^ ] %f:%l%*[ ]%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m"
 #     else
 #define DFLT_EFM	"%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m"
-#     endif
 #    endif
 #   endif
 #  endif
diff --git a/src/os_unix.c b/src/os_unix.c
index 32c1640..df39cd3 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -211,14 +211,10 @@
 static void catch_int_signal(void);
 static void set_signals(void);
 static void catch_signals(RETSIGTYPE (*func_deadly)(), RETSIGTYPE (*func_other)());
-#ifndef __EMX__
 static int  have_wildcard(int, char_u **);
 static int  have_dollars(int, char_u **);
-#endif
 
-#ifndef __EMX__
 static int save_patterns(int num_pat, char_u **pat, int *num_file, char_u ***file);
-#endif
 
 #ifndef SIG_ERR
 # define SIG_ERR	((RETSIGTYPE (*)())-1)
@@ -226,10 +222,8 @@
 
 /* volatile because it is used in signal handler sig_winch(). */
 static volatile int do_resize = FALSE;
-#ifndef __EMX__
 static char_u	*extra_shell_arg = NULL;
 static int	show_shell_mess = TRUE;
-#endif
 /* volatile because it is used in signal handler deathtrap(). */
 static volatile int deadly_signal = 0;	    /* The signal we caught */
 /* volatile because it is used in signal handler deathtrap(). */
@@ -570,13 +564,10 @@
     long_u
 mch_total_mem(int special UNUSED)
 {
-# ifdef __EMX__
-    return ulimit(3, 0L) >> 10;   /* always 32MB? */
-# else
     long_u	mem = 0;
     long_u	shiftright = 10;  /* how much to shift "mem" right for Kbyte */
 
-#  ifdef HAVE_SYSCTL
+# ifdef HAVE_SYSCTL
     int		mib[2], physmem;
     size_t	len;
 
@@ -586,9 +577,9 @@
     len = sizeof(physmem);
     if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0)
 	mem = (long_u)physmem;
-#  endif
+# endif
 
-#  if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)
+# if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)
     if (mem == 0)
     {
 	struct sysinfo sinfo;
@@ -596,7 +587,7 @@
 	/* Linux way of getting amount of RAM available */
 	if (sysinfo(&sinfo) == 0)
 	{
-#   ifdef HAVE_SYSINFO_MEM_UNIT
+#  ifdef HAVE_SYSINFO_MEM_UNIT
 	    /* avoid overflow as much as possible */
 	    while (shiftright > 0 && (sinfo.mem_unit & 1) == 0)
 	    {
@@ -604,14 +595,14 @@
 		--shiftright;
 	    }
 	    mem = sinfo.totalram * sinfo.mem_unit;
-#   else
+#  else
 	    mem = sinfo.totalram;
-#   endif
+#  endif
 	}
     }
-#  endif
+# endif
 
-#  ifdef HAVE_SYSCONF
+# ifdef HAVE_SYSCONF
     if (mem == 0)
     {
 	long	    pagesize, pagecount;
@@ -630,19 +621,19 @@
 	    mem = (long_u)pagesize * pagecount;
 	}
     }
-#  endif
+# endif
 
     /* Return the minimum of the physical memory and the user limit, because
      * using more than the user limit may cause Vim to be terminated. */
-#  if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT)
+# if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT)
     {
 	struct rlimit	rlp;
 
 	if (getrlimit(RLIMIT_DATA, &rlp) == 0
 		&& rlp.rlim_cur < ((rlim_t)1 << (sizeof(long_u) * 8 - 1))
-#   ifdef RLIM_INFINITY
+#  ifdef RLIM_INFINITY
 		&& rlp.rlim_cur != RLIM_INFINITY
-#   endif
+#  endif
 		&& ((long_u)rlp.rlim_cur >> 10) < (mem >> shiftright)
 	   )
 	{
@@ -650,12 +641,11 @@
 	    shiftright = 10;
 	}
     }
-#  endif
+# endif
 
     if (mem > 0)
 	return mem >> shiftright;
     return (long_u)0x1fffff;
-# endif
 }
 #endif
 
@@ -712,9 +702,6 @@
 #  ifndef HAVE_SELECT
 	poll(NULL, 0, (int)msec);
 #  else
-#   ifdef __EMX__
-	_sleep2(msec);
-#   else
 	{
 	    struct timeval tv;
 
@@ -726,7 +713,6 @@
 	     */
 	    select(0, NULL, NULL, NULL, &tv);
 	}
-#   endif /* __EMX__ */
 #  endif /* HAVE_SELECT */
 # endif /* HAVE_NANOSLEEP */
 #endif /* HAVE_USLEEP */
@@ -2608,17 +2594,13 @@
     int
 mch_isFullName(char_u *fname)
 {
-#ifdef __EMX__
-    return _fnisabs(fname);
-#else
-# ifdef VMS
+#ifdef VMS
     return ( fname[0] == '/'	       || fname[0] == '.'	    ||
 	     strchr((char *)fname,':') || strchr((char *)fname,'"') ||
 	    (strchr((char *)fname,'[') && strchr((char *)fname,']'))||
 	    (strchr((char *)fname,'<') && strchr((char *)fname,'>'))   );
-# else
+#else
     return (*fname == '/' || *fname == '~');
-# endif
 #endif
 }
 
@@ -3840,19 +3822,6 @@
     char_u	*p;
 
     /*
-     * For OS/2 use _scrsize().
-     */
-# ifdef __EMX__
-    {
-	int s[2];
-
-	_scrsize(s);
-	columns = s[0];
-	rows = s[1];
-    }
-# endif
-
-    /*
      * 1. try using an ioctl. It is the most accurate method.
      *
      * Try using TIOCGWINSZ first, some systems that have it also define
@@ -4102,9 +4071,6 @@
     int		tmode = cur_tmode;
 #ifdef USE_SYSTEM	/* use system() to start the shell: simple but slow */
     int	    x;
-# ifndef __EMX__
-    char_u  *newcmd;   /* only needed for unix */
-# else
     /*
      * Set the preferred shell in the EMXSHELL environment variable (but
      * only if it is different from what is already in the environment).
@@ -4125,7 +4091,6 @@
 	    putenv((char *)p);	/* don't free the pointer! */
 	}
     }
-# endif
 
     out_flush();
 
@@ -4137,24 +4102,11 @@
     loose_clipboard();
 # endif
 
-# ifdef __EMX__
-    if (cmd == NULL)
-	x = system("");	/* this starts an interactive shell in emx */
-    else
-	x = system((char *)cmd);
-    /* system() returns -1 when error occurs in starting shell */
-    if (x == -1 && !emsg_silent)
-    {
-	MSG_PUTS(_("\nCannot execute shell "));
-	msg_outtrans(p_sh);
-	msg_putchar('\n');
-    }
-# else /* not __EMX__ */
     if (cmd == NULL)
 	x = system((char *)p_sh);
     else
     {
-#  ifdef VMS
+# ifdef VMS
 	if (ofn = strchr((char *)cmd, '>'))
 	    *ofn++ = '\0';
 	if (ifn = strchr((char *)cmd, '<'))
@@ -4170,7 +4122,7 @@
 	    x = vms_sys((char *)cmd, ofn, ifn);
 	else
 	    x = system((char *)cmd);
-#  else
+# else
 	newcmd = lalloc(STRLEN(p_sh)
 		+ (extra_shell_arg == NULL ? 0 : STRLEN(extra_shell_arg))
 		+ STRLEN(p_shcf) + STRLEN(cmd) + 4, TRUE);
@@ -4185,7 +4137,7 @@
 	    x = system((char *)newcmd);
 	    vim_free(newcmd);
 	}
-#  endif
+# endif
     }
 # ifdef VMS
     x = vms_sys_status(x);
@@ -4194,7 +4146,6 @@
 	;
     else if (x == 127)
 	MSG_PUTS(_("\nCannot execute shell sh\n"));
-# endif	/* __EMX__ */
     else if (x && !(options & SHELL_SILENT))
     {
 	MSG_PUTS(_("\nshell returned "));
@@ -5742,12 +5693,6 @@
 	    mzquantum_used = TRUE;
 	}
 # endif
-# ifdef __EMX__
-	/* don't check for incoming chars if not in raw mode, because select()
-	 * always returns TRUE then (in some version of emx.dll) */
-	if (curr_tmode != TMODE_RAW)
-	    return 0;
-# endif
 
 	if (towait >= 0)
 	{
@@ -5975,121 +5920,7 @@
     size_t	len;
     char_u	*p;
     int		dir;
-#ifdef __EMX__
-    /*
-     * This is the OS/2 implementation.
-     */
-# define EXPL_ALLOC_INC	16
-    char_u	**expl_files;
-    size_t	files_alloced, files_free;
-    char_u	*buf;
-    int		has_wildcard;
 
-    *num_file = 0;	/* default: no files found */
-    files_alloced = EXPL_ALLOC_INC; /* how much space is allocated */
-    files_free = EXPL_ALLOC_INC;    /* how much space is not used  */
-    *file = (char_u **)alloc(sizeof(char_u **) * files_alloced);
-    if (*file == NULL)
-	return FAIL;
-
-    for (; num_pat > 0; num_pat--, pat++)
-    {
-	expl_files = NULL;
-	if (vim_strchr(*pat, '$') || vim_strchr(*pat, '~'))
-	    /* expand environment var or home dir */
-	    buf = expand_env_save(*pat);
-	else
-	    buf = vim_strsave(*pat);
-	expl_files = NULL;
-	has_wildcard = mch_has_exp_wildcard(buf);  /* (still) wildcards? */
-	if (has_wildcard)   /* yes, so expand them */
-	    expl_files = (char_u **)_fnexplode(buf);
-
-	/*
-	 * return value of buf if no wildcards left,
-	 * OR if no match AND EW_NOTFOUND is set.
-	 */
-	if ((!has_wildcard && ((flags & EW_NOTFOUND) || mch_getperm(buf) >= 0))
-		|| (expl_files == NULL && (flags & EW_NOTFOUND)))
-	{   /* simply save the current contents of *buf */
-	    expl_files = (char_u **)alloc(sizeof(char_u **) * 2);
-	    if (expl_files != NULL)
-	    {
-		expl_files[0] = vim_strsave(buf);
-		expl_files[1] = NULL;
-	    }
-	}
-	vim_free(buf);
-
-	/*
-	 * Count number of names resulting from expansion,
-	 * At the same time add a backslash to the end of names that happen to
-	 * be directories, and replace slashes with backslashes.
-	 */
-	if (expl_files)
-	{
-	    for (i = 0; (p = expl_files[i]) != NULL; i++)
-	    {
-		dir = mch_isdir(p);
-		/* If we don't want dirs and this is one, skip it */
-		if ((dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE)))
-		    continue;
-
-		/* Skip files that are not executable if we check for that. */
-		if (!dir && (flags & EW_EXEC)
-			     && !mch_can_exe(p, NULL, !(flags & EW_SHELLCMD)))
-		    continue;
-
-		if (--files_free == 0)
-		{
-		    /* need more room in table of pointers */
-		    files_alloced += EXPL_ALLOC_INC;
-		    *file = (char_u **)vim_realloc(*file,
-					   sizeof(char_u **) * files_alloced);
-		    if (*file == NULL)
-		    {
-			EMSG(_(e_outofmem));
-			*num_file = 0;
-			return FAIL;
-		    }
-		    files_free = EXPL_ALLOC_INC;
-		}
-		slash_adjust(p);
-		if (dir)
-		{
-		    /* For a directory we add a '/', unless it's already
-		     * there. */
-		    len = STRLEN(p);
-		    if (((*file)[*num_file] = alloc(len + 2)) != NULL)
-		    {
-			STRCPY((*file)[*num_file], p);
-			if (!after_pathsep((*file)[*num_file],
-						    (*file)[*num_file] + len))
-			{
-			    (*file)[*num_file][len] = psepc;
-			    (*file)[*num_file][len + 1] = NUL;
-			}
-		    }
-		}
-		else
-		{
-		    (*file)[*num_file] = vim_strsave(p);
-		}
-
-		/*
-		 * Error message already given by either alloc or vim_strsave.
-		 * Should return FAIL, but returning OK works also.
-		 */
-		if ((*file)[*num_file] == NULL)
-		    break;
-		(*num_file)++;
-	    }
-	    _fnexplodefree((char **)expl_files);
-	}
-    }
-    return OK;
-
-#else /* __EMX__ */
     /*
      * This is the non-OS/2 implementation (really Unix).
      */
@@ -6566,13 +6397,10 @@
     if (flags & EW_NOTFOUND)
 	return save_patterns(num_pat, pat, num_file, file);
     return FAIL;
-
-#endif /* __EMX__ */
 }
 
 #endif /* VMS */
 
-#ifndef __EMX__
     static int
 save_patterns(
     int		num_pat,
@@ -6598,7 +6426,6 @@
     *num_file = num_pat;
     return OK;
 }
-#endif
 
 /*
  * Return TRUE if the string "p" contains a wildcard that mch_expandpath() can
@@ -6649,7 +6476,6 @@
     return FALSE;
 }
 
-#ifndef __EMX__
     static int
 have_wildcard(int num, char_u **file)
 {
@@ -6671,7 +6497,6 @@
 	    return TRUE;
     return FALSE;
 }
-#endif	/* ifndef __EMX__ */
 
 #if !defined(HAVE_RENAME) || defined(PROTO)
 /*
diff --git a/src/os_unix.h b/src/os_unix.h
index 73881af..b835df6 100644
--- a/src/os_unix.h
+++ b/src/os_unix.h
@@ -33,10 +33,6 @@
 # include <stdlib.h>
 #endif
 
-#ifdef __EMX__
-# define HAVE_TOTAL_MEM
-#endif
-
 #if defined(__CYGWIN__) || defined(__CYGWIN32__)
 # define WIN32UNIX	/* Compiling for Win32 using Unix files. */
 # define BINARY_FILE_IO
diff --git a/src/proto.h b/src/proto.h
index f4f6476..c58992e 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -35,7 +35,7 @@
 # ifdef AMIGA
 #  include "os_amiga.pro"
 # endif
-# if defined(UNIX) || defined(__EMX__) || defined(VMS)
+# if defined(UNIX) || defined(VMS)
 #  include "os_unix.pro"
 # endif
 # ifdef WIN3264
diff --git a/src/term.c b/src/term.c
index 8cb3e8a..ba2d473 100644
--- a/src/term.c
+++ b/src/term.c
@@ -395,7 +395,7 @@
     {K_RIGHT,		"\033[C"},
 # endif
 
-# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__)
+# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS)
 /*
  * standard ANSI terminal, default for unix
  */
@@ -431,20 +431,16 @@
 #  endif
 # endif
 
-# if defined(ALL_BUILTIN_TCAPS) || defined(__EMX__)
+# if defined(ALL_BUILTIN_TCAPS)
 /*
  * These codes are valid when nansi.sys or equivalent has been installed.
  * Function keys on a PC are preceded with a NUL. These are converted into
  * K_NUL '\316' in mch_inchar(), because we cannot handle NULs in key codes.
  * CTRL-arrow is used instead of SHIFT-arrow.
  */
-#ifdef __EMX__
-    {(int)KS_NAME,	"os2ansi"},
-#else
     {(int)KS_NAME,	"pcansi"},
     {(int)KS_DL,	"\033[M"},
     {(int)KS_AL,	"\033[L"},
-#endif
     {(int)KS_CE,	"\033[K"},
     {(int)KS_CL,	"\033[2J"},
     {(int)KS_ME,	"\033[0m"},
@@ -516,7 +512,7 @@
     {K_PAGEUP,		"\316I"},
 # endif
 
-# if defined(WIN3264) || defined(ALL_BUILTIN_TCAPS) || defined(__EMX__)
+# if defined(WIN3264) || defined(ALL_BUILTIN_TCAPS)
 /*
  * These codes are valid for the Win32 Console .  The entries that start with
  * ESC | are translated into console calls in os_win32.c.  The function keys
@@ -793,7 +789,7 @@
 #  endif
 # endif
 
-# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__)
+# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS)
     {(int)KS_NAME,	"xterm"},
     {(int)KS_CE,	IF_EB("\033[K", ESC_STR "[K")},
     {(int)KS_AL,	IF_EB("\033[L", ESC_STR "[L")},
@@ -1312,10 +1308,6 @@
 # define DEFAULT_TERM	(char_u *)"vt52"
 #endif
 
-#ifdef __EMX__
-# define DEFAULT_TERM	(char_u *)"os2ansi"
-#endif
-
 #ifdef VMS
 # define DEFAULT_TERM	(char_u *)"vt320"
 #endif
@@ -2094,7 +2086,7 @@
 }
 #endif /* HAVE_TGETENT */
 
-#if defined(HAVE_TGETENT) && (defined(UNIX) || defined(__EMX__) || defined(VMS) || defined(MACOS_X))
+#if defined(HAVE_TGETENT) && (defined(UNIX) || defined(VMS) || defined(MACOS_X))
 /*
  * Get Columns and Rows from the termcap. Used after a window signal if the
  * ioctl() fails. It doesn't make sense to call tgetent each time if the "co"
@@ -2398,11 +2390,7 @@
 /*
  * the number of calls to ui_write is reduced by using the buffer "out_buf"
  */
-#ifdef DOS16
-# define OUT_SIZE	255		/* only have 640K total... */
-#else
-# define OUT_SIZE	2047
-#endif
+#define OUT_SIZE	2047
 	    /* Add one to allow mch_write() in os_win32.c to append a NUL */
 static char_u		out_buf[OUT_SIZE + 1];
 static int		out_pos = 0;	/* number of chars in out_buf */
diff --git a/src/undo.c b/src/undo.c
index e60e9fa..71e62a1 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -641,7 +641,7 @@
 	u_getbot();
     }
 
-#if !defined(UNIX) && !defined(WIN32) && !defined(__EMX__)
+#if !defined(UNIX) && !defined(WIN32)
 	/*
 	 * With Amiga we can't handle big undo's, because
 	 * then u_alloc_line would have to allocate a block larger than 32K
diff --git a/src/version.c b/src/version.c
index fc767bb..8b41fe9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -580,7 +580,7 @@
 	"-syntax",
 #endif
 	    /* only interesting on Unix systems */
-#if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
+#if defined(USE_SYSTEM) && defined(UNIX)
 	"+system()",
 #endif
 #ifdef FEAT_TAG_BINS
@@ -612,8 +612,8 @@
 #else
 	"-termguicolors",
 #endif
-#if defined(UNIX) || defined(__EMX__)
-/* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */
+#if defined(UNIX)
+/* only Unix can have terminfo instead of termcap */
 # ifdef TERMINFO
 	"+terminfo",
 # else
@@ -759,6 +759,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2048,
+/**/
     2047,
 /**/
     2046,
diff --git a/src/vim.h b/src/vim.h
index 4d6f934..5f49c34 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -9,7 +9,7 @@
 #ifndef VIM__H
 # define VIM__H
 
-/* use fastcall for Borland, when compiling for Win32 (not for DOS16) */
+/* use fastcall for Borland, when compiling for Win32 */
 #if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG)
 #if defined(FEAT_PERL) || \
     defined(FEAT_PYTHON) || \
@@ -27,7 +27,7 @@
 # endif
 #endif
 
-#if defined(WIN32) || defined(_WIN64) || defined(__EMX__)
+#if defined(WIN32) || defined(_WIN64)
 # include "vimio.h"
 #endif
 
@@ -84,10 +84,6 @@
 # define ROOT_UID 0
 #endif
 
-#ifdef __EMX__		/* hand-edited config.h for OS/2 with EMX */
-# include "os_os2_cfg.h"
-#endif
-
 /*
  * MACOS_CLASSIC compiling for MacOS prior to MacOS X
  * MACOS_X_UNIX  compiling for MacOS X (using os_unix.c)
@@ -252,7 +248,7 @@
 # include "os_beos.h"
 #endif
 
-#if (defined(UNIX) || defined(__EMX__) || defined(VMS)) \
+#if (defined(UNIX) || defined(VMS)) \
 	&& (!defined(MACOS_X) || defined(HAVE_CONFIG_H))
 # include "os_unix.h"	    /* bring lots of system header files */
 #endif
@@ -277,12 +273,6 @@
 # include "auto/osdef.h"	/* bring missing declarations in */
 #endif
 
-#ifdef __EMX__
-# define    getcwd  _getcwd2
-# define    chdir   _chdir2
-# undef	    CHECK_INODE
-#endif
-
 #ifdef AMIGA
 # include "os_amiga.h"
 #endif
@@ -477,7 +467,7 @@
 #endif
 
 #if defined(HAVE_ERRNO_H) \
-	|| defined(WIN32) || defined(_WIN64) || defined(__EMX__)
+	|| defined(WIN32) || defined(_WIN64)
 # include <errno.h>
 #endif
 
@@ -1530,7 +1520,7 @@
  * EMX doesn't have a global way of making open() use binary I/O.
  * Use O_BINARY for all open() calls.
  */
-#if defined(__EMX__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN32__)
 # define O_EXTRA    O_BINARY
 #else
 # define O_EXTRA    0
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 8cd760b..f76adaa 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -80,14 +80,7 @@
 #else
 # include <fcntl.h>
 #endif
-#ifdef __TSC__
-# define MSDOS
-#endif
-#if !defined(OS2) && defined(__EMX__)
-# define OS2
-#endif
-#if defined(MSDOS) || defined(WIN32) || defined(OS2) || defined(__BORLANDC__) \
-  || defined(CYGWIN)
+#if defined(WIN32) || defined(__BORLANDC__) || defined(CYGWIN)
 # include <io.h>	/* for setmode() */
 #else
 # ifdef UNIX
@@ -149,18 +142,10 @@
 #ifdef WIN32
 char osver[] = " (Win32)";
 #else
-# ifdef DJGPP
-char osver[] = " (dos 32 bit)";
-# else
-#  ifdef MSDOS
-char osver[] = " (dos 16 bit)";
-#  else
 char osver[] = "";
-#  endif
-# endif
 #endif
 
-#if defined(MSDOS) || defined(WIN32) || defined(OS2)
+#if defined(WIN32)
 # define BIN_READ(yes)  ((yes) ? "rb" : "rt")
 # define BIN_WRITE(yes) ((yes) ? "wb" : "wt")
 # define BIN_CREAT(yes) ((yes) ? (O_CREAT|O_BINARY) : O_CREAT)
@@ -203,8 +188,7 @@
 #endif
 
 #ifndef __P
-# if defined(__STDC__) || defined(MSDOS) || defined(WIN32) || defined(OS2) \
-		|| defined(__BORLANDC__)
+# if defined(__STDC__) || defined(WIN32) || defined(__BORLANDC__)
 #  define __P(a) a
 # else
 #  define __P(a) ()