changeset 108443:b836559c725c

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 02 Apr 2010 14:34:08 +0000
parents 5a619d0a9158 (current diff) 94a453a3e40a (diff)
children 8ce523466531
files msdos/mainmake msdos/sed1.inp msdos/sed2.inp msdos/sed3.inp
diffstat 44 files changed, 132 insertions(+), 962 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 01 14:34:20 2010 +0000
+++ b/ChangeLog	Fri Apr 02 14:34:08 2010 +0000
@@ -1,3 +1,7 @@
+2010-04-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* configure.in: Remove all references to LIBX11_SYSTEM.
+
 2010-03-30  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* configure.in: Remove all references to C_DEBUG_SWITCH.
--- a/admin/CPP-DEFINES	Thu Apr 01 14:34:20 2010 +0000
+++ b/admin/CPP-DEFINES	Fri Apr 02 14:34:08 2010 +0000
@@ -7,9 +7,7 @@
 __CYGWIN__	Ditto
 MSDOS		Compiling the MS-DOS port.
 __MSDOS__	Ditto.
-__DJGPP__	Major version number of the DJGPP library for the DOS port.
-__DJGPP_MINOR__ Minor version number of the DJGPP library.
-__GO32__	Compiling the DOS port with DJGPP v1.x (obsolete).
+__DJGPP_MINOR__ Minor version number of the DJGPP library; used only in msdos.c and dosfns.c.
 DOS_NT		Compiling for either the MS-DOS or native MS-Windows port.
 WINDOWSNT	Compiling the native MS-Windows (W32) port.
 __MINGW32__	Compiling the W32 port with the MinGW port of GCC.
@@ -236,7 +234,6 @@
 LIBS_MACHINE
 LIBS_SYSTEM
 LIBS_TERMCAP
-LIBX11_SYSTEM
 LIBXMU
 LIB_GCC
 LIB_MATH
--- a/admin/ChangeLog	Thu Apr 01 14:34:20 2010 +0000
+++ b/admin/ChangeLog	Fri Apr 02 14:34:08 2010 +0000
@@ -1,3 +1,7 @@
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+	* CPP-DEFINES (__DJGPP__, __GO32__): Remove, no longer used.
+
 2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
 
 	* Branch for 23.2.
--- a/configure	Thu Apr 01 14:34:20 2010 +0000
+++ b/configure	Fri Apr 02 14:34:08 2010 +0000
@@ -5796,10 +5796,7 @@
 #define LIB_X11_LIB -lX11
 #endif
 
-#ifndef LIBX11_SYSTEM
-#define LIBX11_SYSTEM
-#endif
-configure___ LIBX=LIB_X11_LIB LIBX11_SYSTEM
+configure___ LIBX=LIB_X11_LIB
 
 #ifdef UNEXEC
 configure___ unexec=UNEXEC
--- a/configure.in	Thu Apr 01 14:34:20 2010 +0000
+++ b/configure.in	Fri Apr 02 14:34:08 2010 +0000
@@ -865,10 +865,7 @@
 #define LIB_X11_LIB -lX11
 #endif
 
-#ifndef LIBX11_SYSTEM
-#define LIBX11_SYSTEM
-#endif
-configure___ LIBX=LIB_X11_LIB LIBX11_SYSTEM
+configure___ LIBX=LIB_X11_LIB
 
 #ifdef UNEXEC
 configure___ unexec=UNEXEC
--- a/lib-src/ChangeLog	Thu Apr 01 14:34:20 2010 +0000
+++ b/lib-src/ChangeLog	Fri Apr 02 14:34:08 2010 +0000
@@ -1,3 +1,10 @@
+2010-04-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	Remove extern errno declarations.
+	* movemail.c:
+	* etags.c:
+	* emacsclient.c: Remove extern errno declarations.
+
 2010-03-20  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (KRB4LIB, DESLIB, KRB5LIB, CRYPTOLIB, COM_ERRLIB)
--- a/lib-src/emacsclient.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/lib-src/emacsclient.c	Fri Apr 02 14:34:08 2010 +0000
@@ -723,7 +723,6 @@
 #define SEND_BUFFER_SIZE   4096
 
 extern char *strerror ();
-extern int errno;
 
 /* Buffer to accumulate data to send in TCP connections.  */
 char send_buffer[SEND_BUFFER_SIZE + 1];
--- a/lib-src/etags.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/lib-src/etags.c	Fri Apr 02 14:34:08 2010 +0000
@@ -188,9 +188,6 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
-#ifndef errno
-  extern int errno;
-#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
--- a/lib-src/movemail.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/lib-src/movemail.c	Fri Apr 02 14:34:08 2010 +0000
@@ -140,9 +140,6 @@
 #endif
 #endif
 
-#ifndef errno
-extern int errno;
-#endif
 char *strerror ();
 #ifdef HAVE_INDEX
 extern char *index __P ((const char *, int));
--- a/lisp/ChangeLog	Thu Apr 01 14:34:20 2010 +0000
+++ b/lisp/ChangeLog	Fri Apr 02 14:34:08 2010 +0000
@@ -1,3 +1,13 @@
+2010-04-02  Sam Steingold  <sds@gnu.org>
+
+	* vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling
+	`vc-hg-command' with a list of flags.
+
+2010-04-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* tmm.el (tmm-get-keymap): Check with symbolp before passing
+	value to fboundp, it may not be a symbol.
+
 2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
 	* cus-edit.el (custom-buffer-sort-alphabetically): Update
--- a/lisp/tmm.el	Thu Apr 01 14:34:20 2010 +0000
+++ b/lisp/tmm.el	Fri Apr 02 14:34:08 2010 +0000
@@ -452,20 +452,21 @@
       (unless (assoc event tmm-table-undef)
 	(cond ((if (listp elt)
 		   (or (keymapp elt) (eq (car elt) 'lambda))
-		 (fboundp elt))
+		 (and (symbolp elt) (fboundp elt)))
 	       (setq km elt))
 
 	      ((if (listp (cdr-safe elt))
 		   (or (keymapp (cdr-safe elt))
 		       (eq (car (cdr-safe elt)) 'lambda))
-		 (fboundp (cdr-safe elt)))
+		 (and (symbolp (cdr-safe elt)) (fboundp (cdr-safe elt))))
 	       (setq km (cdr elt))
 	       (and (stringp (car elt)) (setq str (car elt))))
 
 	      ((if (listp (cdr-safe (cdr-safe elt)))
 		   (or (keymapp (cdr-safe (cdr-safe elt)))
 		       (eq (car (cdr-safe (cdr-safe elt))) 'lambda))
-		 (fboundp (cdr-safe (cdr-safe elt))))
+		 (and (symbolp (cdr-safe (cdr-safe elt))
+			       (fboundp (cdr-safe (cdr-safe elt))))))
 	       (setq km (cddr elt))
 	       (and (stringp (car elt)) (setq str (car elt)))
 	       (and str
@@ -499,7 +500,8 @@
 	      ((if (listp (cdr-safe (cdr-safe (cdr-safe elt))))
 		   (or (keymapp (cdr-safe (cdr-safe (cdr-safe elt))))
 		       (eq (car (cdr-safe (cdr-safe (cdr-safe elt)))) 'lambda))
-		 (fboundp (cdr-safe (cdr-safe (cdr-safe elt)))))
+		 (and (symbolp (cdr-safe (cdr-safe (cdr-safe elt))))
+		      (fboundp (cdr-safe (cdr-safe (cdr-safe elt))))))
 					 ; New style of easy-menu
 	       (setq km (cdr (cddr elt)))
 	       (and (stringp (car elt)) (setq str (car elt)))
--- a/lisp/vc-hg.el	Thu Apr 01 14:34:20 2010 +0000
+++ b/lisp/vc-hg.el	Fri Apr 02 14:34:08 2010 +0000
@@ -235,10 +235,10 @@
     (with-current-buffer
 	buffer
       (apply 'vc-hg-command buffer 0 files "log"
-	     (append
+	     (nconc
 	      (when start-revision (list (format "-r%s:" start-revision)))
 	      (when limit (list "-l" (format "%s" limit)))
-	      (when shortlog '("--style" "compact"))
+	      (when shortlog (list "--style" "compact"))
 	      vc-hg-log-switches)))))
 
 (defvar log-view-message-re)
@@ -419,7 +419,8 @@
 (defun vc-hg-checkin (files rev comment &optional extra-args)
   "Hg-specific version of `vc-backend-checkin'.
 REV is ignored."
