9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Sam <sah@coraid.com>
To: <9fans@cse.psu.edu>
Subject: Re: [9fans] So, do you space or not?
Date: Sat,  6 Jul 2002 12:47:35 -0400	[thread overview]
Message-ID: <Pine.LNX.4.30.0207061142190.14295-100000@athena> (raw)
In-Reply-To: <3D271964.48FB0D81@gsyc.escet.urjc.es>

<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.
>



  reply	other threads:[~2002-07-06 16:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-06 16:23 FJ Ballesteros
2002-07-06 16:47 ` Sam [this message]
2002-07-06 23:04 ` arisawa
2002-07-06 23:24   ` arisawa
2002-07-08  9:04 Fco.J.Ballesteros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.30.0207061142190.14295-100000@athena \
    --to=sah@coraid.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).