[comp.emacs] Re: Getting ftp access to files... under Win 95

Hrvoje Niksic (hniksic@srce.hr)
21 Jun 1998 17:16:01 +0200


This is cool.  Can it apply to XEmacs?

------- Start of forwarded message -------
From: Andrew Innes <andrewi@harlequin.co.uk>
Newsgroups: comp.emacs
Subject: Re: Getting ftp access to files... under Win 95
Date: 21 Jun 1998 15:22:51 +0100
Organization: Harlequin Ltd.
Message-ID: <uemwi6dhg.fsf@harlequin.co.uk>
References: <3589AFD8.42180F82@rsv.ricoh.com> 	<vaf67hxwz2x.fsf@ramses.cs.uni-dortmund.de> 	<wkiulx9uiu.fsf_-_@PHMBD048.i-have-a-misconfigured-system-so-shoot-me> <873eczs7fi.fsf@kale.connix.com>

Richard Tietjen <rtietjen@kale.connix.com> writes:
> ddg@cci.com writes:
> 
> You need to read the NTEMacs faq. In it they provide a url for an FTP
> client that works like unix.  Put the clone ftp.exe into a PATHed
> directory ahead of the windows system directory, or set the
> ange-ftp-ftp-program-name variable.  It sounds like you're getting the
> behavior of the windows FTP client instead which doesn't accept
> scripting input from STDIN, and so hangs when called from ange-ftp.
> 
> HTH

Actually, we recently discovered that the problem with the standard
Windows ftp client was not what we thought it was; a trivial change to
ange-ftp is sufficient to use the MS ftp client.  Since Emacs 19 is no
longer under development, we've only made this change in version 20, but
it is a simple change to ange-ftp-start-process that can be applied by
hand to the 19.34.6 version of ange-ftp.el.

Add the lines starting with "+ " below to lisp/ange-ftp.el (after
removing the "+ " from each line), then run M-x byte-compile-file.
Reload ange-ftp (or restart Emacs) and ange-ftp should work.

AndrewI

*** d:/AndrewI/emacs-19.34/lisp/ange-ftp.el.orig	Thu Sep 25 07:28:00 1997
--- d:/AndrewI/emacs-19.34/lisp/ange-ftp.el	Sun Jun 21 15:17:48 1998
***************
*** 1837,1842 ****
--- 1837,1855 ----
        (internal-ange-ftp-mode))
      (set-process-sentinel proc (function ange-ftp-process-sentinel))
      (set-process-filter proc (function ange-ftp-process-filter))
+     ;; On Windows, the standard ftp client buffers its output (because
+     ;; stdout is a pipe handle) so the startup message may never appear:
+     ;; `accept-process-output' at this point would hang indefinitely.
+     ;; However, sending an innocuous command ("help foo") forces some
+     ;; output that will be ignored, which is just as good.  Once we
+     ;; start sending normal commands, the output no longer appears to be
+     ;; buffered, and everything works correctly.  My guess is that the
+     ;; output of interest is being sent to stderr which is not buffered.
+     (when (eq system-type 'windows-nt)
+       ;; force ftp output to be treated as DOS text, otherwise the
+       ;; output of "help foo" confuses the EOL detection logic.
+       (set-process-coding-system proc 'raw-text-dos)
+       (process-send-string proc "help foo\n"))
      (accept-process-output proc)	;wait for ftp startup message
      proc))
  
-- 
Andrew Innes             Software Developer, Digital Printing & Publishing
Harlequin Limited, Longstanton House, Longstanton, Cambridge CB4 5BU, U.K.
Tel: +44 1954 785468  Fax: +44 1954 785444   WWW: http://www.harlequin.com
------- End of forwarded message -------