changeset 558:ed498ef2108b

[xemacs-hg @ 2001-05-23 09:59:33 by ben] xemacs.mak: call `ver' to get the exact os version and put it in the installation; suggestion from adrian. behavior-defs.el: Add scroll-in-place, jka-compr, efs, fix up some things. pop.c: Remove BROKEN_CYGWIN. etc\sample.init.el: Rewrite to be much more careful about loading features -- now it decays gracefully even in the complete absence of packages. Also avoid doing obnoxious things when loading efs. configure.in: add some support for eventually turning on file coding by default. Fix numerous places where AC_MSG_WARN had quotes around its arg, which is bad. Replace with []. Same for AC_MSG_ERROR. s\cygwin32.h, s\mingw32.h: remove support for way old beta versions of cygwin. don't put -Wno-sign-compare in the system switches; this isn't a system issue. define BROKEN_SIGIO for cygwin to get C-g support. device-msw.c: signal an error rather than crash with an unavailable network printer (from Mike Alexander). event-msw.c: cleanup headers. fix (hopefully) an error with data corruption when sending to a network connection. fileio.c: Fix evil code that attempts to handle the ~user prefix by (a) always assuming we're referencing ourselves and not even verifying the user -- hence any file with a tilde as its first char is invalid! (b) if there wasn't a slash following the filename, the pointer was set *past* the end of file and we started reading from uninitialized memory. Now we simply treat these as files, always. optionally for 21.4 (doc fix): lread.c: cambia de pas_de_lache_ici -- al minimo usa la palabra certa. frame.c: fix warnings. emacs.c, nt.c, ntproc.c, process-nt.c, realpath.c, unexnt.c: rename MAX_PATH to standard PATH_MAX. process-nt.c, realpath.c: cleanup headers. process-unix.c, sysdep.c, systime.h, syswindows.h: kill BROKEN_CYGWIN and support for way old beta versions of cygwin. sysfile.h: use _MAX_PATH (Windows) preferentially for PATH_MAX if defined. include io.h on Cygwin (we need get_osfhandle()). include sys/fcntl.h always, since we were including it in various header files anyway. unexcw.c: fix up style to conform to standard. remove duplicate definition of PERROR. buffer.c: comment change. database.c, debug.h, device-tty.c, dired-msw.c, glyphs-msw.c: header cleanups (remove places that directly include a system header file, because we have our own layer to do this more cleanly and portably); indentation fixes.
author ben
date Wed, 23 May 2001 09:59:48 +0000
parents f486da5f1a3b
children 5101772788b2
files etc/sample.init.el lib-src/ChangeLog lib-src/pop.c lisp/ChangeLog lisp/behavior-defs.el nt/ChangeLog nt/xemacs.mak src/ChangeLog src/buffer.c src/database.c src/debug.h src/device-tty.c src/dired-msw.c src/emacs.c src/event-msw.c src/fileio.c src/frame.c src/glyphs-msw.c src/lread.c src/nt.c src/ntproc.c src/process-nt.c src/process-unix.c src/realpath.c src/s/cygwin32.h src/s/mingw32.h src/sysdep.c src/sysfile.h src/systime.h src/syswindows.h src/unexcw.c src/unexnt.c
diffstat 32 files changed, 593 insertions(+), 471 deletions(-) [+]
line wrap: on
line diff
--- a/etc/sample.init.el	Tue May 22 06:49:43 2001 +0000
+++ b/etc/sample.init.el	Wed May 23 09:59:48 2001 +0000
@@ -226,6 +226,14 @@
 ;        ;;
 ;        ))
 
+(defun Init-safe-require (feat)
+"Try to REQUIRE the specified feature.  Errors occurring are silenced.
+\(Perhaps in the future there will be a way to get at the error.)
+Returns t if the feature was successfully required."
+  (condition-case nil
+      (progn (require feat) t)
+    (error nil)))
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                          Key Definitions                         ;;
@@ -615,14 +623,11 @@
 
 ;; Make sure we get Windows-like shifted-motion key selection behavior
 ;; on recent XEmacs versions.
-(if (boundp 'shifted-motion-keys-select-region)
-    (setq shifted-motion-keys-select-region t)
-  ;; otherwise, try the pc-select package -- 
-  (condition-case nil
-      (progn
-	(require 'pc-select)
-	(pc-select-mode 1))
-    (error nil)))
+(cond ((boundp 'shifted-motion-keys-select-region)
+       (setq shifted-motion-keys-select-region t))
+      ;; otherwise, try the pc-select package -- 
+      ((Init-safe-require 'pc-select)
+       (pc-select-mode 1)))
 
 ;; The following commented-out code rearranges the keymap in an
 ;; unconventional but extremely useful way for programmers.  Parens
@@ -929,11 +934,8 @@
 ;;; rather than append -- standard behavior under all window systems
 ;;; nowadays.
 
-(pending-delete-mode 1)
-
-;;; enable region selection with shift+arrows (on by default in 21.5
-;;; and up)
-(setq shifted-motion-keys-select-region t)
+(if (fboundp 'pending-delete-mode)
+    (pending-delete-mode 1))
 
 ;;; NOTE: In this context, `windows-nt' actually refers to all MS
 ;;; Windows operating systems!
@@ -972,7 +974,7 @@
   (setq menu-accelerator-enabled 'menu-force)
 
   ;; Make Cygwin `make' work inside a shell buffer.
-  (setenv "MAKE_MODE" "UNIX"))
+  (if (boundp 'setenv) (setenv "MAKE_MODE" "UNIX")))
 
 ;; This shows how to set up the XEmacs side of tags. (To create the
 ;; TAGS table, use the `etags' program found in the XEmacs bin
@@ -1023,16 +1025,20 @@
 ;; has a NetAudio or ESD server, or on the console of a Linux, Sparc,
 ;; HP, or SGI machine.  Otherwise, you just get the standard beep.)
 