-  (apply 'vc-hg-command nil 0 files  (append (list "commit" "-m" comment) extra-args)))
+  (apply 'vc-hg-command nil 0 files
+         (nconc (list "commit" "-m" comment) extra-args)))
 
 (defun vc-hg-find-revision (file rev buffer)
   (let ((coding-system-for-read 'binary)
@@ -611,22 +612,22 @@
   (interactive)
   (let ((marked-list (log-view-get-marked)))
     (if marked-list
-        (vc-hg-command
-         nil 0 nil
-         (cons "push"
+        (apply #'vc-hg-command
+               nil 0 nil
+               "push"
                (apply 'nconc
-                      (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
-         (error "No log entries selected for push"))))
+                      (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
+      (error "No log entries selected for push"))))
 
 (defun vc-hg-pull ()
   (interactive)
   (let ((marked-list (log-view-get-marked)))
     (if marked-list
-        (vc-hg-command
-         nil 0 nil
-         (cons "pull"
+        (apply #'vc-hg-command
+               nil 0 nil
+               "pull"
                (apply 'nconc
-                      (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
+                      (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
       (error "No log entries selected for pull"))))
 
 ;;; Internal functions
--- a/msdos/ChangeLog	Thu Apr 01 14:34:20 2010 +0000
+++ b/msdos/ChangeLog	Fri Apr 02 14:34:08 2010 +0000
@@ -1,3 +1,12 @@
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+	Remove support for DJGPP v1.x.
+
+	* sed3.inp:
+	* sed2.inp:
+	* sed1.inp:
+	* mainmake: Files removed.
+
 2010-03-27  Eli Zaretskii  <eliz@gnu.org>
 
 	* sedlisp.inp (VPATH): Don't edit, no longer needed.
--- a/msdos/mainmake	Thu Apr 01 14:34:20 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-# Copyright (C) 1993, 1994, 1995, 1996, 2001, 2002, 2003, 2004,
-#   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-# make all	to compile and build Emacs.
-# make install	to install it.
-# make TAGS	to update tags tables.
-#
-# make clean  or  make mostlyclean
-#      Delete all files from the current directory that are normally
-#      created by building the program.	 Don't delete the files that
-#      record the configuration.  Also preserve files that could be made
-#      by building, but normally aren't because the distribution comes
-#      with them.
-#
-#      Delete `.dvi' files here if they are not part of the distribution.
-#
-# make distclean
-#      Delete all files from the current directory that are created by
-#      configuring or building the program.  If you have unpacked the
-#      source and built the program without creating any other files,
-#      `make distclean' should leave only the files that were in the
-#      distribution.
-#
-# make realclean
-#      Delete everything from the current directory that can be
-#      reconstructed with this Makefile.  This typically includes
-#      everything deleted by distclean, plus more: C source files
-#      produced by Bison, tags tables, info files, and so on.
-#
-# make extraclean
-#      Still more severe - delete backup and autosave files, too.
-
-all:	lib-src src
-
-lib-src: FRC
-	cd lib-src
-	$(MAKE)
-	cd ..
-
-src: FRC
-	cd src
-	$(MAKE)
-	cd ..
-
-install: all
-	-md bin
-	cd lib-src
-	coff2exe hexl
-	coff2exe etags
-	coff2exe ctags
-	coff2exe b2m
-	mv -f hexl.exe etags.exe ctags.exe b2m.exe ../bin/
-	cd ..
-	cd src
-	coff2exe emacs
-	stubedit emacs.exe minstack=512k
-	mv -f emacs.exe ../bin/
-	cd ..
-
-FRC:
-
-TAGS tags:	lib-src
-	cd src
-	go32 ../lib-src/etags *.[ch] ../lisp/*.el ../lisp/term/*.el
-	cd ..
-
-check:
-	@echo "We don't have any tests for GNU Emacs yet."
-
-clean:
-	cd lib-src
-	$(MAKE) clean
-	cd ..
-	cd src
-	$(MAKE) clean
-	cd ..
-	cd oldxmenu
-	-$(MAKE) clean
-	cd ..
-
-# arch-tag: d5a489bc-818e-4c3c-8040-b5205ed0602f
--- a/msdos/sed1.inp	Thu Apr 01 14:34:20 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-# -sed1.inp-------------------------------------------------------------
-# Configuration script for src/makefile
-# ----------------------------------------------------------------------
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003,
-#   2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
-#
-# This file is part of GNU Emacs.
-#
-# This file is free software; as a special exception, the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# ----------------------------------------------------------------------
-# In case src/Makefile needs to rebuild `make-doc.exe' (might happen under
-# Windows 95), make sure it gets built with commands that DOS
-# understands (one command per line).
-s/^#.*//
-s/^[ \f\t][ \f\t]*$//
-s/^ /	/
-s/\.h\.in/.h-in/
-s!^	\./temacs!	go32 temacs!
-s!/bin/sh!command.com!
-/^MAKE *=/s/^/# /
-/^SHELL *=/s/^/# /
-/^srcdir *=/s/@[^@\n]*@/./
-/^VPATH *=/s/@[^@\n]*@/./
-/^CC *=/s/@[^@\n]*@/gcc/
-/^CPP *=/s/@[^@\n]*@/gcc -e/
-/^CFLAGS *=/s/@[^@\n]*@/-O2 -g/
-/^LIBS *=/s/@[^@\n]*@//
-/^LIBOBJS *=/s/@[^@\n]*@//
-/^LN_S *=/s/@[^@\n]*@/ln -s/
-/^M_FILE *=/s!@[^@\n]*@!m/intel386.h!
-/^S_FILE *=/s!@[^@\n]*@!s/msdos.h!
-/^@SET_MAKE@$/s/@SET_MAKE@//
-/^.\${libsrc}make-docfile.*>/s!make-docfile!make-doc.exe -o ../etc/DOC!
-/^.\${libsrc}make-doc/s!>.*$!!
-/^\${libsrc}make-docfile:/c\
-${libsrc}make-doc.exe:\
-	cd ..\
-	cd lib-src\
-	$(MAKE) ${MFLAGS} make-docfile -W make-docfile.c\
-	cd ..\
-	cd src
-/^	cd \${libsrc}; \${MAKE} \${MFLAGS} make-docfile/d
-/\${libsrc}make-docfile/s/-docfile[ 	]/-doc.exe /
-/^[ 	]*$/d
-/^temacs:/s/prefix-args//
-/^temacs:/s/stamp-oldxmenu//
-/^	#/d
-
-# arch-tag: 246725c1-79de-4d03-a080-8f19329fa35e
--- a/msdos/sed2.inp	Thu Apr 01 14:34:20 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-# -sed2.inp-------------------------------------------------------------
-# Configuration script for src/config.h
-# ----------------------------------------------------------------------
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
-#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
-#
-# This file is part of GNU Emacs.
-#
-# This file is free software; as a special exception, the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# ----------------------------------------------------------------------
-/^#undef LISP_FLOAT_TYPE *$/s/undef/define/
-/^#undef GNU_MALLOC *$/s/undef/define/
-/^#undef REL_ALLOC *$/s/undef/define/
-/^#undef HAVE_SYS_SELECT/i\
-/^#undef STDC_HEADERS *$/s/undef/define/
-/^#undef HAVE_SYS_TIMEB_H *$/s/undef/define/
-/^#undef HAVE_SYS_TIME_H *$/s/undef/define/
-# /^#undef HAVE_UNISTD_H *$/s/undef/define/
-/^#undef HAVE_GETTIMEOFDAY *$/s/undef/define/
-/^#undef HAVE_GETHOSTNAME *$/s/undef/define/
-/^#undef HAVE_DUP2 *$/s/undef/define/
-/^#undef HAVE_TM_ZONE *$/s/undef/define/
-/^#undef LOCALTIME_CACHE *$/s/undef/define/
-/^#undef HAVE_TZSET *$/s/undef/define/
-/^#undef TM_IN_SYS_TIME *$/s/undef/define/
-/^#undef TIME_WITH_SYS_TIME *$/s/undef/define/
-/^#undef HAVE_RENAME *$/s/undef/define/
-/^#undef HAVE_CLOSEDIR *$/s/undef/define/
-/^#undef HAVE_RANDOM *$/s/undef/define/
-/^#undef HAVE_MKDIR *$/s/undef/define/
-/^#undef HAVE_RMDIR *$/s/undef/define/
-/^#undef HAVE_BCMP *$/s/undef/define/
-/^#undef HAVE_BCOPY *$/s/undef/define/
-/^#undef HAVE_FREXP *$/s/undef/define/
-/^#undef HAVE_FTIME *$/s/undef/define/
-/^#undef HAVE_MKTIME *$/s/undef/define/
-/^#undef HAVE_STRERROR *$/s/undef/define/
-/^#undef HAVE_TIMEVAL *$/s/undef/define/
-s/^#define USER_FULL_NAME .*$/#define USER_FULL_NAME (getenv ("NAME"))/
-s/^#undef STACK_DIRECTION *$/#define STACK_DIRECTION -1/
-s/^#undef EMACS_CONFIGURATION *$/#define EMACS_CONFIGURATION "i386-pc-msdosdjgpp"/
-s/^#undef EMACS_CONFIG_OPTIONS *$/#define EMACS_CONFIG_OPTIONS "-"/
-s!^#undef config_opsysfile *$!#define config_opsysfile "s/msdos.h"!
-s!^#undef config_machfile *$!#define config_machfile "m/intel386.h"!
-s/^#undef PROTOTYPES *$/#define PROTOTYPES 1/
-s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/
-
-# arch-tag: 31840234-109a-41ab-a675-7a3844978299
--- a/msdos/sed3.inp	Thu Apr 01 14:34:20 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-# -sed3.inp-------------------------------------------------------------
-# Configuration script for lib-src/makefile
-# ----------------------------------------------------------------------
-#
-# Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004,
-#   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
-#
-# This file is part of GNU Emacs.
-#
-# This file is free software; as a special exception, the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# ----------------------------------------------------------------------
-/^# DIST: /d
-/^SHELL *=/s/^/# /
-/^CC *=/s/=.*$/=gcc/
-# Actually, here we should patch in the exact version number, but only
-# [ce]tags uses it.  Don't pass it.  This is more update-resistant.
-/-DVERSION=/s/-DVERSION="\\"\${version}\\""//
-/^configname *=/s/=.*$/=msdos/
-/^archlibdir *=/s!=.*$!=/emacs/bin!
-/^bindir *=/s!=.*$!=/emacs/bin!
-/^libdir *=/s!=.*$!=/emacs/bin!
-/^srcdir *=/s!=.*$!=.!
-/^VPATH *=/s!=.*$!=.!
-/^KRB4LIB *=/s/@[^@\n]*@//g
-/^DESLIB *=/s/@[^@\n]*@//g
-/^KRB5LIB *=/s/@[^@\n]*@//g
-/^CRYPTOLIB *=/s/@[^@\n]*@//g
-/^COM_ERRLIB *=/s/@[^@\n]*@//g
-/^LIBHESIOD *=/s/@[^@\n]*@//g
-/^LIBRESOLV *=/s/@[^@\n]*@//g
-/^LIBS_MAIL *=/s/@[^@\n]*@//g
-/^CFLAGS *=/s!=.*$!=-O2 -g!
-/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS!
-/^LOADLIBES *=/s!=.*$!=!
-/^ALLOCA *=/s!=.*$!=alloca.o!
-/^INSTALLABLES/s/emacsclient *//
-s!^	\./!	go32 ./!
-/^UTILITIES=/s/ wakeup//
-/^UTILITIES=/s/ movemail//
-/^UTILITIES=/s/ emacsserver//
-/^UTILITIES=/s/ timer//
-/^all *:/s/$/ make-docfile/
-s!^	go32 ./test-distrib!	go32 ./test-dis!
-/-o make-docfile/a\
-	coff2exe make-docfile
-
-# arch-tag: cac6f5c7-3dbf-4e84-9d0c-44f0126f0ea8
--- a/src/ChangeLog	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/ChangeLog	Fri Apr 02 14:34:08 2010 +0000
@@ -1,3 +1,54 @@
+2010-04-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	Remove extern errno declarations.
+	* xterm.c:
+	* xrdb.c:
+	* w32term.c:
+	* unexec.c:
+	* unexaix.c:
+	* sysdep.c:
+	* process.c:
+	* lread.c:
+	* keyboard.c:
+	* floatfns.c:
+	* filelock.c:
+	* fileio.c:
+	* emacs.c (main):
+	* ecrt0.c:
+	* dispnew.c:
+	* callproc.c:
+	* buffer.c: Remove errno extern declarations.
+	* s/netbsd.h (NEED_ERRNO): Remove.
+
+2010-04-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	Remove all uses of LIBX11_SYSTEM.
+	* Makefile.in (LIBX11_SYSTEM): Remove.
+	* s/msdos.h (LIBX11_SYSTEM): Do not define, define LIBS_SYSTEM
+	instead.
+
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+	Remove support for DJGPP v1.x (bug#5813).
+
+	* w16select.c (__dpmi_int): Remove DJGPP v1.x compatibility.
+	* s/msdos.h:
+	* unexec.c (make_hdr, copy_text_and_data):
+	* sysdep.c (wait_for_termination, sys_subshell):
+	* msdos.c (dos_set_window_size, msdos_set_cursor_shape)
+	(IT_set_terminal_modes, __write, _rename, gethostname)
+	(gettimeofday, alarm, fork, kill, dos_ttraw, dos_ttcooked)
+	(run_msdos_command, abort): Remove DJGPP v1.x code and tests of
+	the value of __DJGPP__.
+	(nice, pause, sigsetmask, sigblock): Remove DJGPP v1.x
+	compatibility code.
+	* lread.c:
+	* gmalloc.c (memalign):
+	* fileio.c (Fcopy_file, check_executable, Ffile_modes):
+	* emacs.c (main):
+	* dosfns.c (init_dosfns):
+	* dired.c (file_name_completion_stat): Remove tests of __DJGPP__.
+
 2010-04-01  Eli Zaretskii  <eliz@gnu.org>
 
 	* xdisp.c (set_cursor_from_row): Fix cursor positioning when the
--- a/src/Makefile.in	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/Makefile.in	Fri Apr 02 14:34:08 2010 +0000
@@ -284,10 +284,6 @@
 #endif
 	$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
 
-#ifndef LIBX11_SYSTEM
-#define LIBX11_SYSTEM
-#endif
-
 #ifndef LIB_X11_LIB
 #define LIB_X11_LIB -lX11
 #endif
@@ -376,7 +372,7 @@
 /* LD_SWITCH_X_DEFAULT comes after everything else that specifies
    options for where to find X libraries, but before those libraries.  */
 X11_LDFLAGS = LD_SWITCH_X_SITE LD_SWITCH_X_DEFAULT
-LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) $(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) LIB_X11_LIB LIBX11_SYSTEM $(XFT_LIBS)
+LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) $(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) LIB_X11_LIB $(XFT_LIBS)
 #else /* not HAVE_X11 */
 LIBX= $(LIBXMENU) LD_SWITCH_X_SITE
 #endif /* not HAVE_X11 */
--- a/src/buffer.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/buffer.c	Fri Apr 02 14:34:08 2010 +0000
@@ -28,11 +28,6 @@
 #include <stdio.h>
 #include <setjmp.h>
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -4627,7 +4622,6 @@
 #endif
 
 #include <stdio.h>
-#include <errno.h>
 
 #if MAP_ANON == 0
 #include <fcntl.h>
--- a/src/callproc.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/callproc.c	Fri Apr 02 14:34:08 2010 +0000
@@ -25,10 +25,6 @@
 #include <stdio.h>
 #include <setjmp.h>
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* Define SIGCHLD as an alias for SIGCLD.  */
 
 #if !defined (SIGCHLD) && defined (SIGCLD)
@@ -61,7 +57,6 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/param.h>
-#include <errno.h>
 #endif /* MSDOS */
 
 #ifndef O_RDONLY
--- a/src/dired.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/dired.c	Fri Apr 02 14:34:08 2010 +0000
@@ -859,7 +859,6 @@
   char *fullname = (char *) alloca (len + pos + 2);
 
 #ifdef MSDOS
-#if __DJGPP__ > 1
   /* Some fields of struct stat are *very* expensive to compute on MS-DOS,
      but aren't required here.  Avoid computing the following fields:
      st_inode, st_size and st_nlink for directories, and the execute bits
@@ -868,7 +867,6 @@
   unsigned short save_djstat_flags = _djstat_flags;
 
   _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
-#endif /* __DJGPP__ > 1 */
 #endif /* MSDOS */
 
   bcopy (SDATA (dirname), fullname, pos);
@@ -888,9 +886,7 @@
 #else
   value = stat (fullname, st_addr);
 #ifdef MSDOS
-#if __DJGPP__ > 1
   _djstat_flags = save_djstat_flags;
-#endif /* __DJGPP__ > 1 */
 #endif /* MSDOS */
   return value;
 #endif /* S_IFLNK */
--- a/src/dispnew.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/dispnew.c	Fri Apr 02 14:34:08 2010 +0000
@@ -5809,9 +5809,6 @@
      int signalnum;		/* some compilers complain in signal calls.  */
 {
   int width, height;
-#ifndef USE_CRT_DLL
-  extern int errno;
-#endif
   int old_errno = errno;
 
   struct tty_display_info *tty;
--- a/src/dosfns.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/dosfns.c	Fri Apr 02 14:34:08 2010 +0000
@@ -48,10 +48,6 @@
 #include <grp.h>
 #include <crt0.h>
 
-#ifndef __DJGPP_MINOR__
-# define __tb _go32_info_block.linear_address_of_transfer_buffer;
-#endif
-
 DEFUN ("int86", Fint86, Sint86, 2, 2, 0,
        doc: /* Call specific MS-DOS interrupt number INTERRUPT with REGISTERS.
 Return the updated REGISTER vector.
@@ -385,8 +381,6 @@
     }
 #endif /* !HAVE_X_WINDOWS */
 
-#if __DJGPP__ >= 2
-
   /* Without this, we never see hidden files.
      Don't OR it with the previous value, so the value recorded at dump
      time, possibly with `preserve-case' flags set, won't get through.  */
@@ -398,7 +392,6 @@
   if (!NILP (Fmsdos_long_file_names ()))
     __opendir_flags |= __OPENDIR_PRESERVE_CASE;
 #endif /* __DJGPP_MINOR__ == 0 */
-#endif /* __DJGPP__ >= 2 */
 }
 
 #ifndef HAVE_X_WINDOWS
--- a/src/ecrt0.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/ecrt0.c	Fri Apr 02 14:34:08 2010 +0000
@@ -59,10 +59,6 @@
 
 int data_start = 0;
 
-#ifdef NEED_ERRNO
-int errno;
-#endif
-
 #ifndef MSDOS
 char **environ;
 #endif
--- a/src/emacs.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/emacs.c	Fri Apr 02 14:34:08 2010 +0000
@@ -756,9 +756,6 @@
   char stack_bottom_variable;
   int do_initial_setlocale;
   int skip_args = 0;
-#ifndef USE_CRT_DLL
-  extern int errno;
-#endif
 #ifdef HAVE_SETRLIMIT
   struct rlimit rlim;
 #endif
@@ -945,7 +942,6 @@
 #endif /* MSDOS || WINDOWSNT */
 
 #ifdef MSDOS
-#if __DJGPP__ >= 2
   if (!isatty (fileno (stdin)))
     setmode (fileno (stdin), O_BINARY);
   if (!isatty (fileno (stdout)))
@@ -953,11 +949,6 @@
       fflush (stdout);
       setmode (fileno (stdout), O_BINARY);
     }
-#else  /* not __DJGPP__ >= 2 */
-  (stdin)->_flag &= ~_IOTEXT;
-  (stdout)->_flag &= ~_IOTEXT;
-  (stderr)->_flag &= ~_IOTEXT;
-#endif /* not __DJGPP__ >= 2 */
 #endif /* MSDOS */
 
 #ifdef SET_EMACS_PRIORITY
--- a/src/fileio.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/fileio.c	Fri Apr 02 14:34:08 2010 +0000
@@ -53,12 +53,6 @@
 #include <ctype.h>
 #include <errno.h>
 
-#ifndef vax11c
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-#endif
-
 #include "lisp.h"
 #include "intervals.h"
 #include "buffer.h"
@@ -79,11 +73,9 @@
 #ifdef MSDOS
 #include "msdos.h"
 #include <sys/param.h>
-#if __DJGPP__ >= 2
 #include <fcntl.h>
 #include <string.h>
 #endif
-#endif
 
 #ifdef DOS_NT
 #define CORRECT_DIR_SEPS(s) \
@@ -2012,7 +2004,6 @@
      copyable by us. */
   input_file_statable_p = (fstat (ifd, &st) >= 0);
 
-#if !defined (MSDOS) || __DJGPP__ > 1
   if (out_st.st_mode != 0
       && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino)
     {
@@ -2020,7 +2011,6 @@
       report_file_error ("Input and output files are the same",
 			 Fcons (file, Fcons (newname, Qnil)));
     }
-#endif
 
 #if defined (S_ISREG) && defined (S_ISLNK)
   if (input_file_statable_p)
@@ -2091,7 +2081,7 @@
 
   emacs_close (ifd);
 
-#if defined (__DJGPP__) && __DJGPP__ > 1
+#ifdef MSDOS
   if (input_file_statable_p)
     {
       /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
@@ -2101,7 +2091,7 @@
       if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
 	chmod (SDATA (encoded_newname), st.st_mode & 07777);
     }
-#endif /* DJGPP version 2 or newer */
+#endif /* MSDOS */
 #endif /* not WINDOWSNT */
 
   /* Discard the unwind protects.  */
@@ -2477,16 +2467,7 @@
   struct stat st;
   if (stat (filename, &st) < 0)
     return 0;
-#if defined (WINDOWSNT) || (defined (MSDOS) && __DJGPP__ > 1)
   return ((st.st_mode & S_IEXEC) != 0);
-#else
-  return (S_ISREG (st.st_mode)
-	  && len >= 5
-	  && (xstrcasecmp ((suffix = filename + len-4), ".com") == 0
-	      || xstrcasecmp (suffix, ".exe") == 0
-	      || xstrcasecmp (suffix, ".bat") == 0)
-	  || (st.st_mode & S_IFMT) == S_IFDIR);
-#endif /* not WINDOWSNT */
 #else /* not DOS_NT */
 #ifdef HAVE_EUIDACCESS
   return (euidaccess (filename, 1) >= 0);
@@ -2885,10 +2866,6 @@
 
   if (stat (SDATA (absname), &st) < 0)
     return Qnil;
-#if defined (MSDOS) && __DJGPP__ < 2
-  if (check_executable (SDATA (absname)))
-    st.st_mode |= S_IEXEC;
-#endif /* MSDOS && __DJGPP__ < 2 */
 
   return make_number (st.st_mode & 07777);
 }
--- a/src/filelock.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/filelock.c	Fri Apr 02 14:34:08 2010 +0000
@@ -47,9 +47,6 @@
 #endif /* __FreeBSD__ */
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #include "lisp.h"
 #include "buffer.h"
--- a/src/floatfns.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/floatfns.c	Fri Apr 02 14:34:08 2010 +0000
@@ -99,10 +99,6 @@
 
 #ifdef FLOAT_CHECK_ERRNO
 # include <errno.h>
-
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
 #endif
 
 #ifdef FLOAT_CATCH_SIGILL
--- a/src/gmalloc.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/gmalloc.c	Fri Apr 02 14:34:08 2010 +0000
@@ -122,7 +122,7 @@
 extern void free PP ((__ptr_t __ptr));
 
 /* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
-#if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict.  */
+#if !defined (_MALLOC_INTERNAL) || defined (MSDOS) /* Avoid conflict.  */
 extern __ptr_t memalign PP ((__malloc_size_t __alignment,
 			     __malloc_size_t __size));
 extern int posix_memalign PP ((__ptr_t *, __malloc_size_t,
@@ -1763,13 +1763,6 @@
 #include <malloc.h>
 #endif
 
-#if __DJGPP__ - 0 == 1
-
-/* There is some problem with memalign in DJGPP v1 and we are supposed
-   to omit it.  Noone told me why, they just told me to do it.  */
-
-#else
-
 __ptr_t (*__memalign_hook) PP ((__malloc_size_t __size,
 				__malloc_size_t __alignment));
 
@@ -1878,7 +1871,6 @@
   return 0;
 }
 
-#endif /* Not DJGPP v1 */
 /* Allocate memory on a page boundary.
    Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
 
--- a/src/keyboard.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/keyboard.c	Fri Apr 02 14:34:08 2010 +0000
@@ -79,10 +79,6 @@
 #include "nsterm.h"
 #endif
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* Variables for blockinput.h: */
 
 /* Non-zero if interrupt input is blocked right now.  */
--- a/src/lread.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/lread.c	Fri Apr 02 14:34:08 2010 +0000
@@ -41,9 +41,6 @@
 #include "blockinput.h"
 
 #ifdef MSDOS
-#if __DJGPP__ < 2
-#include <unistd.h>	/* to get X_OK */
-#endif
 #include "msdos.h"
 #endif
 
@@ -76,10 +73,6 @@
 #define file_tell ftell
 #endif
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* hash table read constants */
 Lisp_Object Qhash_table, Qdata;
 Lisp_Object Qtest, Qsize;
--- a/src/msdos.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/msdos.c	Fri Apr 02 14:34:08 2010 +0000
@@ -39,7 +39,6 @@
 #include <sys/stat.h>    /* for _fixpath */
 #include <unistd.h>	 /* for chdir, dup, dup2, etc. */
 #include <dir.h>	 /* for getdisk */
-#if __DJGPP__ >= 2
 #pragma pack(0)		 /* dir.h does a pack(4), which isn't GCC's default */
 #include <fcntl.h>
 #include <io.h>		 /* for setmode */
@@ -47,7 +46,6 @@
 #include <sys/farptr.h>	 /* for _farsetsel, _farnspokeb */
 #include <libc/dosio.h>  /* for _USE_LFN */
 #include <conio.h>	 /* for cputs */
-#endif
 
 #include "msdos.h"
 #include "systime.h"
@@ -81,8 +79,6 @@
 #define _dos_ds _go32_info_block.selector_for_linear_memory
 #endif
 
-#if __DJGPP__ > 1
-
 #include <signal.h>
 #include "syssignal.h"
 
@@ -104,7 +100,6 @@
 #endif /* GNU_MALLOC */
 
 #endif /* not SYSTEM_MALLOC */
-#endif /* __DJGPP__ > 1 */
 
 static unsigned long
 event_timestamp ()
@@ -427,7 +422,6 @@
    colors for newly-created frames.  */
 static int initial_screen_colors[2];
 
-#if __DJGPP__ > 1
 /* Update the screen from a part of relocated DOS/V screen buffer which
    begins at OFFSET and includes COUNT characters.  */
 static void
@@ -444,7 +438,6 @@
   regs.x.cx = count;
   __dpmi_int (0x10, &regs);
 }
-#endif
 
 static void
 dos_direct_output (y, x, buf, len)
@@ -456,67 +449,12 @@
   int t = t0 + (int) ScreenPrimary;
   int l0 = len;
 
-#if (__DJGPP__ < 2)
-  while (--len >= 0) {
-    dosmemput (buf++, 1, t);
-    t += 2;
-  }
-#else
   /* This is faster.  */
   for (_farsetsel (_dos_ds); --len >= 0; t += 2, buf++)
     _farnspokeb (t, *buf);
 
   if (screen_virtual_segment)
     dosv_refresh_virtual_screen (t0, l0);
-#endif
-}
-#endif
-
-/* Flash the screen as a substitute for BEEPs.  */
-
-#if (__DJGPP__ < 2)
-static void
-do_visible_bell (xorattr)
-     unsigned char xorattr;
-{
-  asm volatile
-    ("  movb   $1,%%dl				\n\
-visible_bell_0:					\n\
-	movl   _ScreenPrimary,%%eax		\n\
-	call   dosmemsetup			\n\
-	movl   %%eax,%%ebx			\n\
-	movl   %1,%%ecx				\n\
-	movb   %0,%%al				\n\
-	incl   %%ebx				\n\
-visible_bell_1:					\n\
-	xorb   %%al,%%gs:(%%ebx)		\n\
-	addl   $2,%%ebx				\n\
-	decl   %%ecx				\n\
-	jne    visible_bell_1			\n\
-	decb   %%dl				\n\
-	jne    visible_bell_3			\n\
-visible_bell_2:					\n\
-	movzwl %%ax,%%eax			\n\
-        movzwl %%ax,%%eax			\n\
-	movzwl %%ax,%%eax			\n\
-	movzwl %%ax,%%eax			\n\
-	decw   %%cx				\n\
-	jne    visible_bell_2			\n\
-	jmp    visible_bell_0                   \n\
-visible_bell_3:"
-     : /* no output */
-     : "m" (xorattr), "g" (screen_size)
-     : "%eax", "%ebx", /* "%gs",*/ "%ecx", "%edx");
-}
-
-static void
-ScreenVisualBell (void)
-{
-  /* This creates an xor-mask that will swap the default fore- and
-     background colors.  */
-  do_visible_bell (((FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ())
-		     ^ FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()))
-		    * 0x11) & 0x7f);
 }
 #endif
 
@@ -611,9 +549,6 @@
 
   /* Find one of the dimensions supported by standard EGA/VGA
      which gives us at least the required dimensions.  */
-
-#if __DJGPP__ > 1
-
   else
     {
       static struct {
@@ -642,41 +577,6 @@
 	}
     }
 
-#else /* not __DJGPP__ > 1 */
-
-  else if (*rows <= 25)
-    {
-      if (current_rows != 25 || current_cols != 80)
-	{
-	  regs.x.ax = 3;
-	  int86 (0x10, &regs, &regs);
-	  regs.x.ax = 0x1101;
-	  regs.h.bl = 0;
-	  int86 (0x10, &regs, &regs);
-	  regs.x.ax = 0x1200;
-	  regs.h.bl = 32;
-	  int86 (0x10, &regs, &regs);
-	  regs.x.ax = 3;
-	  int86 (0x10, &regs, &regs);
-	}
-    }
-  else if (*rows <= 50)
-    if (have_vga && (current_rows != 50 || current_cols != 80)
-	|| *rows <= 43 && (current_rows != 43 || current_cols != 80))
-      {
-	regs.x.ax = 3;
-	int86 (0x10, &regs, &regs);
-	regs.x.ax = 0x1112;
-	regs.h.bl = 0;
-	int86 (0x10, &regs, &regs);
-	regs.x.ax = 0x1200;
-	regs.h.bl = 32;
-	int86 (0x10, &regs, &regs);
-	regs.x.ax = 0x0100;
-	regs.x.cx = 7;
-	int86 (0x10, &regs, &regs);
-      }
-#endif /* not __DJGPP__ > 1 */
 
   if (have_mouse)
     {
@@ -693,7 +593,6 @@
   screen_size_Y = *rows;
   screen_size = *cols * *rows;
 
-#if __DJGPP__ > 1
   /* If the dimensions changed, the mouse highlight info is invalid.  */
   if (current_rows != *rows || current_cols != *cols)
     {
@@ -708,7 +607,6 @@
 	  dpyinfo->mouse_face_window = Qnil;
 	}
     }
-#endif
 
   /* Enable bright background colors.  */
   bright_bg ();
@@ -747,7 +645,6 @@
 static void
 msdos_set_cursor_shape (struct frame *f, int start_line, int width)
 {
-#if __DJGPP__ > 1
   unsigned desired_cursor;
   __dpmi_regs regs;
   int max_line, top_line, bot_line;
@@ -824,7 +721,6 @@
   regs.h.ah = 1;
   regs.x.cx = desired_cursor;
   __dpmi_int (0x10, &regs);
-#endif /* __DJGPP__ > 1 */
 }
 
 static void
@@ -2041,7 +1937,6 @@
   startup_screen_size_Y = screen_size_Y;
   startup_screen_attrib = ScreenAttrib;
 
-#if __DJGPP__ > 1
   /* Is DOS/V (or any other RSIS software which relocates
      the screen) installed?  */
   {
@@ -2072,7 +1967,6 @@
 	ScreenPrimary = (screen_virtual_segment << 4) + screen_virtual_offset;
       }
   }
-#endif /* __DJGPP__ > 1 */
 
   ScreenGetCursor (&startup_pos_Y, &startup_pos_X);
   ScreenRetrieve (startup_screen_buffer = xmalloc (screen_size * 2));
@@ -4068,195 +3962,6 @@
   return np - startp;
 }
 
-#if defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ == 0
-
-/* In DJGPP v2.0, library `write' can call `malloc', which might
-   cause relocation of the buffer whose address we get in ADDR.
-   Here is a version of `write' that avoids calling `malloc',
-   to serve us until such time as the library is fixed.
-   Actually, what we define here is called `__write', because
-   `write' is a stub that just jmp's to `__write' (to be
-   POSIXLY-correct with respect to the global name-space).  */
-
-#include <io.h>		      /* for _write */
-#include <libc/dosio.h>       /* for __file_handle_modes[] */
-
-static char xbuf[64 * 1024];  /* DOS cannot write more in one chunk */
-
-#define XBUF_END (xbuf + sizeof (xbuf) - 1)
-
-int
-__write (int handle, const void *buffer, size_t count)
-{
-  if (count == 0)
-    return 0;
-
-  if(__file_handle_modes[handle] & O_BINARY)
-    return _write (handle, buffer, count);
-  else
-    {
-      char *xbp = xbuf;
-      const char *bp = buffer;
-      int total_written = 0;
-      int nmoved = 0, ncr = 0;
-
-      while (count)
-	{
-	  /* The next test makes sure there's space for at least 2 more
-	     characters in xbuf[], so both CR and LF can be put there.  */
-	  if (xbp < XBUF_END)
-	    {
-	      if (*bp == '\n')
-		{
-		  ncr++;
-		  *xbp++ = '\r';
-		}
-	      *xbp++ = *bp++;
-	      nmoved++;
-	      count--;
-	    }
-	  if (xbp >= XBUF_END || !count)
-	    {
-	      size_t to_write = nmoved + ncr;
-	      int written = _write (handle, xbuf, to_write);
-
-	      if (written == -1)
-		return -1;
-	      else
-		total_written += nmoved;  /* CRs aren't counted in ret value */
-
-	      /* If some, but not all were written (disk full?), return
-		 an estimate of the total written bytes not counting CRs.  */
-	      if (written < to_write)
-		return total_written - (to_write - written) * nmoved/to_write;
-
-	      nmoved = 0;
-	      ncr = 0;
-	      xbp = xbuf;
-	    }
-	}
-      return total_written;
-    }
-}
-
-/* A low-level file-renaming function which works around Windows 95 bug.
-   This is pulled directly out of DJGPP v2.01 library sources, and only
-   used when you compile with DJGPP v2.0.  */
-
-#include <io.h>
-
-int _rename(const char *old, const char *new)
-{
-  __dpmi_regs r;
-  int olen    = strlen(old) + 1;
-  int i;
-  int use_lfn = _USE_LFN;
-  char tempfile[FILENAME_MAX];
-  const char *orig = old;
-  int lfn_fd = -1;
-
-  r.x.dx = __tb_offset;
-  r.x.di = __tb_offset + olen;
-  r.x.ds = r.x.es = __tb_segment;
-
-  if (use_lfn)
-    {
-      /* Windows 95 bug: for some filenames, when you rename
-	 file -> file~ (as in Emacs, to leave a backup), the
-	 short 8+3 alias doesn't change, which effectively
-	 makes OLD and NEW the same file.  We must rename
-	 through a temporary file to work around this.  */
-
-      char *pbase = 0, *p;
-      static char try_char[] = "abcdefghijklmnopqrstuvwxyz012345789";
-      int idx = sizeof(try_char) - 1;
-
-      /* Generate a temporary name.  Can't use `tmpnam', since $TMPDIR
-	 might point to another drive, which will fail the DOS call.  */
-      strcpy(tempfile, old);
-      for (p = tempfile; *p; p++) /* ensure temporary is on the same drive */
-	if (*p == '/' || *p == '\\' || *p == ':')
-	  pbase = p;
-      if (pbase)
-	pbase++;
-      else
-	pbase = tempfile;
-      strcpy(pbase, "X$$djren$$.$$temp$$");
-
-      do
-	{
-	  if (idx <= 0)
-	    return -1;
-	  *pbase = try_char[--idx];
-	} while (_chmod(tempfile, 0) != -1);
-
-      r.x.ax = 0x7156;
-      _put_path2(tempfile, olen);
-      _put_path(old);
-      __dpmi_int(0x21, &r);
-      if (r.x.flags & 1)
-	{
-	  errno = __doserr_to_errno(r.x.ax);
-	  return -1;
-	}
-
-      /* Now create a file with the original name.  This will
-	 ensure that NEW will always have a 8+3 alias
-	 different from that of OLD.  (Seems to be required
-	 when NameNumericTail in the Registry is set to 0.)  */
-      lfn_fd = _creat(old, 0);
-
-      olen = strlen(tempfile) + 1;
-      old  = tempfile;
-      r.x.di = __tb_offset + olen;
-    }
-
-  for (i=0; i<2; i++)
-    {
-      if(use_lfn)
-	r.x.ax = 0x7156;
-      else
-	r.h.ah = 0x56;
-      _put_path2(new, olen);
-      _put_path(old);
-      __dpmi_int(0x21, &r);
-      if(r.x.flags & 1)
-	{
-	  if (r.x.ax == 5 && i == 0) /* access denied */
-	    remove(new);		 /* and try again */
-	  else
-	    {
-	      errno = __doserr_to_errno(r.x.ax);
-
-	      /* Restore to original name if we renamed it to temporary.  */
-	      if (use_lfn)
-		{
-		  if (lfn_fd != -1)
-		    {
-		      _close (lfn_fd);
-		      remove (orig);
-		    }
-		  _put_path2(orig, olen);
-		  _put_path(tempfile);
-		  r.x.ax = 0x7156;
-		  __dpmi_int(0x21, &r);
-		}
-	      return -1;
-	    }
-	}
-      else
-	break;
-    }
-
-  /* Success.  Delete the file possibly created to work
-     around the Windows 95 bug.  */
-  if (lfn_fd != -1)
-    return (_close (lfn_fd) == 0) ? remove (orig) : -1;
-  return 0;
-}
-
-#endif /* __DJGPP__ == 2 && __DJGPP_MINOR__ == 0 */
-
 DEFUN ("msdos-long-file-names", Fmsdos_long_file_names, Smsdos_long_file_names,
        0, 0, 0,
        doc: /* Return non-nil if long file names are supported on MS-DOS.  */)
@@ -4502,39 +4207,6 @@
 static int break_stat;	 /* BREAK check mode status.	*/
 static int stdin_stat;	 /* stdin IOCTL status.		*/
 
-#if __DJGPP__ < 2
-
-/* These must be global.  */
-static _go32_dpmi_seginfo ctrl_break_vector;
-static _go32_dpmi_registers ctrl_break_regs;
-static int ctrlbreakinstalled = 0;
-
-/* Interrupt level detection of Ctrl-Break.  Don't do anything fancy here!  */
-
-void
-ctrl_break_func (regs)
-     _go32_dpmi_registers *regs;
-{
-  Vquit_flag = Qt;
-}
-
-void
-install_ctrl_break_check ()
-{
-  if (!ctrlbreakinstalled)
-    {
-      /* Don't press Ctrl-Break if you don't have either DPMI or Emacs
-	 was compiler with Djgpp 1.11 maintenance level 5 or later!  */
-      ctrlbreakinstalled = 1;
-      ctrl_break_vector.pm_offset = (int) ctrl_break_func;
-      _go32_dpmi_allocate_real_mode_callback_iret (&ctrl_break_vector,
-						   &ctrl_break_regs);
-      _go32_dpmi_set_real_mode_interrupt_vector (0x1b, &ctrl_break_vector);
-    }
-}
-
-#endif /* __DJGPP__ < 2 */
-
 /* Turn off Dos' Ctrl-C checking and inhibit interpretation of
    control chars by DOS.   Determine the keyboard type.  */
 
@@ -4551,9 +4223,6 @@
 
   break_stat = getcbrk ();
   setcbrk (0);
-#if __DJGPP__ < 2
-  install_ctrl_break_check ();
-#endif
 
   if (first_time)
     {
@@ -4585,42 +4254,18 @@
 	    mouse_button_count = outregs.x.bx;
 
 #ifndef HAVE_X_WINDOWS
-#if __DJGPP__ >= 2
 	  /* Save the cursor shape used outside Emacs.  */
 	  outside_cursor = _farpeekw (_dos_ds, 0x460);
 #endif
-#endif
 	}
 
       first_time = 0;
 
-#if __DJGPP__ >= 2
-
       stdin_stat = setmode (fileno (stdin), O_BINARY);
       return (stdin_stat != -1);
     }
   else
     return (setmode (fileno (stdin), O_BINARY) != -1);
-
-#else /* __DJGPP__ < 2 */
-
-    }
-
-  /* I think it is wrong to overwrite `stdin_stat' every time
-     but the first one this function is called, but I don't
-     want to change the way it used to work in v1.x.--EZ  */
-
-  inregs.x.ax = 0x4400;		/* Get IOCTL status. */
-  inregs.x.bx = 0x00;		/* 0 = stdin. */
-  intdos (&inregs, &outregs);
-  stdin_stat = outregs.h.dl;
-
-  inregs.x.dx = stdin_stat | 0x0020; /* raw mode */
-  inregs.x.ax = 0x4401;		/* Set IOCTL status */
-  intdos (&inregs, &outregs);
-  return !outregs.x.cflag;
-
-#endif /* __DJGPP__ < 2 */
 }
 
 /*  Restore status of standard input and Ctrl-C checking.  */
@@ -4633,8 +4278,6 @@
   setcbrk (break_stat);
   mouse_off ();
 
-#if __DJGPP__ >= 2
-
 #ifndef HAVE_X_WINDOWS
   /* Restore the cursor shape we found on startup.  */
   if (outside_cursor)
@@ -4646,16 +4289,6 @@
 #endif
 
   return (setmode (fileno (stdin), stdin_stat) != -1);
-
-#else  /* not __DJGPP__ >= 2 */
-
-  inregs.x.ax = 0x4401;	/* Set IOCTL status.	*/
-  inregs.x.bx = 0x00;	/* 0 = stdin.		*/
-  inregs.x.dx = stdin_stat;
-  intdos (&inregs, &outregs);
-  return !outregs.x.cflag;
-
-#endif /* not __DJGPP__ >= 2 */
 }
 
 
@@ -4735,8 +4368,6 @@
   dup2 (tempout, 1);
   dup2 (temperr, 2);
 
-#if __DJGPP__ > 1
-
   if (msshell && !argv[3])
     {
       /* MS-DOS native shells are too restrictive.  For starters, they
@@ -4777,10 +4408,7 @@
 	result = 0;	/* emulate Unixy shell behavior with empty cmd line */
     }
   else
-
-#endif /* __DJGPP__ > 1 */
-
-  result = spawnve (P_WAIT, argv[0], argv, envv);
+    result = spawnve (P_WAIT, argv[0], argv, envv);
 
   dup2 (inbak, 0);
   dup2 (outbak, 1);
@@ -4822,88 +4450,13 @@
   exit (1);
 }
 
