
(defvar ftp-password-alist nil "\
Security sucks")

(defun read-ftp-user-password (host user new) (byte-code "	?  
<  
\"A  ?  @\"'  R 
<6 
\"A@;  #!\"R #
<?d ΂w 
\"AAw 
э)w \"B!
< A\"? B
B)" [tem new ftp-password-alist host user l nil assoc string= user-login-name read-string format "User-name for %s (default \"%s\"): " equal "" "Password for %s@%s: " foo (byte-code "  @A@	\" @AA\" A  " [l user nil string= throw foo] 5) message] 14))

(defun ftp-read-file-name (prompt) (byte-code "\"? 	\" !!O!!OD)" [s prompt "" string-match "\\`[ 	]*\\([^ 	:]+\\)[ 	]*:\\(.+\\)\\'" read-string match-beginning 1 match-end 2] 10))

(defun ftp-find-file (host file &optional user password) "\
FTP to HOST to get FILE, logging in as USER with password PASSWORD.
Interactively, HOST and FILE are specified by reading a string with
 a colon character separating the host from the filename.
USER and PASSWORD are defaulted from the values used when
 last ftping from HOST (unless password-remembering is disabled).
 Supply a password of the symbol `t' to override this default
 (interactively, this is done by giving a prefix arg)" (interactive (byte-code "!	??D\"" [nil current-prefix-arg append ftp-read-file-name "FTP get host:file: "] 5)) (byte-code "
%" [nil current-prefix-arg host file t user password ftp-find-file-or-directory] 6))

(defun ftp-list-directory (host file &optional user password) "\
FTP to HOST to list DIRECTORY, logging in as USER with password PASSWORD.
Interactively, HOST and FILE are specified by reading a string with
 a colon character separating the host from the filename.
USER and PASSWORD are defaulted from the values used when
 last ftping from HOST (unless password-remembering is disabled).
 Supply a password of the symbol `t' to override this default
 (interactively, this is done by giving a prefix arg)" (interactive (byte-code "!	??D\"" [nil current-prefix-arg append ftp-read-file-name "FTP get host:directory: "] 5)) (byte-code "
%" [nil current-prefix-arg host file user password ftp-find-file-or-directory] 6))

(defun ftp-find-file-or-directory (host file filep &optional user password) "\
FTP to HOST to get FILE.  Third arg is t for file, nil for directory.
Log in as USER with PASSWORD.  If USER is nil or PASSWORD is nil or t,
we prompt for the user name and password." (byte-code " 	 	=? 	=#A@* Ђ+ $!q\"
ӎ	$
V !Y !))f ڂg $y ނz #$ !e`\")#\" !!)!#*)" [user password t host buffer filep file process case-fold-search nil win buffer-read-only read-ftp-user-password get-buffer-create format "*ftp%s %s:%s*" "" "-directory" ftp-setup-buffer ((byte-code " 	!" [win process delete-process] 2)) ftp-login message "Logged in" error "Ftp login lost" "Opening %s %s:%s..." "file" "directory" ftp-command "%s \"%s\" -
quit
" "get" "dir" "\\(150\\|125\\).*
" "200.*
" forward-line 1 delete-region "Retrieving %s:%s in background.  Bye!" set-process-sentinel ftp-asynchronous-input-sentinel switch-to-buffer insert-before-markers "<<<Ftp lost>>>" delete-process "Ftp %s:%s lost"] 21))

(defun ftp-write-file (host file &optional user password) "\
FTP to HOST to write FILE, logging in as USER with password PASSWORD.
Interactively, HOST and FILE are specified by reading a string with colon
separating the host from the filename.
USER and PASSWORD are defaulted from the values used when
 last ftping from HOST (unless password-remembering is disabled).
 Supply a password of the symbol `t' to override this default
 (interactively, this is done by giving a prefix arg)" (interactive (byte-code "!	??D\"" [nil current-prefix-arg append ftp-read-file-name "FTP write host:file: "] 5)) (byte-code "
  =?  
=#
A
@#!!ed#q!	\"
׎

$g !j !))#
#$ !e`\")#
\"
 !!)
!#**" [nil current-prefix-arg user password t host buffer file tmp ftp-temp-file-name process case-fold-search win buffer-read-only read-ftp-user-password get-buffer-create format "*ftp %s:%s*" make-temp-name "/tmp/emacsftp" write-region make-local-variable ftp-setup-buffer ((byte-code " 	!" [win process delete-process] 2)) ftp-login message "Logged in" error "Ftp login lost" "Opening file %s:%s..." ftp-command "send \"%s\" \"%s\"
quit
" "\\(150\\|125\\).*
" "200.*
" forward-line 1 delete-region "Saving %s:%s in background.  Bye!" set-process-sentinel ftp-asynchronous-output-sentinel switch-to-buffer insert-before-markers "<<<Ftp lost>>>" delete-process "Ftp write %s:%s lost"] 24))

