From: Kai Gro?j. <ka...@us...> - 2002-05-19 21:30:19
|
Update of /cvsroot/tramp/tramp/lisp In directory usw-pr-cvs1:/tmp/cvs-serv29469/tramp/lisp Modified Files: ChangeLog tramp.el Log Message: * tramp.el (tramp-send-linewise): New function. (tramp-post-connection): Use it for sending long strings. Index: ChangeLog =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/ChangeLog,v retrieving revision 2.97 retrieving revision 2.98 diff -C2 -d -r2.97 -r2.98 *** ChangeLog 14 Apr 2002 15:52:38 -0000 2.97 --- ChangeLog 19 May 2002 21:30:15 -0000 2.98 *************** *** 1,2 **** --- 1,12 ---- + 2002-05-19 Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> + + * tramp.el (tramp-send-linewise): New function. + (tramp-post-connection): Use it for sending long strings. + + 2002-04-16 Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> + + * tramp.el (tramp-shell-quote-argument): Todo item: don't use + `shell-quote-argument'. + 2002-04-14 Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> Index: tramp.el =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v retrieving revision 2.97 retrieving revision 2.98 diff -C2 -d -r2.97 -r2.98 *** tramp.el 14 Apr 2002 15:52:38 -0000 2.97 --- tramp.el 19 May 2002 21:30:15 -0000 2.98 *************** *** 4038,4047 **** (when tramp-remote-perl (tramp-message 5 "Sending the Perl `file-attributes' implementation.") ! (tramp-send-command multi-method method user host ! (concat "tramp_file_attributes () {" tramp-rsh-end-of-line tramp-remote-perl ! " -e '" tramp-perl-file-attributes "' $1 2>/dev/null" ! tramp-rsh-end-of-line "}")) (tramp-wait-for-output) --- 4038,4046 ---- (when tramp-remote-perl (tramp-message 5 "Sending the Perl `file-attributes' implementation.") ! (tramp-send-linewise multi-method method user host ! (concat "tramp_file_attributes () {\n" tramp-remote-perl ! " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" "}")) (tramp-wait-for-output) *************** *** 4049,4055 **** "tramp_mimencode") (tramp-message 5 "Sending the Perl `mime-encode' implementation.") ! (tramp-send-command multi-method method user host ! (concat "tramp_mimencode () {" tramp-rsh-end-of-line (if (tramp-find-executable multi-method method user host "mimencode" tramp-remote-path t) --- 4048,4054 ---- "tramp_mimencode") (tramp-message 5 "Sending the Perl `mime-encode' implementation.") ! (tramp-send-linewise multi-method method user host ! (concat "tramp_mimencode () {\n" (if (tramp-find-executable multi-method method user host "mimencode" tramp-remote-path t) *************** *** 4057,4069 **** (concat tramp-remote-perl " -e '" tramp-perl-mime-encode "' $1 2>/dev/null")) ! tramp-rsh-end-of-line ! "}")) (tramp-wait-for-output)) (when (string= (tramp-get-decoding-command multi-method method) "tramp_mimedecode") (tramp-message 5 "Sending the Perl `mime-decode' implementation.") ! (tramp-send-command multi-method method user host ! (concat "tramp_mimedecode () {" tramp-rsh-end-of-line (if (tramp-find-executable multi-method method user host "mimencode" tramp-remote-path t) --- 4056,4067 ---- (concat tramp-remote-perl " -e '" tramp-perl-mime-encode "' $1 2>/dev/null")) ! "\n}")) (tramp-wait-for-output)) (when (string= (tramp-get-decoding-command multi-method method) "tramp_mimedecode") (tramp-message 5 "Sending the Perl `mime-decode' implementation.") ! (tramp-send-linewise multi-method method user host ! (concat "tramp_mimedecode () {\n" (if (tramp-find-executable multi-method method user host "mimencode" tramp-remote-path t) *************** *** 4071,4076 **** (concat tramp-remote-perl " -e '" tramp-perl-mime-decode "' $1 2>/dev/null")) ! tramp-rsh-end-of-line ! "}")) (tramp-wait-for-output))))) ;; Find ln(1) --- 4069,4073 ---- (concat tramp-remote-perl " -e '" tramp-perl-mime-decode "' $1 2>/dev/null")) ! "\n}")) (tramp-wait-for-output))))) ;; Find ln(1) *************** *** 4140,4143 **** --- 4137,4170 ---- (concat command tramp-rsh-end-of-line)))) + ;; It seems that Tru64 Unix does not like it if long strings are sent + ;; to it in one go. (This happens when sending the Perl + ;; `file-attributes' implementation, for instance.) Therefore, we + ;; have this function which waits a bit at each line. + (defun tramp-send-linewise + (multi-method method user host string &optional noerase) + "Send the STRING to USER at HOST linewise. + Erases temporary buffer before sending the STRING (unless NOERASE + is true). + + The STRING is expected to use Unix line-endings, but the lines sent to + the remote host use line-endings as defined in the variable + `tramp-rsh-end-of-line'." + (tramp-maybe-open-connection multi-method method user host) + (when tramp-debug-buffer + (save-excursion + (set-buffer (tramp-get-debug-buffer multi-method method user host)) + (goto-char (point-max)) + (tramp-insert-with-face 'bold (format "$ %s\n" string)))) + (let ((proc nil) + (lines (split-string string "\n"))) + (set-buffer (tramp-get-buffer multi-method method user host)) + (unless noerase (erase-buffer)) + (setq proc (get-buffer-process (current-buffer))) + (mapcar (lambda (x) + (sit-for 0.001) + (process-send-string proc + (concat x tramp-rsh-end-of-line))) + lines))) + (defun tramp-wait-for-output (&optional timeout) "Wait for output from remote rsh command." *************** *** 4851,4854 **** --- 4878,4885 ---- ;; Thanks to Mario DeWeerd for the hint that it is sufficient for this ;; function to work with Bourne-like shells. + ;; + ;; CCC: This function should be rewritten so that + ;; `shell-quote-argument' is not used. This way, we are safe from + ;; changes in `shell-quote-argument'. (defun tramp-shell-quote-argument (s) "Similar to `shell-quote-argument', but groks newlines. *************** *** 4992,4995 **** --- 5023,5028 ---- ;;; TODO: + ;; * Rewrite `tramp-shell-quote-argument' to abstain from using + ;; `shell-quote-argument'. ;; * Completion gets confused when you leave out the method name. ;; * Support `dired-compress-file' filename handler. |