-#if __DJGPP__ < 2
-
-/* ------------------------- Compatibility functions -------------------
- *	gethostname
- *	gettimeofday
+/*
+ * A few unimplemented functions that we silently ignore.
  */
-
-/* Hostnames for a pc are not really funny,
-   but they are used in change log so we emulate the best we can.  */
-
-gethostname (p, size)
-     char *p;
-     int size;
-{
-  char *q = egetenv ("HOSTNAME");
-
-  if (!q) q = "pc";
-  strcpy (p, q);
-  return 0;
-}
-
-/* When time zones are set from Ms-Dos too many C-libraries are playing
-   tricks with time values.  We solve this by defining our own version
-   of `gettimeofday' bypassing GO32.  Our version needs to be initialized
-   once and after each call to `tzset' with TZ changed.  That is
-   accomplished by aliasing tzset to init_gettimeofday. */
-
-static struct tm time_rec;
-
-int
-gettimeofday (struct timeval *tp, struct timezone *tzp)
-{
-  if (tp)
-    {
-      struct time t;
-      struct tm tm;
-
-      gettime (&t);
-      if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */
-	{
-	  struct date d;
-	  getdate (&d);
-	  time_rec.tm_year = d.da_year - 1900;
-	  time_rec.tm_mon = d.da_mon - 1;
-	  time_rec.tm_mday = d.da_day;
-	}
-
-      time_rec.tm_hour = t.ti_hour;
-      time_rec.tm_min = t.ti_min;
-      time_rec.tm_sec = t.ti_sec;
-
-      tm = time_rec;
-      tm.tm_gmtoff = dos_timezone_offset;
-
-      tp->tv_sec = mktime (&tm);	/* may modify tm */
-      tp->tv_usec = t.ti_hund * (1000000 / 100);
-    }
-  /* Ignore tzp; it's obsolescent.  */
-  return 0;
-}
-
-#endif /* __DJGPP__ < 2 */
-
-/*
- * A list of unimplemented functions that we silently ignore.
- */
-
-#if __DJGPP__ < 2
-unsigned alarm (s) unsigned s; {}
-fork () { return 0; }
-int kill (x, y) int x, y; { return -1; }
-nice (p) int p; {}
-void volatile pause () {}
-sigsetmask (x) int x; { return 0; }
-sigblock (mask) int mask; { return 0; }
-#endif
-
 setpgrp () {return 0; }
 setpriority (x,y,z) int x,y,z; { return 0; }