(defun ftp-setup-buffer (host file) (byte-code " p!1  p!!p!#!. p!+ p!! 1 ! !!Ɖp&" [buffer-read-only nil ftp-host host ftp-file file t fundamental-mode get-buffer-process discard-input y-or-n-p format "Kill process \"%s\" in %s? " process-name buffer-name kill-process error "Foo" erase-buffer make-local-variable start-process "ftp" "-i" "-n" "-g"] 22))

(defun ftp-login (process host user password) (byte-code "	#
	$$ Ă2 
!!
!<0 	\"\"Ƈ" [user host process password t ftp-password-alist nil message "FTP logging in as %s@%s..." ftp-command format "open %s
user %s %s
" "230.*
" "\\(Connected to \\|220\\|331\\).*
" switch-to-buffer process-buffer delete-process delq assoc] 10))

(defun ftp-command (process command win ignore) (byte-code "	\"
!b ! dbĉ^ !+ !b^ !8 !^ #?O `ӏ
b^ ![ !^ ǉ	 
*" [process command p case-fold-search t win ignore nil process-send-string 1 numberp looking-at "^ftp> \\|^
" match-end 0 forward-line search-forward "
" (byte-code "!" [process accept-process-output] 2) ((error (byte-code "" [nil] 1))) "^[a-z]"] 13))

(defun ftp-asynchronous-input-sentinel (process msg) (byte-code "	$" [process msg t ftp-sentinel] 5))

(defun ftp-synchronous-input-sentinel (process msg) (byte-code "	$" [process msg nil t ftp-sentinel] 5))

(defun ftp-asynchronous-output-sentinel (process msg) (byte-code "	$" [process msg t nil ftp-sentinel] 5))

(defun ftp-synchronous-output-sentinel (process msg) (byte-code "	$" [process msg nil ftp-sentinel] 5))

(defun ftp-sentinel (process msg asynchronous input) (byte-code "!!? \"!= !U !q/ Ԃ0 db!!B !`O ۂP $#j !!\"Pk P	d\")!q	
\"))!)? ꏈp! #!

!
!

! ) 
\"!*)!>!qp!
#	db
#)!!q	db
c) 
\")" [process nil msg r input p ftp-host ftp-file t buffer-read-only kludge asynchronous proc buffer-name process-buffer set-process-buffer process-status exit process-exit-status 0 "[0-9]+ bytes received in [0-9]+\\.[0-9]+ seconds.*$" "[0-9]+ bytes sent in [0-9]+\\.[0-9]+ seconds.*$" search-backward "226 " looking-at format "ftp %s %s:%s done" "read" "write" re-search-forward ": " buffer-substring match-beginning match-end "" delete-region get-buffer-create "*ftp log*" insert 10 set-buffer-modified-p (byte-code "!  !" [ftp-temp-file-name boundp delete-file] 3) ((error (byte-code "" [nil] 1))) kill-buffer generate-new-buffer "%s:%s (ftp)" rename-buffer ftp-setup-write-file-hooks message "%s" sleep-for 2 (exit signal) "Ftp died (buffer %s): %s" delete-process waiting-for-user-input-p error] 38))

(defun ftp-setup-write-file-hooks nil (byte-code "	!	\")!ʉˉp!!PƉ" [hooks write-file-hooks revert-buffer-function default-directory buffer-file-name buffer-read-only nil make-local-variable append (ftp-write-file-hook) ftp-revert-buffer "/tmp/" make-temp-name buffer-name] 7))

(defun ftp-write-file-hook nil (byte-code "	
\"\"	
#!=  ͏ !=4 !U4 !)!ć" [process ftp-host ftp-file nil t ftp-write-file set-process-sentinel ftp-synchronous-output-sentinel message "FTP writing %s:%s..." process-status run (byte-code "!" [process accept-process-output] 2) ((error (byte-code "" [nil] 1))) exit process-exit-status 0 set-buffer-modified-p "Written"] 9))

(defun ftp-revert-buffer (&rest ignore) (byte-code "	
\"\"	
#!=  ̏ !=4 !U4 !!)" [process ftp-host ftp-file nil ftp-find-file set-process-sentinel ftp-synchronous-input-sentinel message "FTP reverting %s:%s" process-status run (byte-code "!" [process accept-process-output] 2) ((error (byte-code "" [nil] 1))) exit process-exit-status 0 set-buffer-modified-p "Reverted"] 9))
