Daniel Pittman writes:
 > On Thu, 3 Feb 2000, Gerd Bavendiek <[EMAIL PROTECTED]> wrote:
 > 
 > > I'm working as system admin. Very often I have to change config files
 > > on a couple of unix boxes. So I edit a local copy of e.g. /etc/hosts,
 > > copy the file to the targets and still have the master on my laptops
 > > disk.
 > 
 > [...]
 > 
 > > So it ends up in calling scp.
 > > 
 > > This is by no means really flexible. Sometimes I could use rcp instead
 > > of scp, which I couldn't manage to put in this schema.
 > > 
 > > I'm wondering whether rcp.el can be used in this scenario ...
 > 
 > Sure could. If you have rcp.el running, you can just call `copy-file'
 > for each place you want it to go, such as:
 > 
 > (copy-file "local.file" "/r@scp:host:/remote.file")
 > (copy-file "local.file" "/r@rcp:another.host:/remote.file")
 > 
 > That way you take advantage of the rcp support for many protocols when
 > transferring. Adapting this to your lisp is left as an exercise for the
 > reader ;)
 > 

Thanks a lot for your hints. So I did the exercise. Everything works
well as long as the file do not exist. The second copy fails:

Signaling: (file-already-exists "/r@rcp:root@momo:/root/ho")
  signal(file-already-exists ("/r@rcp:root@momo:/root/ho"))
  (progn (signal (quote file-already-exists) (list newname)))
)
  (if (file-exists-p newname) (progn (signal ... ...)))
)
  (when (file-exists-p newname) (signal (quote file-already-exists) (list newname)))
)
  (if ok-if-already-exists nil (when (file-exists-p newname) (signal ... ...)))
)
  (unless ok-if-already-exists (when (file-exists-p newname) (signal ... ...)))
)
  rcp-do-copy-file("/home/bav/tmp/ooo" "/r@rcp:root@momo:/root/ho" nil nil)
  (if (or (rcp-rcp-file-p file) (rcp-rcp-file-p newname)) (rcp-do-copy-file file 
newname ok-if-already-exists keep-date) (rcp-run-real-handler (quote copy-file) (list 
file newname ok-if-already-exists)))
)
  rcp-handle-copy-file("/home/bav/tmp/ooo" "/r@rcp:root@momo:ho")
  (while list (setq aktfil (car list)) (message "%s ..." (concat "scp -p " 
buffer-file-name " " aktfil)) (rcp-handle-copy-file buffer-file-name aktfil) (setq 
list (cdr list)))
)
  (lambda nil "Sichert den aktuellen Buffer und startet die Shell-Prozedur rcpbuf" 
(interactive) (save-buffer) (message "%s wurde gesichert" buffer-file-name) (setq list 
rcpbuf-todo) (while list (setq aktfil ...) (message "%s ..." ...) 
(rcp-handle-copy-file buffer-file-name aktfil) (setq list ...)) (message "rcpbuf 
beendet ..."))()
  call-interactively(save-buffer-and-rcp)
  command-execute(save-buffer-and-rcp t)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

I'm sorry for the lengthy output. This is what I did in my lisp
exercise:

  (while list
    (setq aktfil (car list))
    (message "%s ..." (concat "scp -p " buffer-file-name " " aktfil))
;    (sit-for 2)
    (rcp-handle-copy-file buffer-file-name aktfil)
    (setq list (cdr list)))


with e.g. these local variables in the file I want to copy:

# Local Variables:
# rcpbuf-todo: ("/r@rcp:root@momo:ho")
# End:

Any further hints would be very helpful for me. I'm really by no means
a lisp programmer, so the exercise turned out to be an adventure ...

Kind regards

Gerd

Reply via email to