-
-#if __DJGPP__ > 1
-#if __DJGPP_MINOR__ < 2
+
+#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
 
 #ifdef POSIX_SIGNALS
 
@@ -5011,7 +4564,6 @@
 
 #endif /* not POSIX_SIGNALS */
 #endif /* not __DJGPP_MINOR__ < 2 */
-#endif /* __DJGPP__ > 1 */
 
 #ifndef HAVE_SELECT
 #include "sysselect.h"
@@ -5194,7 +4746,6 @@
   dos_ttcooked ();
   ScreenSetCursor (10, 0);
   cputs ("\r\n\nEmacs aborted!\r\n");
-#if __DJGPP__ > 1
 #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
   if (screen_virtual_segment)
     dosv_refresh_virtual_screen (2 * 10 * screen_size_X, 4 * screen_size_X);
@@ -5204,7 +4755,6 @@
 #else  /* __DJGPP_MINOR__ >= 2 */
   raise (SIGABRT);
 #endif /* __DJGPP_MINOR__ >= 2 */
-#endif
   exit (2);
 }
 #endif
--- a/src/process.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/process.c	Fri Apr 02 14:34:08 2010 +0000
@@ -195,10 +195,6 @@
 extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
 #endif
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 #ifndef HAVE_H_ERRNO
 extern int h_errno;
 #endif
