Function: ange-ftp-shell-command

ange-ftp-shell-command is a byte-compiled function defined in ange-ftp.el.gz.

Signature

(ange-ftp-shell-command COMMAND &optional OUTPUT-BUFFER ERROR-BUFFER)

Source Code

;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
;; This is the handler for shell-command.
(defun ange-ftp-shell-command (command &optional output-buffer error-buffer)
  (let* ((parsed (ange-ftp-ftp-name default-directory))
	 (host (nth 0 parsed))
	 (name (nth 2 parsed)))
    (if (not parsed)
	(ange-ftp-real-shell-command command output-buffer error-buffer)
      (if (> (length name) 0)		; else it's $HOME
	  (setq command (concat "cd " name "; " command)))
      ;; Remove port from the hostname
      (when (string-match "\\(.*\\)#" host)
	(setq host (match-string 1 host)))
      (setq command
	    (format  "%s %s \"%s\""	; remsh -l USER does not work well
					; on a hp-ux machine I tried
		     remote-shell-program host command))
      (ange-ftp-message "Remote command `%s' ..." command)
      ;; Cannot call ange-ftp-real-dired-run-shell-command here as it
      ;; would prepend "cd default-directory" --- which bombs because
      ;; default-directory is in ange-ftp syntax for remote file names.
      (ange-ftp-real-shell-command command output-buffer error-buffer))))