9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: FJ Ballesteros <nemo@gsyc.escet.urjc.es>
To: 9fans@cse.psu.edu
Subject: [9fans] blanks already handled properly?
Date: Thu,  4 Jul 2002 16:53:45 +0200	[thread overview]
Message-ID: <3D246179.80AAB64F@gsyc.escet.urjc.es> (raw)


I may be going mad, but, isn't the space problem already solved?

We know that

1 file names may contain spaces, thus ' ' is a legal file name char.
2 spaces are used both as delimiters in command lines and as part of
file names.

1 just means that most programs using [^ \n\t]* as a regexp for a file
name
  should just use [^\n\t]* instead. For example, I tried in acme to
select
  "a b" and button-3 on it: nothing happen. Didn't look at the source
but
  probably acme stopped at the blank.

2 means that file formats should consider that ambiguity.

The shell, IMHO, is already happy with spaces (to my surprise). I tried
with something like:

	touch x 'a b' a2
	files=a*
	for (f in $files) echo $f
	script_that_prints_one_arg_per_line $files

it all worked fine. Thus the shell is already aware that
an already expanded name is just a name, and it doesn't
matter if it contains a ' '  (yes, don't laught, I learned this today).
The use of lists in rc is a good thing, now I know.

So, isn't the answer just that
1. all programs must consider ' ' as a valid char while scanning for
names
   (like the shell already seems to do).
2. [file] formats must be chosen so that they are not ambiguous if file
   names contained on them contain blanks.
3. programs not outputing commands don't need to quote the printed names
4. programs outputing commands  need to quote the printed names.

All this would require is just Rob's %q and a shell q command to
do things like
touch x 'a b' a2
files=a*
for (f in $files) echo cp `{q $f} /other/place/`{q $f}

 [ But note that this other line works without requiring quoting:
	for (f in $files) cp $f /other/place/$f          ]

In case this solves the problem, we would only have to search for
programs that don't handle ' ' within file names and fix them; then
remove quoting from the output of programs that do not output commands;
then add quoting to the output of programs that output commands.

What do you say?


             reply	other threads:[~2002-07-04 14:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-04 14:53 FJ Ballesteros [this message]
2002-07-04 23:29 Geoff Collyer
2002-07-05  7:52 Fco.J.Ballesteros
2002-07-05  8:14 Fco.J.Ballesteros
2002-07-05  9:02 ` arisawa
2002-07-05  9:22 okamoto

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=3D246179.80AAB64F@gsyc.escet.urjc.es \
    --to=nemo@gsyc.escet.urjc.es \
    --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).