--- a/src/s/msdos.h	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/s/msdos.h	Fri Apr 02 14:34:08 2010 +0000
@@ -30,11 +30,7 @@
 #define MSDOS
 #endif
 
-#ifdef __GO32__
 #ifndef __DJGPP__
-#define __DJGPP__ 1	/* V2 defines __DJGPP__ == 2 */
-#endif
-#else
 You lose; /* Emacs for DOS must be compiled with DJGPP */
 #endif
 
@@ -97,34 +93,11 @@
 #define _setjmp setjmp
 #define _longjmp longjmp
 
-#if __DJGPP__ < 2
-
-/* New chdir () routine.
-   DJGPP v2.0 and later doesn't need it because its chdir() does
-   set the drive itself. */
-#ifdef chdir
-#undef chdir
-#endif
-#define chdir sys_chdir
-
-#define LIBS_SYSTEM -lpc  /* isn't required in DJGPP v2.0, either */
-
-#endif /* __DJGPP__ < 2 */
-
-#if __DJGPP__ > 1
-
 #define DATA_START  (&etext + 1)
 #define TEXT_START  &start
 
 #define _NAIVE_DOS_REGS
 
-#else /* not __DJGPP__ > 1 */
-
-/* This somehow needs to be defined even though we use COFF.  */
-#define TEXT_START -1
-
-#endif /* not __DJGPP__ > 1 */
-
 #define ORDINARY_LINK
 
 /* command.com does not understand `...` so we define this.  */
