Mercurial > emacs
comparison lisp/ange-ftp.el @ 25923:dcafaf809fac
Require dired when compiling.
(ange-ftp-normal-login): Allow EFS-style port specification.
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 08 Oct 1999 11:44:38 +0000 |
parents | b245d837503b |
children | fb6b9c37cdc4 |
comparison
equal
deleted
inserted
replaced
25922:919a9742fa00 | 25923:dcafaf809fac |
---|---|
48 ;; Extended filename syntax: | 48 ;; Extended filename syntax: |
49 ;; | 49 ;; |
50 ;; The default extended filename syntax is '/user@host:name', where the | 50 ;; The default extended filename syntax is '/user@host:name', where the |
51 ;; 'user@' part may be omitted. This syntax can be customised to a certain | 51 ;; 'user@' part may be omitted. This syntax can be customised to a certain |
52 ;; extent by changing ange-ftp-name-format. There are limitations. | 52 ;; extent by changing ange-ftp-name-format. There are limitations. |
53 ;; The `host' part has an optional suffix `#port' which may be used to | |
54 ;; specify a non-default port number for the connexion. | |
53 ;; | 55 ;; |
54 ;; If the user part is omitted then ange-ftp generates a default user | 56 ;; If the user part is omitted then ange-ftp generates a default user |
55 ;; instead whose value depends on the variable ange-ftp-default-user. | 57 ;; instead whose value depends on the variable ange-ftp-default-user. |
56 | 58 |
57 ;; Passwords: | 59 ;; Passwords: |
477 ;; | 479 ;; |
478 ;; ange-ftp has its own mailing list modestly called ange-ftp-lovers. All | 480 ;; ange-ftp has its own mailing list modestly called ange-ftp-lovers. All |
479 ;; users of ange-ftp are welcome to subscribe (see below) and to discuss | 481 ;; users of ange-ftp are welcome to subscribe (see below) and to discuss |
480 ;; aspects of ange-ftp. New versions of ange-ftp are posted periodically to | 482 ;; aspects of ange-ftp. New versions of ange-ftp are posted periodically to |
481 ;; the mailing list. | 483 ;; the mailing list. |
482 ;; | 484 |
485 ;; [The following information about lists may be obsolete.] | |
486 | |
483 ;; To [un]subscribe to ange-ftp-lovers, or to report mailer problems with the | 487 ;; To [un]subscribe to ange-ftp-lovers, or to report mailer problems with the |
484 ;; list, please mail one of the following addresses: | 488 ;; list, please mail one of the following addresses: |
485 ;; | 489 ;; |
486 ;; ange-ftp-lovers-request@anorman.hpl.hp.com | 490 ;; ange-ftp-lovers-request@anorman.hpl.hp.com |
487 ;; or | 491 ;; or |
498 ;; | 502 ;; |
499 ;; Alternatively, there is a mailing list that only gets announcements of new | 503 ;; Alternatively, there is a mailing list that only gets announcements of new |
500 ;; ange-ftp releases. This is called ange-ftp-lovers-announce, and can be | 504 ;; ange-ftp releases. This is called ange-ftp-lovers-announce, and can be |
501 ;; subscribed to by e-mailing to the -request address as above. Please make | 505 ;; subscribed to by e-mailing to the -request address as above. Please make |
502 ;; it clear in the request which mailing list you wish to join. | 506 ;; it clear in the request which mailing list you wish to join. |
503 | |
504 ;; The latest version of ange-ftp can usually be obtained via anonymous ftp | |
505 ;; from: | |
506 ;; alpha.gnu.ai.mit.edu:ange-ftp/ange-ftp.tar.Z | |
507 ;; or: | |
508 ;; ugle.unit.no:/pub/gnu/emacs-lisp/ange-ftp.tar.Z | |
509 ;; or: | |
510 ;; archive.cis.ohio-state.edu:pub/gnu/emacs/elisp-archive/packages/ange-ftp.tar.Z | |
511 | 507 |
512 ;; The archives for ange-ftp-lovers can be found via anonymous ftp under: | 508 ;; The archives for ange-ftp-lovers can be found via anonymous ftp under: |
513 ;; | 509 ;; |
514 ;; ftp.reed.edu:pub/mailing-lists/ange-ftp/ | 510 ;; ftp.reed.edu:pub/mailing-lists/ange-ftp/ |
515 | 511 |
621 ;;; Code: | 617 ;;; Code: |
622 | 618 |
623 (require 'comint) | 619 (require 'comint) |
624 ;; Silence compiler: | 620 ;; Silence compiler: |
625 (eval-when-compile | 621 (eval-when-compile |
622 (require 'dired) | |
626 (defvar comint-last-output-start nil) | 623 (defvar comint-last-output-start nil) |
627 (defvar comint-last-input-start nil) | 624 (defvar comint-last-input-start nil) |
628 (defvar comint-last-input-end nil)) | 625 (defvar comint-last-input-end nil)) |
629 | 626 |
630 ;;;; ------------------------------------------------------------ | 627 ;;;; ------------------------------------------------------------ |
2035 (concat "USER request failed: " | 2032 (concat "USER request failed: " |
2036 (cdr result))))))) | 2033 (cdr result))))))) |
2037 | 2034 |
2038 (defun ange-ftp-normal-login (host user pass account proc) | 2035 (defun ange-ftp-normal-login (host user pass account proc) |
2039 "Connect to the FTP-server on HOST as USER using PASSWORD and ACCOUNT. | 2036 "Connect to the FTP-server on HOST as USER using PASSWORD and ACCOUNT. |
2040 PROC is the process to the FTP-client." | 2037 PROC is the process to the FTP-client. HOST may have an optional |
2041 (let* ((nshost (ange-ftp-nslookup-host host)) | 2038 suffix of the form #PORT to specify a non-default port" |
2042 (result (ange-ftp-raw-send-cmd | 2039 (save-match-data |
2043 proc | 2040 (string-match "^\\([^#]+\\)\\(#\\([0-9]+\\)\\)?\\'" host) |
2044 (format "open %s" nshost) | 2041 (let* ((nshost (ange-ftp-nslookup-host (match-string 1 host))) |
2045 (format "Opening FTP connection to %s" host)))) | 2042 (port (match-string 3 host)) |
2046 (or (car result) | 2043 (result (ange-ftp-raw-send-cmd |
2047 (ange-ftp-error host user | 2044 proc |
2048 (concat "OPEN request failed: " | 2045 (if port |
2049 (cdr result)))) | 2046 (format "open %s %s" nshost port) |
2050 (setq result (ange-ftp-raw-send-cmd | 2047 (format "open %s" nshost)) |
2051 proc | 2048 (format "Opening FTP connection to %s" host)))) |
2052 (if (and (ange-ftp-use-smart-gateway-p host) | 2049 (or (car result) |
2053 ange-ftp-gateway-host) | |
2054 (format "user \"%s\"@%s %s %s" user nshost pass account) | |
2055 (format "user \"%s\" %s %s" user pass account)) | |
2056 (format "Logging in as user %s@%s" user host))) | |
2057 (or (car result) | |
2058 (progn | |
2059 (ange-ftp-set-passwd host user nil) ;reset password. | |
2060 (ange-ftp-set-account host user nil) ;reset account. | |
2061 (ange-ftp-error host user | 2050 (ange-ftp-error host user |
2062 (concat "USER request failed: " | 2051 (concat "OPEN request failed: " |
2063 (cdr result))))))) | 2052 (cdr result)))) |
2053 (setq result (ange-ftp-raw-send-cmd | |
2054 proc | |
2055 (if (and (ange-ftp-use-smart-gateway-p host) | |
2056 ange-ftp-gateway-host) | |
2057 (format "user \"%s\"@%s %s %s" user nshost pass account) | |
2058 (format "user \"%s\" %s %s" user pass account)) | |
2059 (format "Logging in as user %s@%s" user host))) | |
2060 (or (car result) | |
2061 (progn | |
2062 (ange-ftp-set-passwd host user nil) ;reset password. | |
2063 (ange-ftp-set-account host user nil) ;reset account. | |
2064 (ange-ftp-error host user | |
2065 (concat "USER request failed: " | |
2066 (cdr result)))))))) | |
2064 | 2067 |
2065 ;; ange@hplb.hpl.hp.com says this should not be changed. | 2068 ;; ange@hplb.hpl.hp.com says this should not be changed. |
2066 (defvar ange-ftp-hash-mark-msgs | 2069 (defvar ange-ftp-hash-mark-msgs |
2067 "[hH]ash mark [^0-9]*\\([0-9]+\\)" | 2070 "[hH]ash mark [^0-9]*\\([0-9]+\\)" |
2068 "*Regexp matching the FTP client's output upon doing a HASH command.") | 2071 "*Regexp matching the FTP client's output upon doing a HASH command.") |