/[meta-cvs]/meta-cvs/F-26DCA2B7859BC31F50F2B5ABA0AB6950.lisp
ViewVC logotype

Contents of /meta-cvs/F-26DCA2B7859BC31F50F2B5ABA0AB6950.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Sat Nov 16 20:05:26 2002 UTC (11 years, 5 months ago) by kaz
Branch: MAIN
CVS Tags: mcvs-1-0-3
Changes since 1.4: +4 -1 lines
* code/posix.lisp (invoke-editor-on): Honor the CVSEDITOR and VISUAL
environment variables, not just EDITOR.
1 ;;; This source file is part of the Meta-CVS program,
2 ;;; which is distributed under the GNU license.
3 ;;; Copyright 2002 Kaz Kylheku
4
5 (require "split")
6 (require "execute")
7 (require "mcvs-package")
8 (provide "unix")
9
10 (in-package "META-CVS")
11
12 (defvar *mcvs-editor* nil)
13
14 (defun arglist-to-command-string (arglist)
15 "Convert list of strings, assumed to be an argument vector, into
16 a single command string that can be submitted to a POSIX command
17 interpreter. This requires escaping of all shell meta-characters."
18 (let ((command (make-array '(1024)
19 :element-type 'character
20 :adjustable t
21 :fill-pointer 0)))
22 (dolist (arg arglist command)
23 (dotimes (i (length arg))
24 (let ((ch (char arg i)))
25 (when (find ch #(#\' #\" #\* #\[ #\] #\?
26 #\$ #\{ #\} #\" #\space #\tab
27 #\( #\) #\< #\> #\| #\; #\&))
28 (vector-push-extend #\\ command))
29 (vector-push-extend ch command)))
30 (vector-push-extend #\space command))))
31
32 (defun invoke-editor-on (name)
33 (let ((editor (or *mcvs-editor*
34 (env-lookup "CVSEDITOR")
35 (env-lookup "VISUAL")
36 (env-lookup "EDITOR" "vi"))))
37 (execute-program `(,editor ,name))))

  ViewVC Help
Powered by ViewVC 1.1.5