@@ -133,19 +106,6 @@
 
 #define NULL_DEVICE "nul"
 
-#if __DJGPP__ < 2
-#define O_RDONLY        0x0001
-#define O_WRONLY        0x0002
-#define O_RDWR          0x0004
-#define O_CREAT         0x0100
-#define O_TRUNC         0x0200
-#define O_EXCL          0x0400
-#define O_APPEND        0x0800
-#define O_TEXT          0x4000
-#define O_BINARY        0x8000
-#define NO_MATHERR
-#endif
-
 #define HAVE_INVERSE_HYPERBOLIC
 #define FLOAT_CHECK_DOMAIN
 
@@ -166,12 +126,6 @@
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
 
-/* Call init_gettimeofday when TZ changes.  */
-#if __DJGPP__ < 2
-#define LOCALTIME_CACHE
-#define tzset init_gettimeofday
-#endif
-
 /* bcopy under djgpp is quite safe */
 #define GAP_USE_BCOPY
 #define BCOPY_UPWARD_SAFE 1
@@ -181,9 +135,7 @@
 #define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
 
 /* Do we have POSIX signals?  */
-#if __DJGPP__ > 1
 #define POSIX_SIGNALS
-#endif
 
 /* We have (the code to control) a mouse.  */
 #define HAVE_MOUSE