-(cond ((or (and (getenv "DISPLAY") 
-		(string-match ":0" (getenv "DISPLAY")))
-	   (and (eq (console-type) 'mswindows)
-		(device-sound-enabled-p)))
-       (load-default-sounds)
-       ;; On Windows, at least, the sound "quiet-beep", which is normally
-       ;; given the symbolic name `quiet' and is used for Quit and such,
-       ;; is just totally disgusting.  So make this name correspond to a
-       ;; more innocuous sound.
-       (load-sound-file "drum-beep" 'quiet 80))
+(cond ((and (fboundp 'load-default-sounds)
+	    (or (and (getenv "DISPLAY") 
+		     (string-match ":0" (getenv "DISPLAY")))
+		(and (eq (console-type) 'mswindows)
+		     (device-sound-enabled-p))))
+       (condition-case nil
+	   (progn
+	     (load-default-sounds)
+	     ;; On Windows, at least, the sound "quiet-beep", which is normally
+	     ;; given the symbolic name `quiet' and is used for Quit and such,
+	     ;; is just totally disgusting.  So make this name correspond to a
+	     ;; more innocuous sound.
+	     (load-sound-file "drum-beep" 'quiet 80))
+	 (error nil)))
       (t
        (setq bell-volume 40)
        (setq sound-alist
@@ -1182,49 +1188,15 @@
 ;;; When this is loaded, the pathname syntax /user@host:/remote/path
 ;;; refers to files accessible through ftp.
 ;;;
-(require 'dired)
-;; compatible ange-ftp/efs initialization derived from code
-;; from John Turner <turner@lanl.gov>
-;;
-;; The environment variable EMAIL_ADDRESS is used as the password
-;; for access to anonymous ftp sites, if it is set.  If not, one is
-;; constructed using the environment variables USER and DOMAINNAME
-;; (e.g. turner@lanl.gov), if set.
+(Init-safe-require 'dired)
 
-(condition-case nil
-    (progn
-      (require 'efs-auto)
-      (if (getenv "USER")
-	  (setq efs-default-user (getenv "USER")))
-      (if (getenv "EMAIL_ADDRESS")
-	  (setq efs-generate-anonymous-password (getenv "EMAIL_ADDRESS"))
-	(if (and (getenv "USER")
-		 (getenv "DOMAINNAME"))
-	    (setq efs-generate-anonymous-password
-		  (concat (getenv "USER")"@"(getenv "DOMAINNAME")))))
-      (setq efs-auto-save 1))
-  (error
-   (require 'ange-ftp)
-   (if (getenv "USER")
-       (setq ange-ftp-default-user (getenv "USER")))
-   (if (getenv "EMAIL_ADDRESS")
-       (setq ange-ftp-generate-anonymous-password (getenv "EMAIL_ADDRESS"))
-     (if (and (getenv "USER")
-	      (getenv "DOMAINNAME"))
-	 (setq ange-ftp-generate-anonymous-password
-	       (concat (getenv "USER")"@"(getenv "DOMAINNAME")))))
-   (setq ange-ftp-auto-save 1)
-   ))
-
+(or (Init-safe-require 'efs-auto) (Init-safe-require 'ange-ftp))
 
 ;;; ********************
 ;;; Load the default-dir.el package which installs fancy handling of
 ;;; the initial contents in the minibuffer when reading file names.
-
-;(condition-case nil
-;    (require 'default-dir)
-;  (error nil))
-
+;; #### but it seems to cause some breakage.
+;(Init-safe-require 'default-dir))
 
 ;;; ********************
 ;;; Put all of your autosave files in one place, instead of scattering
@@ -1235,9 +1207,9 @@
 ;;; is fast fast fast!)
 ;;;
 ;;; Unfortunately, the code that implements this (auto-save.el) is
-;;; broken on Windows in 21.4 and earlier.
+;;; broken on Windows prior to 21.4.
 (unless (and (eq system-type 'windows-nt)
-	     (not (emacs-version>= 21 5)))
+	     (not (emacs-version>= 21 4)))
   (setq auto-save-directory (expand-file-name "~/.autosave/")
 	auto-save-directory-fallback auto-save-directory
 	auto-save-hash-p nil
@@ -1247,9 +1219,6 @@
 	;; for better interactive response.
 	auto-save-interval 2000
 	)
-  ;; We load this afterwards because it checks to make sure the
-  ;; auto-save-directory exists (creating it if not) when it's loaded.
-  (require 'auto-save)
   )
 
 
@@ -1273,7 +1242,7 @@
 ;;; because there are no other commands whose first three words begin with
 ;;; the letters `b', `c', and `a' respectively.
 ;;;
-(load-library "completer")
+(Init-safe-require 'completer)
 
 
 ;;; ********************
@@ -1287,7 +1256,7 @@
 				   ; tell it not to assume that "binary" files
 				   ; are encrypted and require a password.
       )
-(require 'crypt)
+(Init-safe-require 'crypt)
 
 
 ;;; ********************
@@ -1295,9 +1264,11 @@
 ;;; makes filling (e.g. using M-q) much much smarter about paragraphs
 ;;; that are indented and/or are set off with semicolons, dashes, etc.
 
-(require 'filladapt)
+(Init-safe-require 'filladapt)
 (setq-default filladapt-mode t)
-(add-hook 'c-mode-hook 'turn-off-filladapt-mode)
+(when (fboundp 'turn-off-filladapt-mode)
+  (add-hook 'c-mode-hook 'turn-off-filladapt-mode)
+  (add-hook 'outline-mode-hook 'turn-off-filladapt-mode))
 
 
 ;;; ********************
@@ -1324,7 +1295,7 @@
 ;       (setq font-lock-use-default-fonts nil)
 ;       (setq font-lock-use-default-colors nil)
 
-       (require 'font-lock)
+       (Init-safe-require 'font-lock)
 
 ;       ;; Mess around with the faces a bit.  Note that you have
 ;       ;; to change the font-lock-use-default-* variables *before*
@@ -1360,10 +1331,12 @@
 ;;; accurate as using full font-lock or fast-lock, but it's *much*
 ;;; faster.  No more annoying pauses when you load files.
 
-(add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
+(if (fboundp 'turn-on-lazy-lock)
+    (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock))
+
 ;; I personally don't like "stealth mode" (where lazy-lock starts
 ;; fontifying in the background if you're idle for 30 seconds)
-;; because it takes too long to wake up again on my piddly Sparc 1+.
+;; because it takes too long to wake up again.
 (setq lazy-lock-stealth-time nil)
 
 
@@ -1377,8 +1350,7 @@
 ;;; Send bug reports, enhancements etc to:
 ;;; David Hughes <ukchugd@ukpmr.cs.philips.nl>
 ;;;
-(cond (running-xemacs
-       (require 'func-menu)
+(cond ((and running-xemacs (Init-safe-require 'func-menu))
        (global-set-key '(shift f12) 'function-menu)
        (add-hook 'find-file-hooks 'fume-add-menubar-entry)
        (global-set-key "\C-cl" 'fume-list-functions)
@@ -1429,16 +1401,16 @@
 ;;; resize-minibuffer-mode makes the minibuffer automatically
 ;;; resize as necessary when it's too big to hold its contents.
 
-(autoload 'resize-minibuffer-mode "rsz-minibuf" nil t)
-(resize-minibuffer-mode)
-(setq resize-minibuffer-window-exactly nil)
+(when (fboundp 'resize-minibuffer-mode)
+  (resize-minibuffer-mode)
+  (setq resize-minibuffer-window-exactly nil))
 
 
 ;;; ********************
 ;;; scroll-in-place is a package that keeps the cursor on the same line (and in the same column) when scrolling by a page using PgUp/PgDn.
 
-(require 'scroll-in-place)
-(turn-on-scroll-in-place)
+(if (Init-safe-require 'scroll-in-place)
+    (turn-on-scroll-in-place))
 
 
 ;;; ********************
--- a/lib-src/ChangeLog	Tue May 22 06:49:43 2001 +0000
+++ b/lib-src/ChangeLog	Wed May 23 09:59:48 2001 +0000
@@ -1,3 +1,8 @@
+2001-05-23  Ben Wing  <ben@xemacs.org>
+
+	* pop.c (socket_connection):
+	Remove BROKEN_CYGWIN.
+
 2001-05-17  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* config.values.sh:  lisp/utils?/config.el -> lisp/config.el.
--- a/lib-src/pop.c	Tue May 22 06:49:43 2001 +0000
+++ b/lib-src/pop.c	Wed May 23 09:59:48 2001 +0000
@@ -989,9 +989,7 @@
       hostent = gethostbyname (host);
       try_count++;
       if ((! hostent) 
-#ifndef BROKEN_CYGWIN	  
 	  && ((h_errno != TRY_AGAIN) || (try_count == 5))
-#endif
 	  )
 	{
 	  strcpy (pop_error, "Could not determine POP server's address");
--- a/lisp/ChangeLog	Tue May 22 06:49:43 2001 +0000
+++ b/lisp/ChangeLog	Wed May 23 09:59:48 2001 +0000
@@ -1,3 +1,20 @@
+2001-05-23  Ben Wing  <ben@xemacs.org>
+
+	* behavior-defs.el:
+	* behavior-defs.el (scroll-in-place):
+	* behavior-defs.el ('scroll-in-place): New.
+	* behavior-defs.el (mouse-avoidance):
+	* behavior-defs.el (jka-compr):
+	* behavior-defs.el ('jka-compr): New.
+	* behavior-defs.el ('efs): New.
+	* behavior-defs.el (efs):
+	* behavior-defs.el (resize-minibuffer):
+	* behavior-defs.el (func-menu):
+	* behavior-defs.el (mwheel):
+	* behavior-defs.el (recent-files):
+	* behavior-defs.el (filladapt):
+	Add scroll-in-place, jka-compr, efs, fix up some things.
+
 2001-03-19  Karl M. Hegbloom  <karlheg@microsharp.com>
 
 	* cus-edit.el (custom-display): Support the GTK Window System also.
--- a/lisp/behavior-defs.el	Tue May 22 06:49:43 2001 +0000
+++ b/lisp/behavior-defs.el	Wed May 23 09:59:48 2001 +0000
@@ -37,14 +37,220 @@
 
 (require 'behavior)
 
+(define-behavior 'scroll-in-place
+"This package provides improved vertical scrolling commands for XEmacs.
+These new commands offer the following features:
+
++ When a scrolling command is executed, XEmacs tries to keep point as
+  close as possible to its original window position (window line and
+  column).  This is what \"scroll in place\" means: point stays \"in place\"
+  within the window.  (There are times when point must be moved from its
+  original window position in order to execute the scroll; see below.)
+
+  The variable `scroll-in-place', which is true by default, determines
+  whether or not the standard XEmacs scrolling commands (`scroll-down',
+  `scroll-up', `scroll-other-window-down', and `scroll-other-window') use
+  the \"in place\" features listed here.  When `scroll-in-place' is `nil'
+  the standard XEmacs scrolling commands essentially just call the
+  original versions of themselves.  (Note that even when `scroll-in-place'
+  is `nil' the new versions of `scroll-down' and `scroll-up' have slightly
+  different behavior when a minibuffer window is the selected window.  See
+  below.)
+
+  It is possible to turn off (or turn on) \"in place\" scrolling for certain
+  buffers by making buffer-local bindings of the variable `scroll-in-
+  place' for those buffers.  The variable `scroll-in-place' is not usually
+  buffer-local, but you can make it so if you desire.
+
++ Because the improved scrolling commands keep point at its original
+  window position, these scrolling commands are \"reversible.\"  The
+  `scroll-up' command undoes the effect of the immediately previous
+  `scroll-down' command (if any) and vice versa.  In other words, if you
+  scroll up and then immediately scroll back down, the window config-
+  uration is restored to its exact original state.  This allows you to
+  browse through a buffer more easily, as you can always get back to the
+  original configuration.
+
+  Note, however, that the improved scrolling commands are guaranteed to be
+  reversible only if there are no intervening non-scrolling commands.
+  Also, if you give a prefix argument to a scrolling command (in order to
+  specify the number of lines to scroll by), previous scrolling commands
+  may no longer be reversible.  More specifically, if the new prefix
+  argument has a different magnitude than the previous scrolling distance,
+  then any previous scrolling commands are not reversible.  The new prefix
+  argument takes precedence.
+
+  You might find it useful to think of the scrolling commands as forming
+  \"chains.\"  A scrolling command either starts or continues a chain.  By
+  issuing a non-scrolling command or by changing the number of lines to be
+  scrolled, you break the chain.  (Note that simply changing the scrolling
+  direction won't break the chain; changing the absolute number of lines
+  to be scrolled is what breaks the chain.)  Scrolling commands are
+  guaranteed to be reversible only within the current chain.  Hopefully
+  that's clear enough.
+
++ When a scrolling command is given a prefix argument (which specifies the
+  number of lines to scroll by), then that argument becomes the default
+  scrolling distance for all immediately subsequent scrolling commands.
+  This means that you can easily set the scrolling distance for a chain
+  of scrolling commands.  Note that a new prefix argument or any non-
+  scrolling command breaks the chain (as described above), and any further
+  scrolling commands will use the usual defaults (or the prefix argument
+  you specify at that time, of course).
+
+  However, there are cases in which one doesn't want the current scrolling
+  command to use the default scrolling distance that was set by the
+  previous scrolling command.  For example, suppose that you had special
+  commands that scrolled one line up and one line down.  When you invoke
+  one of these commands, the \"in place\" scrolling routines set the default
+  scrolling distance to be just one line.  Now suppose that you use one of
+  your special commands and then immediately invoke `scroll-up' (`C-v'),
+  expecting it to scroll by a near windowful of text.  You would be
+  disappointed --- because the previous command set the default scrolling
+  distance to be just one line, `scroll-up' just scrolls by one line.
+
+  To solve this problem, \"scroll-in-place\" allows you to divide scrolling
+  commands into separate \"groups.\"  Commands in a group can only form
+  chains with (and therefore, inherit defaults from) commands in the same
+  group.  (Note that no command can be in more than one group.)  If you
+  invoke a scrolling command that is not in the same group as that of the
+  immediately previous scrolling command, then the previous chain is
+  broken and you start a new chain --- with a new set of defaults.
+
+  So to solve the problem described above, you could put your one-line
+  scrolling commands in their own group.  Once that is done, the standard
+  scrolling commands will not form chains with your one-line scrolling
+  commands, and therefore will not use the default scrolling distance set
+  by those commands.  Problem solved!
+
+  By default, all \"in place\" scrolling commands are in a single group.  If
+  you want to partition some commands into separate groups, you must do
+  that yourself *before* any \"in place\" commands are invoked.  For more
+  information about grouping commands, see the documentation for the
+  variables `scroll-command-groups' and `scroll-default-command-group'.
+
++ The improved scrolling commands will avoid displaying empty lines past
+  the end of the buffer when possible.  In other words, just as you can't
+  see \"dead space\" before the beginning of the buffer text, the new
+  scrolling commands try to avoid displaying \"dead space\" past the end of
+  the buffer text.  This behavior is somewhat configurable; see the
+  documentation for the variable `scroll-allow-blank-lines-past-eob'.
+
+  Dead space will be displayed if it is necessary in order to make a
+  previous scrolling action reversible, however.
+
++ If the scrolling commands cannot keep point at its initial window
+  position (because a buffer boundary is on screen and the window can't be
+  scrolled as far as necessary to keep point at the right place), point is
+  allowed to temporarily stray from its initial window position.  That is,
+  point moves the correct number of window lines, even if it means that it
+  has to stray from its desired window position.  This straying is undone
+  when (and if) the scrolling action is reversed.
+
++ If a scrolling command tries to move point past a buffer boundary, point
+  is instead moved to the boundary (the beginning or the end of the buffer
+  as appropriate) and an appropriate message is displayed.  This motion is
+  reversible, of course.
+
+  However, if point was already at the buffer boundary when the scrolling
+  command was invoked, the command signals an appropriate error instead.
+
++ When a minibuffer window is the selected window, the new versions of
+  `scroll-up' and `scroll-down' either scroll the window in the variable
+  `minibuffer-scroll-window' (which is usually the window of completions)
+  or the `next-window' if there is no `minibuffer-scroll-window'.  This is
+  usually much more useful than scrolling the minibuffer itself.  (Note
+  that this feature is available even when the variable `scroll-in-place'
+  is `nil'.)
+
++ When a scrolling command is scrolling a window other than the selected
+  window, it will signal an appropriate buffer boundary error if the
+  window cannot be scrolled (because the appropriate buffer boundary is
+  already visible).  This means that an error is signalled even in cases
+  that would be allowed (by \"straying\" point or by moving it to the buffer
+  boundary) if the window were selected.
+
+  (If an error were not signalled in these cases, then there would be many
+  cases in which the last scroll in a particular direction would appear to
+  do nothing because only the point position would change --- the
+  displayed text would stay the same!  To avoid these cases the scrolling
+  commands signal boundary errors \"prematurely\" when the window to be
+  scrolled is not selected.)"
+  :short-doc "Keep cursor on same line when scrolling"
+  :require 'scroll-in-place
+  :enable #'turn-on-scroll-in-place
+  :disable #'turn-off-scroll-in-place)
+
 (define-behavior 'mouse-avoidance
-  "Mouse avoidance mode"
-  :title "Mouse Avoidance"
+"For those who are annoyed by the mouse pointer obscuring text,
+this mode moves the mouse pointer - either just a little out of
+the way, or all the way to the corner of the frame. 
+
+Customize `mouse-avoidance-mode' to one of the symbols `banish',
+`exile', `jump', `animate', `cat-and-mouse', `proteus', or `none'.
+
+Effects of the different modes: 
+ * banish: Move the mouse to the upper-right corner on any keypress.
+ * exile: Move the mouse to the corner only if the cursor gets too close,
+     and allow it to return once the cursor is out of the way.
+ * jump: If the cursor gets too close to the mouse, displace the mouse
+     a random distance & direction.
+ * animate: As `jump', but shows steps along the way for illusion of motion.
+ * cat-and-mouse: Same as `animate'.
+ * proteus: As `animate', but changes the shape of the mouse pointer too.
+
+Whenever the mouse is moved, the frame is also raised.
+
+\(see `mouse-avoidance-threshold' for definition of \"too close\",
+and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for
+definition of \"random distance\".)"
+  :short-doc "Keep mouse away from cursor"
   :enable #'(lambda ()
 	       (mouse-avoidance-mode 'animate))
   :disable #'(lambda ()
 	       (mouse-avoidance-mode 'none)))
 
+(define-behavior 'jka-compr
+  "This package implements low-level support for reading, writing,
+and loading compressed files.  It hooks into the low-level file
+I/O functions (including write-region and insert-file-contents) so
+that they automatically compress or uncompress a file if the file
+appears to need it (based on the extension of the file name).
+Packages like Rmail, VM, GNUS, and Info should be able to work
+with compressed files without modification."
+  :short-doc "Transparently handle compressed files"
+  :enable #'jka-compr-install
+  :disable #'jka-compr-uninstall)
+
+(define-behavior 'efs
+"EFS is a system for transparent file-transfer between remote VMS, CMS,
+MTS, MVS, Twenex, Explorer (the last two are Lisp machines), TOPS-20,
+DOS (running the Distinct, Novell, FTP software, NCSA, Microsoft in both
+unix and DOS mode, Super TCP, and Hellsoft FTP servers), Windows NT
+\(running the Microsoft or Hummingbird ftp servers), Unix descriptive
+listings (dl), KA9Q, OS/2 hosts using FTP. This means that you can edit,
+copy and otherwise manipulate files on any machine you have access to
+from within Emacs as if it were a local file. EFS works by introducing
+an extended filename syntax, and overloading functions such as
+`insert-file-contents' so that accessing a remote file causes
+appropriate commands to be sent to an FTP process.
+
+The syntax to use is like this:
+
+\(for anonymous:)     /ftp.xemacs.org:/pub/xemacs/
+\(for non-anonymous:) /ben@gwyn.tux.org:/etc/mail/xemacs/aliases-xemacs
+
+You can specify either a file or a directory (in the latter case,
+Dired will be brought up).  All operations in XEmacs on such files
+should work exactly as on any other files, modulo the additional
+slowness."
+  :short-doc "Transparent file access over FTP"
+  :require 'efs-auto
+  :enable #'ignore
+  ;; can't :disable
+  )
+
+
 (define-behavior 'resize-minibuffer
   "When this behavior is enabled, the minibuffer is dynamically resized to
 contain the entire region of text put in it as you type.
@@ -63,7 +269,7 @@
 done.  The variables `resize-minibuffer-frame-max-height' and
 `resize-minibuffer-frame-exactly' are analogous to their window
 counterparts."
-  :title "Resize Minibuffer Automatically"
+  :short-doc "Resize minibuffer automatically"
   :enable #'(lambda ()
 	      (resize-minibuffer-mode 1))
   :disable #'(lambda ()
@@ -79,7 +285,7 @@
 name of the desired function via the minibuffer which offers
 completing read input. In addition, the name of the function before
 point is optionally displayed in the modeline."
-  :title "Function Menu"
+  :short-doc "Add a menu of defined functions"
   :require 'func-menu
   :enable #'(lambda ()
 	      (add-hook 'find-file-hooks 'fume-add-menubar-entry)
@@ -111,7 +317,7 @@
 set up to do scrolling in the expected way.  The actual way that the
 scrolling works can be controlled by `mwheel-scroll-amount' and
 `mwheel-follow-mouse'."
-  :title "Mouse Wheel Support"
+  :short-doc "Mouse wheel support for X Windows"
   :enable 'mwheel-install)
 
 (define-behavior 'recent-files
@@ -263,7 +469,7 @@
     file without merging in the new entries from the other Emacs
     process. This can be avoided by disabling the save on exit from
     the menu."
-  :title "Recent Files Menu"
+  :short-doc "`Recent Files' menu"
   :enable 'recent-files-initialize)
 
 (define-behavior 'filladapt
@@ -281,7 +487,7 @@
 from left margin by asterisks, dashes, and/or spaces, numbered
 examples, included text from USENET news articles, etc. are
 generally filled correctly with no fuss."
-  :title "Adaptive Filling"
+  :short-doc "Adaptive (smart) filling"
   :require 'filladapt
   :enable  #'(lambda ()
 	       (setq-default filladapt-mode t)
--- a/nt/ChangeLog	Tue May 22 06:49:43 2001 +0000
+++ b/nt/ChangeLog	Wed May 23 09:59:48 2001 +0000
@@ -1,3 +1,9 @@
+2001-05-23  Ben Wing  <ben@xemacs.org>
+
+	* xemacs.mak (installation):
+	call `ver' to get the exact os version and put it in the
+	installation; suggestion from adrian.
+
 2001-05-21  Martin Buchholz  <martin@xemacs.org>
 
 	* xemacs.mak: Remove references to lwlib-config.
--- a/nt/xemacs.mak	Tue May 22 06:49:43 2001 +0000
+++ b/nt/xemacs.mak	Wed May 23 09:59:48 2001 +0000
@@ -1469,7 +1469,9 @@
 $(XEMACS)\Installation::	installation
 
 installation::
-	@type > $(XEMACS)\Installation <<
+	@echo OS version:>$(XEMACS)\Installation
+	@ver >> $(XEMACS)\Installation
+	@type >> $(XEMACS)\Installation <<
 !if defined(OS)
 OS: $(OS)
 !endif
--- a/src/ChangeLog	Tue May 22 06:49:43 2001 +0000
+++ b/src/ChangeLog	Wed May 23 09:59:48 2001 +0000
@@ -1,3 +1,109 @@
+2001-05-23  Ben Wing  <ben@xemacs.org>
+
+	for 21.5:
+
+	* s\cygwin32.h:
+	* s\cygwin32.h (C_SWITCH_SYSTEM):
+	* s\cygwin32.h (BROKEN_SIGIO):
+	* s\mingw32.h (C_SWITCH_SYSTEM):
+	* s\mingw32.h (TEXT_START):
+	remove support for way old beta versions of cygwin.
+	don't put -Wno-sign-compare in the system switches; this
+	isn't a system issue.  define BROKEN_SIGIO for cygwin to
+	get C-g support.
+
+2001-05-23  Ben Wing  <ben@xemacs.org>
+
+	for 21.4:
+	
+	* device-msw.c (msprinter_init_device):
+	signal an error rather than crash with an unavailable network
+	printer (from Mike Alexander).
+	
+	* event-msw.c:
+	* event-msw.c (struct winsock_stream):
+	* event-msw.c (winsock_writer):
+	* event-msw.c (winsock_closer):
+	* event-msw.c (make_winsock_stream_1):
+	cleanup headers.  fix (hopefully) an error with data corruption
+	when sending to a network connection.
+
+	* fileio.c (Fexpand_file_name): Fix evil code that attempts
+	to handle the ~user prefix by (a) always assuming we're referencing
+	ourselves and not even verifying the user -- hence any file with
+	a tilde as its first char is invalid! (b) if there wasn't a slash
+	following the filename, the pointer was set *past* the end of
+	file and we started reading from uninitialized memory.  Now we
+	simply treat these as files, always.
+
+	optionally for 21.4 (doc fix):
+	
+	* lread.c (pas_de_holgazan_ici):
+	* lread.c (load_force_doc_string_unwind):
+	cambia de pas_de_lache_ici -- al minimo usa la palabra certa.
+	
+	for 21.5:
+	
+	* frame.c (restore_frame_list_to_its_unbesmirched_state):
+	fix warnings.
+	
+	* emacs.c (make_arg_list_1):
+	* nt.c (win32_get_long_filename):
+	* nt.c (init_environment):
+	* nt.c (GetCachedVolumeInformation):
+	* nt.c (get_volume_info):
+	* nt.c (map_win32_filename):
+	* nt.c (sys_rename):
+	* nt.c (generate_inode_val):
+	* ntproc.c (Fwin32_short_file_name):
+	* ntproc.c (Fwin32_long_file_name):
+	* process-nt.c (nt_create_process):
+	* realpath.c (win32_readlink):
+	* unexnt.c:
+	* unexnt.c (_start):
+	* unexnt.c (unexec):
+	* unexnt.c (get_bss_info_from_map_file):
+	rename MAX_PATH to standard PATH_MAX.
+	
+	* process-nt.c:
+	* realpath.c:
+	cleanup headers.
+	
+	* process-unix.c (get_internet_address):
+	* sysdep.c (init_system_name):
+	* systime.h:
+	* syswindows.h:
+	kill BROKEN_CYGWIN and support for way old beta versions of cygwin.
+	
+	* sysfile.h:
+	use _MAX_PATH (Windows) preferentially for PATH_MAX if defined.
+	include io.h on Cygwin (we need get_osfhandle()).  include
+	sys/fcntl.h always, since we were including it in various
+	header files anyway.
+	
+	* unexcw.c:
+	* unexcw.c (DONT_ENCAPSULATE):
+	* unexcw.c (CHECK_AOUT_POS):
+	* unexcw.c (unexec):
+	* unexcw.c (get_section_info):
+	* unexcw.c (copy_executable_and_dump_data_section):
+	* unexcw.c (dup_file_area):
+	* unexcw.c (write_int_to_bss):
+	fix up style to conform to standard.  remove duplicate definition
+	of PERROR.
+
+	* buffer.c (common_init_complex_vars_of_buffer): comment change.
+	
+	* database.c:
+	* debug.h (struct debug_classes):
+	* device-tty.c:
+	* dired-msw.c:
+	* dired-msw.c (mswindows_sortby):
+	* glyphs-msw.c:
+	header cleanups (remove places that directly include a system
+	header file, because we have our own layer to do this more cleanly
+	and portably); indentation fixes.
+
 2001-05-22  Martin Buchholz  <martin@xemacs.org>
 
 	* config.h.in (SYSTEM_TYPE): Allow configure to set this.
--- a/src/buffer.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/buffer.c	Wed May 23 09:59:48 2001 +0000
@@ -2504,7 +2504,9 @@
 
     /* #### Warning: 1<<31 is the largest number currently allowable
        due to the XINT() handling of this value.  With some
-       rearrangement you can get 3 more bits. */
+       rearrangement you can get 3 more bits.
+
+       #### 3 more?  34 bits???? -ben */
   }
 }
 
--- a/src/database.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/database.c	Wed May 23 09:59:48 2001 +0000
@@ -28,7 +28,6 @@
 #include "lisp.h"
 #include "sysfile.h"
 #include "buffer.h"
-#include <errno.h>
 
 #ifndef HAVE_DATABASE
 #error HAVE_DATABASE not defined!!
--- a/src/debug.h	Tue May 22 06:49:43 2001 +0000
+++ b/src/debug.h	Wed May 23 09:59:48 2001 +0000
@@ -30,8 +30,6 @@
 
 #ifdef DEBUG_XEMACS
 
-#include <stdio.h>
-
 struct debug_classes
 {
   unsigned int redisplay :1;
--- a/src/device-tty.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/device-tty.c	Wed May 23 09:59:48 2001 +0000
@@ -36,10 +36,9 @@
 #include "redisplay.h"
 #include "sysdep.h"
 
+#include "sysfile.h"
 #include "syssignal.h" /* for SIGWINCH */
 
-#include <errno.h>
-
 Lisp_Object Qinit_pre_tty_win, Qinit_post_tty_win;
 
 
--- a/src/dired-msw.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/dired-msw.c	Wed May 23 09:59:48 2001 +0000
@@ -73,20 +73,13 @@
 #include "lisp.h"
 
 #include "buffer.h"
+#include "nt.h"
 #include "regex.h"
 
 #include "sysdir.h"
 #include "sysproc.h"
 #include "sysfile.h"
-
-#include <time.h>
-
-#include <winsock.h>		/* To make nt.h happy */
-#include "nt.h"		/* For prototypes */
-
-#if ROUND_FILE_SIZES > 0
-#include <math.h>		/* for floor() */
-#endif
+#include "sysfloat.h"
 
 
 static int mswindows_ls_sort_case_insensitive;
@@ -96,9 +89,8 @@
 
 extern Lisp_Object	Vmswindows_downcase_file_names;	/* in device-msw.c */
 
-
-
-enum mswindows_sortby {
+enum mswindows_sortby
+{
   MSWINDOWS_SORT_BY_NAME,
   MSWINDOWS_SORT_BY_NAME_NOCASE,
   MSWINDOWS_SORT_BY_MOD_DATE,
--- a/src/emacs.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/emacs.c	Wed May 23 09:59:48 2001 +0000
@@ -657,10 +657,10 @@
 	  if (i == 0)
 	    {
 	      /* Do not trust to what crt0 has stuffed into argv[0] */
-	      Extbyte full_exe_path[MAX_PATH];
+	      Extbyte full_exe_path[PATH_MAX];
 	      Lisp_Object fullpath;
 
-	      GetModuleFileName (NULL, full_exe_path, MAX_PATH);
+	      GetModuleFileName (NULL, full_exe_path, PATH_MAX);
 	      fullpath = build_ext_string (full_exe_path, Qmswindows_tstr);
 	      result = Fcons (fullpath, result);
 #if defined(HAVE_SHLIB)
--- a/src/event-msw.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/event-msw.c	Wed May 23 09:59:48 2001 +0000
@@ -1,7 +1,7 @@
 /* The mswindows event_stream interface.
    Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1996, 2000 Ben Wing.
+   Copyright (C) 1996, 2000, 2001 Ben Wing.
    Copyright (C) 1997 Jonathan Harris.
 
 This file is part of XEmacs.
@@ -49,30 +49,29 @@
 # include "dragdrop.h"
 #endif
 
+#include "buffer.h"
 #include "device.h"
 #include "events.h"
+#include "faces.h"
 #include "frame.h"
-#include "buffer.h"
-#include "faces.h"
 #include "lstream.h"
+#include "objects-msw.h"
 #include "process.h"
 #include "redisplay.h"
 #include "select.h"
+#include "sysdep.h"
 #include "window.h"
+
+#include "sysfile.h"
 #include "sysproc.h"
+#include "systime.h"
 #include "syswait.h"
-#include "systime.h"
-#include "sysdep.h"
-#include "objects-msw.h"
 
 #ifdef HAVE_MSG_SELECT
-#include "sysfile.h"
 #include "console-tty.h"
 #elif defined(CYGWIN)
 typedef unsigned int SOCKET;
 #endif
-#include <io.h>
-#include <errno.h>
 
 #if !(defined(CYGWIN) || defined(MINGW))
 # include <shlobj.h>	/* For IShellLink */
@@ -664,7 +663,7 @@
   LPARAM user_data;		/* Any user data stored in the stream object */
   SOCKET s;			/* Socket handle (which is a Win32 handle)   */
   OVERLAPPED ov;		/* Overlapped I/O structure		     */
-  void* buffer;			/* Buffer. Allocated for input stream only   */
+  void* buffer;			/* Buffer.                                   */
   unsigned long bufsize;	/* Number of bytes last read		     */
   unsigned long bufpos;		/* Position in buffer for next fetch	     */
   unsigned int error_p :1;	/* I/O Error seen			     */
@@ -774,18 +773,24 @@
   if (size == 0)
     return 0;
 
-  {
-    ResetEvent (str->ov.hEvent);
-
-    /* Docs indicate that 4th parameter to WriteFile can be NULL since this is
-     * an overlapped operation. This fails on Win95 with winsock 1.x so we
-     * supply a spare address which is ignored by Win95 anyway. Sheesh. */
-    if (WriteFile ((HANDLE)str->s, data, size, (LPDWORD)&str->buffer, &str->ov)
-	|| GetLastError() == ERROR_IO_PENDING)
-      str->pending_p = 1;
-    else
-      str->error_p = 1;
-  }
+  ResetEvent (str->ov.hEvent);
+
+  /* According to WriteFile docs, we must hold onto the data we pass to it
+     and not make any changes until it finishes -- which may not be until
+     the next time we get here, since we use asynchronous I/O.  We have
+     in fact seen data loss as a result of not doing this. */
+  str->buffer = xrealloc (str->buffer, size);
+  memcpy (str->buffer, data, size);
+
+  /* Docs indicate that 4th parameter to WriteFile can be NULL since this is
+   * an overlapped operation. This fails on Win95 with winsock 1.x so we
+   * supply a spare address which is ignored by Win95 anyway. Sheesh. */
+  if (WriteFile ((HANDLE)str->s, str->buffer, size, (LPDWORD)&str->buffer,
+		 &str->ov)
+      || GetLastError() == ERROR_IO_PENDING)
+    str->pending_p = 1;
+  else
+    str->error_p = 1;
 
   return str->error_p ? -1 : size;
 }
@@ -804,7 +809,7 @@
   if (str->pending_p)
     WaitForSingleObject (str->ov.hEvent, INFINITE);
 
-  if (lstr->flags & LSTREAM_FL_READ)
+  if (str->buffer)
     xfree (str->buffer);
 
   CloseHandle (str->ov.hEvent);
@@ -825,14 +830,10 @@
   Lstream *lstr = Lstream_new (lstream_winsock, mode);
   struct winsock_stream *str = WINSOCK_STREAM_DATA (lstr);
 
+  xzero (*str);
   str->s = s;
-  str->blocking_p = 0;
-  str->error_p = 0;
-  str->eof_p = 0;
-  str->pending_p = 0;
   str->user_data = param;
 
-  xzero (str->ov);
   str->ov.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
 
   if (lstr->flags & LSTREAM_FL_READ)
@@ -2958,14 +2959,14 @@
 		    if (psl->lpVtbl->QueryInterface (psl, &IID_IPersistFile,
 						     &ppf) == S_OK)
 		      {
-			WORD wsz[MAX_PATH];
+			WORD wsz[PATH_MAX];
 			WIN32_FIND_DATA wfd;
-			LPSTR resolved = (char *) xmalloc (MAX_PATH+1);
-
-			MultiByteToWideChar (CP_ACP,0, fname, -1, wsz, MAX_PATH);
+			LPSTR resolved = (char *) xmalloc (PATH_MAX+1);
+
+			MultiByteToWideChar (CP_ACP,0, fname, -1, wsz, PATH_MAX);
 
 			if ((ppf->lpVtbl->Load (ppf, wsz, STGM_READ) == S_OK) &&
-			    (psl->lpVtbl->GetPath (psl, resolved, MAX_PATH,
+			    (psl->lpVtbl->GetPath (psl, resolved, PATH_MAX,
 						   &wfd, 0)==S_OK))
 			  {
 			    xfree (fname);
--- a/src/fileio.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/fileio.c	Wed May 23 09:59:48 2001 +0000
@@ -980,23 +980,11 @@
 	  memcpy (o, (char *) nm, p - nm);
 	  o [p - nm] = 0;
 
-	  /* #### marcpa's syncing note: FSF uses getpwnam even on NT,
-	     which does not work.  The following works only if ~USER
-	     names the user who runs this instance of XEmacs.  While
-	     NT is single-user (for the moment) you still can have
-	     multiple user profiles users defined, each with its HOME.
-	     Therefore, the following should be reworked to handle
-	     this case.  */
-#ifdef  WIN32_NATIVE
-	  /* Now if the file given is "~foo/file" and HOME="c:/", then
-	     we want the file to be named "c:/file" ("~foo" becomes
-	     "c:/").  The variable o has "~foo", so we can use the
-	     length of that string to offset nm.  August Hill, 31 Aug
-	     1998.  */
-	  newdir = (Bufbyte *) get_home_directory();
-	  dostounix_filename (newdir);
-	  nm += strlen(o) + 1;
-#else  /* not WIN32_NATIVE */
+	  /* #### While NT is single-user (for the moment) you still
+	     can have multiple user profiles users defined, each with
+	     its HOME.  So maybe possibly we should think about handling
+	     ~user. --ben */
+#ifndef WIN32_NATIVE
 #ifdef CYGWIN
 	  if ((user = user_login_name (NULL)) != NULL)
 	    {
--- a/src/frame.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/frame.c	Wed May 23 09:59:48 2001 +0000
@@ -336,7 +336,7 @@
   return foolist;
 }
 
-Lisp_Object
+static Lisp_Object
 restore_frame_list_to_its_unbesmirched_state (Lisp_Object kawnz)
 {
   Lisp_Object lissed = XCDR (kawnz);
--- a/src/glyphs-msw.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/glyphs-msw.c	Wed May 23 09:59:48 2001 +0000
@@ -38,6 +38,7 @@
 #include "frame.h"
 #include "insdel.h"
 #include "opaque.h"
+#include "sysdep.h"
 #include "sysfile.h"
 #include "faces.h"
 #include "imgproc.h"
@@ -45,11 +46,6 @@
 #ifdef FILE_CODING
 #include "file-coding.h"
 #endif
-#include <stdio.h>
-#include <ctype.h>
-#ifdef HAVE_XFACE
-#include <setjmp.h>
-#endif
 
 #define WIDGET_GLYPH_SLOT 0
 
--- a/src/lread.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/lread.c	Wed May 23 09:59:48 2001 +0000
@@ -421,7 +421,7 @@
 }
 
 static Lisp_Object
-pas_de_lache_ici (int fd, Lisp_Object victim)
+pas_de_holgazan_ici (int fd, Lisp_Object victim)
 {
   Lisp_Object tem;
   EMACS_INT pos;
@@ -456,7 +456,7 @@
 	{
 	  assert (CONSP (XCAR (john)));
 	  assert (!purify_flag); /* should have been handled in read_list() */
-	  XCAR (john) = pas_de_lache_ici (fd, XCAR (john));
+	  XCAR (john) = pas_de_holgazan_ici (fd, XCAR (john));
 	}
       else
 	{
@@ -466,7 +466,7 @@
 	  if (CONSP (XCOMPILED_FUNCTION (john)->instructions))
 	    {
 	      struct gcpro ngcpro1;
-	      Lisp_Object juan = (pas_de_lache_ici
+	      Lisp_Object juan = (pas_de_holgazan_ici
 				  (fd, XCOMPILED_FUNCTION (john)->instructions));
 	      Lisp_Object ivan;
 
@@ -487,7 +487,7 @@
 	    {
 	      assert (!purify_flag); /* should have been handled in
 					read_compiled_function() */
-	      doc = pas_de_lache_ici (fd, doc);
+	      doc = pas_de_holgazan_ici (fd, doc);
 	      set_compiled_function_documentation (XCOMPILED_FUNCTION (john),
 						   doc);
 	    }
--- a/src/nt.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/nt.c	Wed May 23 09:59:48 2001 +0000
@@ -443,11 +443,11 @@
   char * o = buf;
   char * p;
   char * q;
-  char full[ MAX_PATH ];
+  char full[ PATH_MAX ];
   int len;
 
   len = strlen (name);
-  if (len >= MAX_PATH)
+  if (len >= PATH_MAX)
     return FALSE;
 
   /* Use local copy for destructive modification.  */
@@ -632,9 +632,9 @@
 
   {
     char *p;
-    char modname[MAX_PATH];
+    char modname[PATH_MAX];
 
-    if (!GetModuleFileName (NULL, modname, MAX_PATH))
+    if (!GetModuleFileName (NULL, modname, PATH_MAX))
       abort ();
     if ((p = strrchr (modname, '\\')) == NULL)
       abort ();
@@ -770,12 +770,12 @@
 GetCachedVolumeInformation (char * root_dir)
 {
   volume_info_data * info;
-  char default_root[ MAX_PATH ];
+  char default_root[ PATH_MAX ];
 
   /* NULL for root_dir means use root from current directory.  */
   if (root_dir == NULL)
     {
-      if (GetCurrentDirectory (MAX_PATH, default_root) == 0)
+      if (GetCurrentDirectory (PATH_MAX, default_root) == 0)
 	return NULL;
       parse_root (default_root, &root_dir);
       *root_dir = 0;
@@ -860,7 +860,7 @@
 int
 get_volume_info (const char * name, const char ** pPath)
 {
-  char temp[MAX_PATH];
+  char temp[PATH_MAX];
   char *rootname = NULL;  /* default to current volume */
   volume_info_data * info;
 
@@ -920,7 +920,7 @@
 const char *
 map_win32_filename (const char * name, const char ** pPath)
 {
-  static char shortname[MAX_PATH];
+  static char shortname[PATH_MAX];
   char * str = shortname;
   char c;
   const char * path;
@@ -1122,7 +1122,7 @@
 int
 sys_rename (const char * oldname, const char * newname)
 {
-  char temp[MAX_PATH];
+  char temp[PATH_MAX];
   DWORD attr;
 
   /* MoveFile on Win95 doesn't correctly change the short file name
@@ -1348,14 +1348,14 @@
 static DWORD
 generate_inode_val (const char * name)
 {
-  char fullname[ MAX_PATH ];
+  char fullname[ PATH_MAX ];
   char * p;
   unsigned hash;
 
   /* Get the truly canonical filename, if it exists.  (Note: this
      doesn't resolve aliasing due to subst commands, or recognize hard
      links.  */
-  if (!win32_get_long_filename ((char *)name, fullname, MAX_PATH))
+  if (!win32_get_long_filename ((char *)name, fullname, PATH_MAX))
     abort ();
 
   parse_root (fullname, &p);
--- a/src/ntproc.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/ntproc.c	Wed May 23 09:59:48 2001 +0000
@@ -1037,7 +1037,7 @@
 */
        (filename))
 {
-  char shortname[MAX_PATH];
+  char shortname[PATH_MAX];
 
   CHECK_STRING (filename);
 
@@ -1045,7 +1045,7 @@
   filename = Fexpand_file_name (filename, Qnil);
 
   /* luckily, this returns the short version of each element in the path.  */
-  if (GetShortPathName (XSTRING_DATA (filename), shortname, MAX_PATH) == 0)
+  if (GetShortPathName (XSTRING_DATA (filename), shortname, PATH_MAX) == 0)
     return Qnil;
 
   CORRECT_DIR_SEPS (shortname);
@@ -1061,14 +1061,14 @@
 */
        (filename))
 {
-  char longname[ MAX_PATH ];
+  char longname[ PATH_MAX ];
 
   CHECK_STRING (filename);
 
   /* first expand it.  */
   filename = Fexpand_file_name (filename, Qnil);
 
-  if (!win32_get_long_filename (XSTRING_DATA (filename), longname, MAX_PATH))
+  if (!win32_get_long_filename (XSTRING_DATA (filename), longname, PATH_MAX))
     return Qnil;
 
   CORRECT_DIR_SEPS (longname);
--- a/src/process-nt.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/process-nt.c	Wed May 23 09:59:48 2001 +0000
@@ -35,12 +35,9 @@
 #include "procimpl.h"
 #include "sysdep.h"
 
-#include <shellapi.h>
-#include <errno.h>
-#include <signal.h>
-#ifdef HAVE_SOCKETS
-#include <winsock.h>
-#endif
+#include "syssignal.h"
+#include "sysfile.h"
+#include "sysproc.h"
 
 /* Bound by win32-native.el */
 Lisp_Object Qmswindows_construct_process_command_line;
@@ -737,7 +734,7 @@
 	}
       else
 	{
-	  char progname[MAX_PATH];
+	  char progname[PATH_MAX];
 	  sprintf (progname, "%s.exe", (char *)XSTRING_DATA (program));
 	  image_type = xSHGetFileInfoA (progname, 0, NULL, 0, SHGFI_EXETYPE);
 	}
--- a/src/process-unix.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/process-unix.c	Wed May 23 09:59:48 2001 +0000
@@ -454,10 +454,8 @@
     {
 #ifdef TRY_AGAIN
       if (count++ > 10) break;
-#ifndef BROKEN_CYGWIN
       h_errno = 0;
 #endif
-#endif
       /* Some systems can't handle SIGIO/SIGALARM in gethostbyname. */
       slow_down_interrupts ();
       host_info_ptr = gethostbyname ((char *) XSTRING_DATA (host));
--- a/src/realpath.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/realpath.c	Wed May 23 09:59:48 2001 +0000
@@ -24,21 +24,8 @@
 
 #include <config.h>
 #include "lisp.h"
-#include <errno.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#if defined (HAVE_SYS_PARAM_H) && !defined (WIN32_NATIVE)
-#include <sys/param.h>
-#endif
-
-#ifdef WIN32_NATIVE
-#include <direct.h>
-#endif
-
-#include <sys/stat.h>			/* for S_IFLNK */
+#include "sysfile.h"
 
 /* First char after start of absolute filename. */
 #define ABS_START(name) (name + ABS_LENGTH (name))
@@ -81,7 +68,7 @@
   assert (*name);
   
   /* Sort of check we have a valid filename. */
-  if (strpbrk (name, "*?|<>\"") || strlen (name) >= MAX_PATH)
+  if (strpbrk (name, "*?|<>\"") || strlen (name) >= PATH_MAX)
     {
       errno = EIO;
       return -1;
--- a/src/s/cygwin32.h	Tue May 22 06:49:43 2001 +0000
+++ b/src/s/cygwin32.h	Wed May 23 09:59:48 2001 +0000
@@ -1,5 +1,6 @@
 /* system description file for cygwin32.
    Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+   Copyright (C) 2001 Ben Wing.
 
 This file is part of GNU Emacs.
 
@@ -47,70 +48,12 @@
 /* cheesy way to determine cygwin version */
 #ifndef NOT_C_CODE
 # include <signal.h>
-# ifdef HAVE_CYGWIN_VERSION_H
-#  include <cygwin/version.h>
-# else
-#  ifdef SIGIO
-#   define CYGWIN_VERSION_DLL_MAJOR 19
-#   define CYGWIN_VERSION_DLL_MINOR 0
-#   define CYGWIN_B19
-#  else
-#   define CYGWIN_VERSION_DLL_MAJOR 18
-#   define CYGWIN_VERSION_DLL_MINOR 0
-#   define BROKEN_CYGWIN
-#  endif
-# endif
-
-# if CYGWIN_VERSION_DLL_MAJOR < 20
-
-void cygwin32_win32_to_posix_path_list (const char*, char*);
-int cygwin32_win32_to_posix_path_list_buf_size (const char*);
-void cygwin32_posix_to_win32_path_list (const char*, char*);
-int cygwin32_posix_to_win32_path_list_buf_size (const char*);
-
-#define cygwin_win32_to_posix_path_list cygwin32_win32_to_posix_path_list
-#define cygwin_win32_to_posix_path_list_buf_size \
-  cygwin32_win32_to_posix_path_list_buf_size
-#define cygwin_posix_to_win32_path_list cygwin32_posix_to_win32_path_list
-#define cygwin_posix_to_win32_path_list_buf_size \
-  cygwin32_posix_to_win32_path_list_buf_size
+# include <cygwin/version.h>
 
-struct timeval;
-struct timezone;
-struct itimerval;
-struct stat;
-int gettimeofday (struct timeval *tp, struct timezone *tzp);
-int gethostname (char* name, int namelen);
-char*	mktemp (char *);
-double	logb (double);
-void	sync (void);
-int	ioctl (int, int, ...);
- 			/* sys/stat.h */
-int lstat (const char *path, struct stat *buf);
- 			/* unistd.h */
-int readlink (const char *path, void *buf, unsigned int bufsiz);
-int symlink (const char *name1, const char *name2);
- 			/* sys/time.h */
-int setitimer (int which, const struct itimerval *value,
- 	      struct itimerval *ovalue);
-int utimes (char *file, struct timeval *tvp);
-
-int srandom (unsigned seed);
-long random (void);
-
-# else /* not CYGWIN_VERSION_DLL_MAJOR < 20 */
-
-void cygwin_win32_to_posix_path_list (const char*, char*);
-int cygwin_win32_to_posix_path_list_buf_size (const char*);
-void cygwin_posix_to_win32_path_list (const char*, char*);
-int cygwin_posix_to_win32_path_list_buf_size (const char*);
-
-# endif /* CYGWIN_VERSION_DLL_MAJOR < 20 */
-
-# if CYGWIN_VERSION_DLL_MAJOR <= 20
-char *getpass (const char *prompt);
-double logb (double);
-# endif /* CYGWIN_VERSION_DLL_MAJOR <= 20 */
+void cygwin_win32_to_posix_path_list (const char *, char *);
+int cygwin_win32_to_posix_path_list_buf_size (const char *);
+void cygwin_posix_to_win32_path_list (const char *, char *);
+int cygwin_posix_to_win32_path_list_buf_size (const char *);
 
 /* Still left out of 1.1! */
 double logb (double);
@@ -122,7 +65,7 @@
 #define ORDINARY_LINK
 #endif
 
-#define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves
+#define C_SWITCH_SYSTEM -fno-caller-saves
 #define LIBS_SYSTEM -lwinmm
 #define WIN32_LEAN_AND_MEAN
 
@@ -133,16 +76,8 @@
 #define NO_LIM_DATA
 #define UNEXEC "unexcw.o"
 
-#ifdef CYGWIN_VERSION_DLL_MAJOR
-#if 0
-/* #### FIXME: although defining BROKEN_SIGIO is correct for proper ^G
-   behavior, bugs in cygwin mean that xemacs locks up frequently if
-   this is defined.  */
 #define BROKEN_SIGIO
-#endif
-#else
-#define PROCESS_IO_BLOCKING
-#endif
+
 #define strnicmp strncasecmp
 #ifndef HAVE_SOCKETS
 #define HAVE_SOCKETS
--- a/src/s/mingw32.h	Tue May 22 06:49:43 2001 +0000
+++ b/src/s/mingw32.h	Wed May 23 09:59:48 2001 +0000
@@ -31,7 +31,7 @@
 #define ORDINARY_LINK
 #endif
 
-#define C_SWITCH_SYSTEM "-mno-cygwin -Wno-sign-compare -fno-caller-saves -DWIN32_NATIVE"
+#define C_SWITCH_SYSTEM "-mno-cygwin -fno-caller-saves -DWIN32_NATIVE"
 #define LIBS_SYSTEM "-mno-cygwin -mwindows -lwinmm -lwsock32"
 #define WIN32_LEAN_AND_MEAN
 
--- a/src/sysdep.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/sysdep.c	Wed May 23 09:59:48 2001 +0000
@@ -2323,7 +2323,7 @@
       hostname_size <<= 1;
       hostname = (char *) alloca (hostname_size);
     }
-# if defined( HAVE_SOCKETS) && !defined(BROKEN_CYGWIN)
+# if defined( HAVE_SOCKETS)
   /* Turn the hostname into the official, fully-qualified hostname.
      Don't do this if we're going to dump; this can confuse system
      libraries on some machines and make the dumped emacs core dump. */
--- a/src/sysfile.h	Tue May 22 06:49:43 2001 +0000
+++ b/src/sysfile.h	Wed May 23 09:59:48 2001 +0000
@@ -1,5 +1,6 @@
 /*
    Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright (C) 2001 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -26,11 +27,11 @@
 #include <errno.h>
 
 #ifndef WIN32_NATIVE
-#include <sys/errno.h>          /* <errno.h> does not always imply this */
+# include <sys/errno.h>          /* <errno.h> does not always imply this */
 #endif
 
 #ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
 #endif
 
 #ifndef INCLUDED_FCNTL
@@ -38,38 +39,39 @@
 # include <fcntl.h>
 #endif /* INCLUDED_FCNTL */
 
-/* Load sys/types.h if not already loaded.
+/* The anonymous voice of the past says:
    In some systems loading it twice is suicidal.  */
-#ifndef makedev
-#include <sys/types.h>		/* some typedefs are used in sys/file.h */
-#endif
+#ifndef INCLUDED_SYS_TYPES
+# define INCLUDED_SYS_TYPES
+# include <sys/types.h>		/* some typedefs are used in sys/file.h */
+#endif /* INCLUDED_SYS_TYPES */
 
 #ifndef WIN32_NATIVE
-#include <sys/file.h>
+# include <sys/file.h>
 #endif
 
 #include <sys/stat.h>
 
-#ifndef WIN32_NATIVE
+#if defined (WIN32_NATIVE) || defined (CYGWIN)
+# include <io.h>
+#endif
+
+#ifdef WIN32_NATIVE
+# include <direct.h>
+#else
 /* Some configuration files' definitions for the LOAD_AVE_CVT macro
    (like sparc.h's) use macros like FSCALE, defined here. */
-#ifdef HAVE_GTK
+# ifdef HAVE_GTK
 /* I hate GTK */
-#undef MIN
-#undef MAX
-#endif /* HAVE_GTK */
-#include <sys/param.h>
-#endif
-
-#if defined (NeXT) || defined(CYGWIN)
-/* what is needed from here?  Do others need it too?
- O_BINARY is in here under cygwin. */
+#  undef MIN
+#  undef MAX
+# endif /* HAVE_GTK */
+# include <sys/param.h>
+/* We used to conditionalize this on defined (NeXT) || defined (CYGWIN),
+   with the comment "what is needed from here?  Do others need it too?
+   O_BINARY is in here under cygwin." sunplay.c needed this, so let's
+   just include it always and fix any breakage (unlikely) that happens. */
 # include <sys/fcntl.h>
-#endif /* NeXT */
-
-#ifdef WIN32_NATIVE
-#include <io.h>
-#include <direct.h>
 #endif
 
 #ifndef	STDERR_FILENO
@@ -246,7 +248,10 @@
 
 /* Client .c files should simply use `PATH_MAX'. */
 #ifndef PATH_MAX
-# if defined (_POSIX_PATH_MAX)
+# if defined (_MAX_PATH)
+/* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */
+#  define PATH_MAX _MAX_PATH
+# elif defined (_POSIX_PATH_MAX)
 #  define PATH_MAX _POSIX_PATH_MAX
 # elif defined (MAXPATHLEN)
 #  define PATH_MAX MAXPATHLEN
--- a/src/systime.h	Tue May 22 06:49:43 2001 +0000
+++ b/src/systime.h	Wed May 23 09:59:48 2001 +0000
@@ -233,7 +233,7 @@
 void get_process_times (double *user_time, double *system_time,
 			double *real_time);
 
-#if defined(WIN32_NATIVE) || defined(BROKEN_CYGWIN)
+#if defined(WIN32_NATIVE)
 
 /* setitimer emulation for Win32 (see nt.c) */
 
--- a/src/syswindows.h	Tue May 22 06:49:43 2001 +0000
+++ b/src/syswindows.h	Wed May 23 09:59:48 2001 +0000
@@ -1,5 +1,5 @@
 /* Copyright (C) 2000 Free Software Foundation, Inc.
-   Copyright (C) 2000 Ben Wing.
+   Copyright (C) 2000, 2001 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -57,25 +57,19 @@
 
 #include <windows.h>
 
-#if defined (CYGWIN) && CYGWIN_VERSION_DLL_MAJOR < 21
-extern BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ);
-extern BOOL WINAPI PlaySound(LPCSTR,HMODULE,DWORD);
-#define stricmp strcasecmp
-#define FONTENUMPROC FONTENUMEXPROC
-#define ntmTm ntmentm
-#elif defined (WIN32_LEAN_AND_MEAN)
-#ifdef HAVE_X_WINDOWS
+#if defined (WIN32_LEAN_AND_MEAN)
+# ifdef HAVE_X_WINDOWS
 /* Christ almighty.  The problems you get when combining two large code bases,
    neither with any respect for namespace purity. */
-#undef Status
-#endif
-#include <winspool.h>
-#ifdef HAVE_X_WINDOWS
-#define Status int
-#endif
-#include <mmsystem.h>
-#include <shellapi.h>
-#include <ddeml.h>
+#  undef Status
+# endif
+# include <winspool.h>
+# ifdef HAVE_X_WINDOWS
+#  define Status int
+# endif
+# include <mmsystem.h>
+# include <shellapi.h>
+# include <ddeml.h>
 #endif
 
 #include <lmaccess.h> /* next three for NetUserEnum and friends */
--- a/src/unexcw.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/unexcw.c	Wed May 23 09:59:48 2001 +0000
@@ -26,12 +26,6 @@
 #include <config.h>
 #include "lisp.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-
 #define DONT_ENCAPSULATE /* filenames are external in unex*.c */
 #include "sysfile.h"
 
@@ -48,10 +42,6 @@
 }
 #else
 
-#ifndef MAX_PATH
-#define MAX_PATH 260
-#endif
-
 #ifdef MINGW
 #include <../../include/a.out.h>
 #else
@@ -94,13 +84,12 @@
 PEAOUTHDR f_ohdr;
 SCNHDR f_data, f_bss, f_text, f_nextdata;
 
-#define PERROR(arg) perror(arg);exit(-1) 
-#define CHECK_AOUT_POS(a) \
-if (lseek(a_out, 0, SEEK_CUR) != a) \
-{ \
-  printf("we are at %lx, should be at %lx\n", \
-	 lseek(a_out, 0, SEEK_CUR), a); \
-  exit(-1); \
+#define CHECK_AOUT_POS(a)			\
+if (lseek(a_out, 0, SEEK_CUR) != a)		\
+{						\
+  printf("we are at %lx, should be at %lx\n",	\
+	 lseek(a_out, 0, SEEK_CUR), a);		\
+  exit(-1);					\
 }
 
 /* Dump out .data and .bss sections into a new executable.  */
@@ -110,7 +99,7 @@
 {
   /* ugly nt hack - should be in lisp */
   int a_new, a_out = -1;
-  char new_name[MAX_PATH], a_name[MAX_PATH];
+  char new_name[PATH_MAX], a_name[PATH_MAX];
   char *ptr;
   
   /* Make sure that the input and output filenames have the
@@ -129,15 +118,11 @@
   /* round_heap (get_allocation_unit ()); */
 
   if (a_name && (a_out = open (a_name, O_RDONLY | OPEN_BINARY)) < 0)
-    {
-      PERROR (a_name);
-    }
+    PERROR (a_name);
 
   if ((a_new = open (new_name, O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
 		     0755)) < 0)
-    {
-      PERROR (new_name);
-    }
+    PERROR (new_name);
 
   /* Get the interesting section info, like start and size of .bss...  */
   get_section_info (a_out, a_name);
@@ -150,54 +135,41 @@
 }
 
 /* Flip through the executable and cache the info necessary for dumping.  */
-static void get_section_info (int a_out, char* a_name)
+static void
+get_section_info (int a_out, char* a_name)
 {
   extern char my_ebss[];
   /* From lastfile.c  */
   extern char my_edata[];
 
   if (read (a_out, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr))
-    {
-      PERROR (a_name);
-    }
+    PERROR (a_name);
 
   if (f_hdr.e_magic != DOSMAGIC) 
-    {
-      PERROR("unknown exe header");
-    }
+    PERROR("unknown exe header");
 
   /* Check the NT header signature ...  */
   if (f_hdr.nt_signature != NT_SIGNATURE) 
-    {
-      PERROR("invalid nt header");
-    }
+    PERROR("invalid nt header");
 
   /* Flip through the sections for .data and .bss ...  */
   if (f_hdr.f_opthdr > 0)
     {
       if (read (a_out, &f_ohdr, AOUTSZ) != AOUTSZ)
-	{
-	  PERROR (a_name);
-	}
+	PERROR (a_name);
     }
   /* Loop through .data & .bss section headers, copying them in.
      With newer lds these are reversed so we have to cope with both */
   lseek (a_out, sizeof (f_hdr) + f_hdr.f_opthdr, 0);
 
   if (read (a_out, &f_text, sizeof (f_text)) != sizeof (f_text)
-      ||
-      strcmp (f_text.s_name, ".text"))
-    {
-      PERROR ("no .text section");
-    }
+      || strcmp (f_text.s_name, ".text"))
+    PERROR ("no .text section");
 
   /* The .bss section.  */
   if (read (a_out, &f_bss, sizeof (f_bss)) != sizeof (f_bss)
-      ||
-      (strcmp (f_bss.s_name, ".bss") && strcmp (f_bss.s_name, ".data")))
-    {
-      PERROR ("no .bss / .data section");
-    }
+      || (strcmp (f_bss.s_name, ".bss") && strcmp (f_bss.s_name, ".data")))
+    PERROR ("no .bss / .data section");
 
   /* check for reversed .bss and .data */
   if (!strcmp(f_bss.s_name, ".data"))
@@ -211,20 +183,14 @@
   if (!sections_reversed)
     {
       if (read (a_out, &f_data, sizeof (f_data)) != sizeof (f_data)
-	  ||
-	  strcmp (f_data.s_name, ".data"))
-	{
-	  PERROR ("no .data section");
-	}
+	  || strcmp (f_data.s_name, ".data"))
+	PERROR ("no .data section");
     }
   else
     {
       if (read (a_out, &f_bss, sizeof (f_bss)) != sizeof (f_bss)
-	  ||
-	  strcmp (f_bss.s_name, ".bss"))
-	{
-	  PERROR ("no .bss section");
-	}
+	  || strcmp (f_bss.s_name, ".bss"))
+	PERROR ("no .bss section");
     }
   
   bss_start = (void *) ((char*)f_ohdr.ImageBase + f_bss.s_vaddr);
@@ -247,9 +213,7 @@
   if (read (a_out, &f_nextdata, sizeof (f_nextdata)) != sizeof (f_nextdata)
       &&
       strcmp (&f_nextdata.s_name[2], "data"))
-    {
-      PERROR ("no other data section");
-    }
+    PERROR ("no other data section");
 }
 
 /* The dump routines.  */
@@ -259,30 +223,30 @@
 {
   long size=0;
   unsigned long new_data_size, new_bss_size, 
-    bss_padding, file_sz_change, data_padding=0,
-    f_data_s_vaddr = f_data.s_vaddr,
-    f_data_s_scnptr = f_data.s_scnptr,
-    f_bss_s_vaddr = f_bss.s_vaddr, 
-    f_nextdata_s_scnptr = f_nextdata.s_scnptr;
+  bss_padding, file_sz_change, data_padding=0,
+  f_data_s_vaddr = f_data.s_vaddr,
+  f_data_s_scnptr = f_data.s_scnptr,
+  f_bss_s_vaddr = f_bss.s_vaddr, 
+  f_nextdata_s_scnptr = f_nextdata.s_scnptr;
 
   int i;
   void* empty_space;
   extern int static_heap_dumped;
   SCNHDR section;
   /* calculate new sizes:
-
+     
      f_ohdr.dsize is the total initialized data size on disk which is
      f_data.s_size + f_idata.s_size.
-
+     
      f_ohdr.data_start is the base addres of all data and so should
      not be changed.
      
      *.s_vaddr is the virtual address of the start of the section
      *normalized from f_ohdr.ImageBase.
-
+     
      *.s_paddr appears to be the number of bytes in the section
      *actually used (whereas *.s_size is aligned).
-
+     
      bsize is now 0 since subsumed into .data
      dsize is dsize + (f_data.s_vaddr - f_bss.s_vaddr)
      f_data.s_vaddr is f_bss.s_vaddr
@@ -302,24 +266,18 @@
     }
 
   if ((new_bss_size - bss_size) < BSS_PAD_SIZE)
-    { 
-      PERROR (".bss free space too small");
-    }
+    PERROR (".bss free space too small");
 
   file_sz_change=(new_bss_size + data_padding) - BSS_PAD_SIZE;
   new_data_size=f_ohdr.dsize + file_sz_change;
 
   if (!sections_reversed)
-    {
-      f_data.s_vaddr = f_bss.s_vaddr;
-    }
+    f_data.s_vaddr = f_bss.s_vaddr;
   f_data.s_paddr += file_sz_change;
 #if 0 
   if (f_data.s_size + f_nextdata.s_size != f_ohdr.dsize)
-    {
-      printf("section size doesn't tally with dsize %lx != %lx\n", 
-	     f_data.s_size + f_nextdata.s_size, f_ohdr.dsize);
-    }
+    printf("section size doesn't tally with dsize %lx != %lx\n", 
+	   f_data.s_size + f_nextdata.s_size, f_ohdr.dsize);
 #endif
   f_data.s_size += file_sz_change;
   lseek (a_new, 0, SEEK_SET);
@@ -331,30 +289,22 @@
 
   printf("writing file header\n");
   if (write(a_new, &f_hdr, sizeof(f_hdr)) != sizeof(f_hdr))
-    {
-      PERROR("failed to write file header");
-    }
+    PERROR("failed to write file header");
   /* write optional header fixing dsize & bsize*/
   printf("writing optional header\n");
   printf("new data size is %lx, >= %lx\n", new_data_size,
 	 f_ohdr.dsize + f_ohdr.bsize);
   if (new_data_size < f_ohdr.dsize + f_ohdr.bsize )
-    {
-      printf("warning: new data size is < approx\n");
-    }
+    printf("warning: new data size is < approx\n");
   f_ohdr.dsize=new_data_size;
   f_ohdr.bsize=BSS_PAD_SIZE;
   if (write(a_new, &f_ohdr, sizeof(f_ohdr)) != sizeof(f_ohdr))
-    {
-      PERROR("failed to write optional header");
-    }
+    PERROR("failed to write optional header");
   /* write text as is */
   printf("writing text header (unchanged)\n");
 
   if (write(a_new, &f_text, sizeof(f_text)) != sizeof(f_text))
-    {
-      PERROR("failed to write text header");
-    }
+    PERROR("failed to write text header");
 #ifndef NO_DEBUG
   /* Write small bss section. */
   if (!sections_reversed)
@@ -363,18 +313,14 @@
       f_bss.s_paddr = BSS_PAD_SIZE;
       f_bss.s_vaddr = f_data.s_vaddr - BSS_PAD_SIZE;
       if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss))
-	{
-	  PERROR("failed to write bss header");
-	}
+	PERROR("failed to write bss header");
     }
 #endif
   /* write new data header */
   printf("writing .data header\n");
 
   if (write(a_new, &f_data, sizeof(f_data)) != sizeof(f_data))
-    {
-      PERROR("failed to write data header");
-    }
+    PERROR("failed to write data header");
 #ifndef NO_DEBUG
   /* Write small bss section. */
   if (sections_reversed)
@@ -383,9 +329,7 @@
       f_bss.s_paddr = BSS_PAD_SIZE;
       f_bss.s_vaddr = f_nextdata.s_vaddr - BSS_PAD_SIZE;
       if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss))
-	{
-	  PERROR("failed to write bss header");
-	}
+	PERROR("failed to write bss header");
     }
 #endif
   printf("writing following data header\n");
@@ -393,34 +337,26 @@
   if (f_nextdata.s_lnnoptr != 0) f_nextdata.s_lnnoptr += file_sz_change;
   if (f_nextdata.s_relptr != 0) f_nextdata.s_relptr += file_sz_change;
   if (write(a_new, &f_nextdata, sizeof(f_nextdata)) != sizeof(f_nextdata))
-    {
-      PERROR("failed to write nextdata header");
-    }
+    PERROR("failed to write nextdata header");
 
   /* copy other section headers adjusting the file offset */
   for (i=0; i<(f_hdr.f_nscns-3); i++)
     {
       if (read (a_out, &section, sizeof (section)) != sizeof (section))
-	{
-	  PERROR ("no .data section");
-	}
+	PERROR ("no .data section");
       
       section.s_scnptr += file_sz_change;
       if (section.s_lnnoptr != 0) section.s_lnnoptr += file_sz_change;
       if (section.s_relptr != 0) section.s_relptr += file_sz_change;
 
       if (write(a_new, &section, sizeof(section)) != sizeof(section))
-	{
-	  PERROR("failed to write data header");
-	}
+	PERROR("failed to write data header");
     }
 #ifdef NO_DEBUG
   /* dump bss to maintain offsets */
   memset(&f_bss, 0, sizeof(f_bss));
   if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss))
-    {
-      PERROR("failed to write bss header");
-    }
+    PERROR("failed to write bss header");
 #endif
   size=lseek(a_new, 0, SEEK_CUR);
   CHECK_AOUT_POS(size);
@@ -446,16 +382,12 @@
       /* pad, needs to be zero */
       bss_padding = (new_bss_size - bss_size) - BSS_PAD_SIZE;
       if (bss_padding < 0)
-	{
-	  PERROR("padded .bss too small");
-	}
+	PERROR("padded .bss too small");
       printf ("padding .bss ... %lx bytes\n", bss_padding);
       empty_space = malloc(bss_padding);
       memset(empty_space, 0, bss_padding);
       if (write(a_new, empty_space, bss_padding) != (int)bss_padding)
-	{
-	  PERROR("failed to write bss section");
-	}
+	PERROR("failed to write bss section");
       free(empty_space);
     }
 
@@ -464,9 +396,7 @@
   /* Get a pointer to the raw data in our address space.  */
   printf ("dumping .data section... %lx bytes\n", data_size);
   if (write(a_new, data_start_va, data_size) != (int)data_size)
-    {
-      PERROR("failed to write data section");
-    }
+    PERROR("failed to write data section");
   /* were going to use free again ... */
   static_heap_dumped = 0;
   
@@ -487,23 +417,17 @@
       /* dump bss + padding between sections */
       printf ("dumping .bss into executable... %lx bytes\n", bss_size);
       if (write(a_new, bss_start, bss_size) != (int)bss_size)
-	{
-	  PERROR("failed to write bss section");
-	}
+	PERROR("failed to write bss section");
       
       /* pad, needs to be zero */
       bss_padding = (new_bss_size - bss_size) - BSS_PAD_SIZE;
       if (bss_padding < 0)
-	{
-	  PERROR("padded .bss too small");
-	}
+	PERROR("padded .bss too small");
       printf ("padding .bss ... %lx bytes\n", bss_padding);
       empty_space = malloc(bss_padding);
       memset(empty_space, 0, bss_padding);
       if (write(a_new, empty_space, bss_padding) != (int)bss_padding)
-	{
-	  PERROR("failed to write bss section");
-	}
+	PERROR("failed to write bss section");
       free(empty_space);
       if (lseek(a_new, 0, SEEK_CUR) != f_nextdata.s_scnptr)
 	{
@@ -542,9 +466,7 @@
     {
       n = size > sizeof (page) ? sizeof (page) : size;
       if (read (a_out, page, n) != n || write (a_new, page, n) != n)
-	{
-	  PERROR ("dump_out()");
-	}
+	PERROR ("dump_out()");
     }
 }
 
@@ -555,15 +477,11 @@
 
   cpos = lseek(a_new, 0, SEEK_CUR);
   if (va < bss_start || va > bss_start + f_data.s_size)
-    {
-      PERROR("address not in data space\n");
-    }
+    PERROR("address not in data space\n");
   lseek(a_new, f_data.s_scnptr + ((unsigned long)va - 
 				  (unsigned long)bss_start), SEEK_SET);
   if (write(a_new, newval, sizeof(int)) != (int)sizeof(int))
-    {
-      PERROR("failed to write int value");
-    }
+    PERROR("failed to write int value");
   lseek(a_new, cpos, SEEK_SET);
 }
 #endif
--- a/src/unexnt.c	Tue May 22 06:49:43 2001 +0000
+++ b/src/unexnt.c	Wed May 23 09:59:48 2001 +0000
@@ -58,6 +58,7 @@
 #include <config.h>
 #include "lisp.h"
 
+#include "sysfile.h"
 #include "syswindows.h"
 
 #include "nt.h"
@@ -128,9 +129,9 @@
      won't work.)  */
   if (heap_state == HEAP_UNLOADED) 
     {
-      char executable_path[MAX_PATH];
+      char executable_path[PATH_MAX];
 
-      if (GetModuleFileName (NULL, executable_path, MAX_PATH) == 0) 
+      if (GetModuleFileName (NULL, executable_path, PATH_MAX) == 0) 
 	{
 	  exit (1);
 	}
@@ -174,7 +175,7 @@
 	unsigned int start_bss, unsigned int entry_address)
 {
   file_data in_file, out_file;
-  char out_filename[MAX_PATH], in_filename[MAX_PATH];
+  char out_filename[PATH_MAX], in_filename[PATH_MAX];
   unsigned long size;
   char *ptr;
   HINSTANCE hImagehelp;
@@ -278,7 +279,7 @@
 			    DWORD *p_bss_size)
 {
   int n, start, len;
-  char map_filename[MAX_PATH];
+  char map_filename[PATH_MAX];
   char buffer[256];
   FILE *map;