Re: Ending ftp sessions (was Re: Some general usage questions)

rdong@math.uci.edu
Tue, 8 Nov 1994 11:43:45 -0800


>>>>> On Fri, 4 Nov 1994 09:28:35 +0100, Christian Lynbech <lynbech@daimi.aau.dk> said:

 lynbech> I have long been wondering: What is the proper way to end ftp
 lynbech> sessions, when using ange-ftp.

 lynbech> The obvious solution, is to simply forget the remote
 lynbech> directory/file and let the connection time out by itself, but is
 lynbech> this really kosher?  Or should I rather go to the ftp buffer and
 lynbech> type bye (of course, one would make a function or a clever hook
 lynbech> for that)?

Here is what I do,

(defun ange-ftp-kill-all-processes ()
  "Kill idling ftp processes."
  (interactive)
  (let ((list (process-list)) (n 0) proc)
    (while list
      (setq proc (car list))
      (setq list (cdr list))
      (if (string-match "#<process \\*ftp " (prin1-to-string proc))
	  (progn
	    (setq n (1+ n))
	    (process-send-string proc "bye \n")))
      (message "%d processes killed." n))))

Notice that it doesn't kill background copings until they finish and it
keeps the ftp session buffers (and therefor all local variables.)

Regards,

    Rui-Tao Dong ~{6-HpLN~}		    Department of Mathematics
    rdong@math.uci.edu			    University of California 
    (714)824-2713(O) (714)824-7993(Fax)	    Irvine, CA 92717-3875