rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: culliton@srg.af.mil (Tom Culliton x2278)
To: rc@hawkwind.utcs.toronto.edu
Subject: Thoughts on a builtin read
Date: Mon, 20 Sep 1993 18:11:51 -0400	[thread overview]
Message-ID: <9309201811.aa08861@ceres.srg.af.mil> (raw)

After all the recent discussion about builtin read, it is starting to
sound like something that will happen, at the very least as a common
addon.  Given this, it's time to examine the design options and try to
come up with something reasonable.  After a bit of thought I came up
with the following:

To keep things in the spirit of rc, simplicity should be our guiding
principle.  This shapes most of the design decisions discussed below.

1) One string rather than IFS seperation of fields
	- simplicity
	- preserves information, such as runs of blanks
	- field splitting can always be done later with backquote:
		read x;x=(`{echo -- $x})

2) Single variable rather than multiple variables
	- simplicity
	- you can always split the fields as above and use subscripts

3) Good behaviour on EOF.
	- return 1 on EOF, 0 otherwise
	- save any text on the line before EOF

4) Should strip the newline
	- This makes "read x;echo -- $x" work right.

5) Doesn't honor \ at EOL for continuation
	- simplicity

6) If interactive and compiled with readline, use that to get input.
	- consistency

Aside from the last item, Alan Watson has already presented what looks
like a reasonable implementation way back on May 17th of this year. (It
could be packaged a bit better to fit in with the current addon scheme
and be easier to install.) The case for a builtin read could be much
better evaluated if some folks would try his version and report back on
their experiances.

Tom

PS - with Alan's permission I'll repackage his read routine as a proper
patch so it's easier to try.  Alan?


             reply	other threads:[~1993-09-20 22:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-20 22:11 Tom Culliton x2278 [this message]
1993-09-21  6:51 malte
1993-09-21 14:19 ` Chris Siebenmann
1993-09-21 14:20 rsalz
1993-09-21 14:33 malte
1993-09-21 15:09 rsalz
1993-09-21 15:15 Alan Watson
1993-09-21 15:54 Tom Culliton x2278
1993-09-21 15:56 malte
1993-09-21 17:02 ` Chris Siebenmann
1993-09-21 16:36 Byron Rakitzis
1993-09-21 16:50 ` Chris Siebenmann
1993-09-21 16:52 gjv%atlas%cesar
1993-09-21 16:58 Arnold Robbins
1993-09-21 17:11 rsalz
1993-09-21 17:26 Arnold Robbins
1993-09-22 17:18 Steve_Kilbane

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=9309201811.aa08861@ceres.srg.af.mil \
    --to=culliton@srg.af.mil \
    --cc=rc@hawkwind.utcs.toronto.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).