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: Command execution
Date: Wed, 24 Jun 1992 15:10:38 -0400	[thread overview]
Message-ID: <9206241510.aa06947@ceres.srg.af.mil> (raw)

Heres a minor annoyance/inconsistency with Byron's rc that I noticed
way back when I first started using it but never bugged me until now.

Tom Duff[1] says that in executing commands rc first looks for a
function of the given name, then a builtin commands, then if the name
CONTAINS a '/' it is taken as a path to an executeable, otherwise it 
searchs for an executable of that name using the path.

This implies a couple of things which I believe are desirable.  First,
the function: "fn csh /bin/csh { echo 'You''ve got to be kidding!' }"
should be a legitimate and useful definition.  If you really want to
get to csh you can still say "builtin csh".  (Unless of course builtin
has been overloaded...)  Currently "/bin/csh" will not invoke the
function.

Second, the commands "./bin/thingee" and "bin/thingee" should be
treated consistently, and not behave differently, based on the path or
function definitions.  Currently if you remove "." from your path
"bin/thingee" will not be treated as a path name, and "bin/thingee"
will invoke a function but "./bin/thingee" will not.)

Unfortunately Byron[2] changed these rules somewhat, so that his rc
FIRST checks if the command STARTS with "/", "./", or "../" in which
case it is taken as a path to an executeable, before going on to check
functions, builtins and the path.  This means that the function
"/bin/csh" will never be seen and that "./bin/thingee" is quite
different from "bin/thingee".

"Fixing" this should be trivial, in the one case changing the order of
checks and in the other checking using strchr(cmdname, '/').  However I
assume Byron had a reason for this.  Any comments?

Tom

[1] "Rc - A Shell for Plan 9 and Unix Systems", page 6, section 17 
[2] "RC(1)" (Byron's man page), page 1, section "Commands"


             reply	other threads:[~1992-06-24 19:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-06-24 19:10 Tom Culliton x2278 [this message]
1992-06-24 20:19 ` Chris Siebenmann
1992-06-24 21:19 Tom Culliton x2278
1992-06-24 23:04 ` David Moore
1992-06-25 21:22 ` Chris Siebenmann
1992-06-25 21:56 Tom Culliton x2278

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=9206241510.aa06947@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).