@@ -197,7 +149,7 @@
    commentary below, in the non-X branch.  The 140KB number was
    measured on GNU/Linux and on MS-WIndows.  */
 #define SYSTEM_PURESIZE_EXTRA (-170000+140000)
-#define LIBX11_SYSTEM -lxext -lsys
+#define LIBS_SYSTEM -lxext -lsys
 #else
 /* We need a little extra space, see ../../lisp/loadup.el.
    As of 20091024, DOS-specific files use up 62KB of pure space.  But
--- a/src/s/netbsd.h	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/s/netbsd.h	Fri Apr 02 14:34:08 2010 +0000
@@ -28,8 +28,6 @@
 
 #define LIBS_TERMCAP -ltermcap
 
-#define NEED_ERRNO
-
 #define START_FILES pre-crt0.o /usr/lib/crt0.o START_FILES_1 /usr/lib/crtbegin.o
 #define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o END_FILES_1
 #undef LIB_GCC
--- a/src/sysdep.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/sysdep.c	Fri Apr 02 14:34:08 2010 +0000
@@ -90,17 +90,9 @@
 #include "msdos.h"
 #include <sys/param.h>
 
-#if __DJGPP__ > 1
 extern int etext;
 extern unsigned start __asm__ ("start");
 #endif
-#endif
-
-#ifndef USE_CRT_DLL
-#ifndef errno
-extern int errno;
-#endif
-#endif
 
 #include <sys/file.h>
 
@@ -462,13 +454,7 @@
 #endif /* not POSIX_SIGNALS */
 #endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
 #else /* not subprocesses */
