* Re: [9fans] So, do you space or not?
2002-07-06 16:23 [9fans] So, do you space or not? FJ Ballesteros
@ 2002-07-06 16:47 ` Sam
2002-07-06 23:04 ` arisawa
1 sibling, 0 replies; 5+ messages in thread
From: Sam @ 2002-07-06 16:47 UTC (permalink / raw)
To: 9fans
<warn>
Long winded e-mail follows.
</warn>
I've only just jumped onto this thread and since I didn't
want to repeat anything, I googled up the chain that started
this (back on may 30th!). I may have missed part of it,
so if I'm restating anything or being terribly obvious,
forgive me. Here's my 2 cents:
I've become familiar with quoted arguments as in my CLIs
the following is typical (where val is some value containing
spaces).
cli> set param 'val'
I have a little function that breaks up the line
into an argc & argv, similarly as I presume a shell
would. Fairly simple, though I don't consider escape sequences
or single quotes inside of an arg. I've been debating for
some time whether to modify the input read routine such that when
read in,
cli> set param0 'set param1 \'set param2 \'val\'\''
the args will look like this:
arg[0] == "set"
arg[1] == "param0"
arg[2] == "set param1 'set param2 \'val\''"
... essentially taking the outermost enclosed, escaped single quotes
and unescaping them. It would obviously be fairly easy to do, but I've
yet to run into a use for it. Also an avenue is unescaping all the
quotes, as usual.
I presume that option (b) in the replied to e-mail considers "fixing"
programs such that if you output shell commands that require args
containing spaces, we enclose the arg in quotes. Easy enough with
%q. Since ' is a printable character, though, we run into inclusion
problems ... right? What happens when we want to name files by
ownership (ie: "Bob's file")? Does %q escape all ' inside the string
it's enclosing? (online man page for print is still from 3E; no 4E
for me just yet)
If we're going to try changing these programs for this purpose, why
not introduce a new format that outputs the string with spaces
escaped? The shell should handle this just fine, right?
ie (eg, z):
print("%z", "This is a file name");
results in:
This\ is\ a\ file\ name
There would be caveats with this as well (suppose we want to print
"this\ is\ a\ file\ name"), but is no more complex than the proposed
' solution.
It just doesn't seem like we've arrived at a decent solution yet. Until
we find one, I'm going to have to vote a (or perhaps d, if no one has
tomatoes handy).
Am I way off?
Cheers,
Sam
On Sat, 6 Jul 2002, FJ Ballesteros wrote:
>
> Just to know it, do you want to
>
> a) keep things as they are
> b) remove quoting from ls et al, add it to those that print commands,
> and
> fix those that don't cosider ' ' in file names.
> c) forbid space and rename blanks in servers
> d) Write poems
> e) None of the above
>
> Should you choose b or c, I may help.
>
> PS: Bad answers may discount points from your average.
>
^ permalink raw reply [flat|nested] 5+ messages in thread