From: David Kastrup Date: Thu, 02 Aug 2007 10:31:25 GMT Subject: Re: Interpreting EDITOR/VISUAL environment variables. Message-ID: <86fy32kz2a.fsf@lola.quinscape.zz> In-Reply-To: <20070802101056.GA31182@moooo.ath.cx> Matthias Lederhofer writes: > David Kastrup wrote: >> a) Using system and shell-quoting the filename. Advantage: one can >> set EDITOR='"/home/dak/My Programs/editor"' and have it work. >> Disadvantage: shell-quoting a file name seems shell- and >> system-dependent. Actually I was talking C here, and the editor is never called from C in git but rather from the shell. So this problem is a non-problem for us. > What about this instead of quoting the argument? > > sh -c '$EDITOR "$1" "$2"' editor +5 /path/to/file > > (i.e. for C execvp("/bin/sh", "-c", "$EDITOR \"$1\" \"$2\"", "editor", > "+5", "/path/to/file")) It suffers from the fault that it does not work as far as I can see. -c does not set the positional parameters. -- David Kastrup