-#if __DJGPP__ > 1
       break;
-#else /* not __DJGPP__ > 1 */
-      if (kill (pid, 0) < 0)
-	break;
-      wait (0);
-#endif /* not __DJGPP__ > 1*/
 #endif /* not subprocesses */
     }
 }
@@ -672,10 +658,8 @@
 
 #ifdef DOS_NT
   pid = 0;
-#if __DJGPP__ > 1
   save_signal_handlers (saved_handlers);
   synch_process_alive = 1;
-#endif /* __DJGPP__ > 1 */
 #else
   pid = vfork ();
   if (pid == -1)
@@ -747,7 +731,7 @@
     }
 
   /* Do this now if we did not do it before.  */
-#if !defined (MSDOS) || __DJGPP__ == 1
+#ifndef MSDOS
   save_signal_handlers (saved_handlers);
   synch_process_alive = 1;
 #endif
--- a/src/unexaix.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/unexaix.c	Fri Apr 02 14:34:08 2010 +0000
@@ -435,7 +435,6 @@
 {
   int i, nwrite, ret;
   char buf[80];
-  extern int errno;
   char zeros[UnexBlockSz];
 
   for (i = 0; ptr < end;)
--- a/src/unexec.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/unexec.c	Fri Apr 02 14:34:08 2010 +0000
@@ -131,11 +131,9 @@
 #ifdef HAVE_COFF_H
 #include <coff.h>
 #ifdef MSDOS
-#if __DJGPP__ > 1
 #include <fcntl.h>  /* for O_RDONLY, O_RDWR */
 #include <crt0.h>   /* for _crt0_startup_flags and its bits */
 static int save_djgpp_startup_flags;
-#endif /* __DJGPP__ > 1 */
 #define filehdr external_filehdr
 #define scnhdr external_scnhdr
 #define syment external_syment
@@ -310,7 +308,6 @@
   if (a_out >= 0)
     {
 #ifdef MSDOS
-#if __DJGPP__ > 1
       /* Support the coff-go32-exe format with a prepended stub, since
 	 this is what GCC 2.8.0 and later generates by default in DJGPP.  */
       unsigned short mz_header[3];
@@ -328,7 +325,6 @@
 	}
       else
 	lseek (a_out, 0L, 0);
-#endif /* __DJGPP__ > 1 */
 #endif /* MSDOS */
       if (read (a_out, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr))
 	{
@@ -470,9 +466,6 @@
 {
   register int i, nwrite, ret;
   char buf[80];
-#ifndef USE_CRT_DLL
-  extern int errno;
-#endif
   /* This is the normal amount to write at once.
      It is the size of block that NFS uses.  */
   int writesize = 1 << 13;
@@ -532,7 +525,6 @@
   register char *ptr;
 
 #ifdef MSDOS
-#if __DJGPP__ >= 2
   /* Dump the original table of exception handlers, not the one
      where our exception hooks are registered.  */
   __djgpp_exception_toggle ();
@@ -542,7 +534,6 @@
   save_djgpp_startup_flags = _crt0_startup_flags;
   _crt0_startup_flags &= ~(_CRT0_FLAG_NO_LFN | _CRT0_FLAG_NEARPTR);
 #endif
-#endif
 
   lseek (new, (long) text_scnptr, 0);
   ptr = (char *) f_ohdr.text_start;
@@ -555,14 +546,12 @@
   write_segment (new, ptr, end);
 
 #ifdef MSDOS
-#if __DJGPP__ >= 2
   /* Restore our exception hooks.  */
   __djgpp_exception_toggle ();
 
   /* Restore the startup flags.  */
   _crt0_startup_flags = save_djgpp_startup_flags;
 #endif
-#endif
 
 
   return 0;
--- a/src/w16select.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/w16select.c	Fri Apr 02 14:34:08 2010 +0000
@@ -23,7 +23,7 @@
    menus, and the Windows clipboard.  */
 
 /* Written by Dale P. Smith <dpsm@en.com>  */
-/* Adapted to DJGPP v1 by Eli Zaretskii <eliz@is.elta.co.il>  */
+/* Adapted to DJGPP by Eli Zaretskii <eliz@gnu.org>  */
 
 #ifdef MSDOS
 
@@ -94,25 +94,6 @@
 /* The size of allocated storage for storing the clipboard data.  */
 static size_t clipboard_storage_size;
 
-/* Emulation of `__dpmi_int' and friends for DJGPP v1.x  */
-
-#if __DJGPP__ < 2
-
-typedef _go32_dpmi_registers __dpmi_regs;
-#define __tb      _go32_info_block.linear_address_of_transfer_buffer
-#define _dos_ds	  _go32_info_block.selector_for_linear_memory
-
-static int
-__dpmi_int (intno, regs)
-     int intno;
-     __dpmi_regs *regs;
-{
-  regs->x.ss = regs->x.sp = regs->x.flags = 0;
-  return _go32_dpmi_simulate_int (intno, regs);
-}
-
-#endif /* __DJGPP__ < 2 */
-
 /* C functions to access the Windows 3.1x clipboard from DOS apps.
 
    The information was obtained from the Microsoft Knowledge Base,
--- a/src/w32term.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/w32term.c	Fri Apr 02 14:34:08 2010 +0000
@@ -228,10 +228,6 @@
 
 extern Lisp_Object Vcommand_line_args, Vsystem_name;
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* A mask of extra modifier bits to put into every keyboard char.  */
 extern EMACS_INT extra_keyboard_modifiers;
 
--- a/src/xdisp.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/xdisp.c	Fri Apr 02 14:34:08 2010 +0000
@@ -12606,7 +12606,8 @@
 	    }
 	  if (INTEGERP (glyph->object) && glyph->charpos < 0)
 	    --glyph;
-	  /* By default, put the cursor on the rightmost glyph.  */
+	  /* By default, in reversed rows we put the cursor on the
+	     rightmost (first in the reading order) glyph.  */
 	  for (g = end + 1; g < glyph; g++)
 	    x += g->pixel_width;
 	  cursor_x = x;
@@ -12683,7 +12684,16 @@
 		bpos_covered = bpos_max + XINT (chprop);
 		/* If the `cursor' property covers buffer positions up
 		   to and including point, we should display cursor on
-		   this glyph.  */
+		   this glyph.  Note that overlays and text properties
+		   with string values stop bidi reordering, so every
+		   buffer position to the left of the string is always
+		   smaller than any position to the right of the
+		   string.  Therefore, if a `cursor' property on one
+		   of the string's characters has an integer value, we
+		   will break out of the loop below _before_ we get to
+		   the position match above.  IOW, integer values of
+		   the `cursor' property override the "exact match for
+		   point" strategy of positioning the cursor.  */
 		/* Implementation note: bpos_max == pt_old when, e.g.,
 		   we are in an empty line, where bpos_max is set to
 		   MATRIX_ROW_START_CHARPOS, see above.  */
--- a/src/xrdb.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/xrdb.c	Fri Apr 02 14:34:08 2010 +0000
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #endif
 
+#include <errno.h>
 #include <epaths.h>
 
 #include <stdio.h>
@@ -734,8 +735,6 @@
     char *msg, *prog;
     int x1, x2, x3, x4, x5;
 {
-    extern int errno;
-
     if (errno)
       perror (prog);
 
--- a/src/xterm.c	Thu Apr 01 14:34:20 2010 +0000
+++ b/src/xterm.c	Fri Apr 02 14:34:08 2010 +0000
@@ -309,8 +309,6 @@
 
 extern Lisp_Object Qeql;
 
-extern int errno;
-
 /* A mask of extra modifier bits to put into every keyboard char.  */
 
 extern EMACS_INT extra_keyboard_modifiers;