[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] $EDITOR with spaces

From: Mark Benedetto King <bking_at_answerfriend.com>
Date: 2002-04-16 02:44:50 CEST

On Mon, Apr 15, 2002 at 06:36:13PM -0500, cmpilato@collab.net wrote:
> Daniel Stenberg <daniel@haxx.se> writes:
>
> > Ok, Branko quickly pointed out that commands may contain spaces and then my
> > patch of course breaks that badly...
> >
> > The old version works with spaces in the command, while my fix works with
> > space-separated options.
> >
> > I personally always tend to use "emacs -nw" in my $EDITOR...
> >
> > I don't know what the correct answer is. I'm off to bed! ;-)
>
> This may sound ridiculous, but I'm in a ridiculous sort of mood. :-)
> We *could* do a brute-force loop of sorts.
>
> command = <get command from env>
> loop:
> err = <run command>
> if <err means that command wasn't found> && <command has a space in it>
> while <command has spaces in it>
> <prepend stuff after the last space in command to the args list>
> <remove stuff after the last space in command from command>
> goto loop;
> end
> else
> return err;
>

This doesn't work if you have

/path/to/foo

and you want to have EDITOR="/path/to/foo dir/program arg1 arg2"

You need an escape mechanism. Like

"/path/to/foo\ dir/program arg1 arg2"

for example.

One way would be to make stringlist_to_array support escaped
spaces.

--ben

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 16 01:47:54 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.