Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!rutgers!labrea!rocky!andy
From: andy@rocky.STANFORD.EDU (Andy Freeman)
Newsgroups: comp.unix.wizards
Subject: Command interfaces
Message-ID: <798@rocky.STANFORD.EDU>
Date: Thu, 3-Dec-87 20:34:24 EST
Article-I.D.: rocky.798
Posted: Thu Dec  3 20:34:24 1987
Date-Received: Tue, 8-Dec-87 05:39:10 EST
References: <1257@boulder.Colorado.EDU> <6840002@hpcllmv.HP.COM> <9555@mimsy.UUCP> <6774@brl-smoke.ARPA> <337@cresswell.quintus.UUCP>
Reply-To: andy@rocky.UUCP (Andy Freeman)
Organization: Stanford University Computer Science Department
Lines: 61

In article <337@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>In article <1890@celtics.UUCP> roger@celtics.UUCP (Roger B.A. Klorese) writes:
>> >Because, unless one knows and fully understands that globbing is done by
>> >the shell and not the program, one would expect, as with other operating
>> >systems...

>In article <6774@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes:
>> In fact that is a key "win" of UNIX over OSes that make applications deal
>> with globbing.

>Have you ever used TOPS-10?  That was a system where globbing was done by
>the program, not the shell.  Result?  No two programs had exactly the
>same syntax for file names (some would let you quote strange characters
>by writing octal, some wouldn't, some allowed directories, some didn't,
>&c &c).  And of course user-programs and commands HAD to use different
>syntax...  Doug Gwyn is absolutely right:  doing file-name expansion in
>the shell so that EVERY command does it EXACTLY the same way is wonderful.

Have you ever used TOPS-20?  That was a system that provided a command
interface that was used by most programs.  (There's an emulation package
that lets tops-10 programs run under tops-20; those programs don't use
the interface.)  The result - every program, not just the shell, parses
arguments in the same way.  Every program has recognition and expansion
not only for file names, but other kinds of arguments as well.  Every
program has abbreviations (these can be defeated by the program if
necessary - you can make users type out "destructive" commands in
completely).  Every program will tell you what it's expecting and can
provide defaults, overridable of course, that it will tell you about.
Line editing commands know that different kinds of arguments have different
structure so they do the right thing, and this works the same way for
every program.  Expansion to multiple file names in TOPS-20 isn't done
the way unix it, but thanks to the command parser and the file system
interface, every program does it exactly the same way.

TOPS-20 shares one of unix' big failures - the command parser doesn't
know what arguments other programs expect so it can't parse them
for you.  Therefore, many things that are unix programs, rm, e.g.,
are part of the standard command shell.  Many programs will take
their arguments off the command line, where you can't take advantage
of the parser, or prompt for them directly, where you can.  It would
be much easier to add the capability to do this right (so the user
can take advantage of the parser either way) in TOPS-20 than it would
be to add it to unix.  It could be done by modifying the command parser
so that it would work with every TOPS-20 program.  (They wouldn't even
have to be recompiled.)

True, TOPS-20 is inadequate in many ways.  It isn't portable.  No one
ever wrote a decent shell-like programming language for it (but the
ones that were written used the command interface for their programs).
The standard command shell doesn't know about I/O redirection (even
though the operating system supports it) so most programs aren't written
in a way that would take advantage of it.  There isn't a good systems
programming environment.  (This is sometimes an advantage.  Unix makes
it easy for any fool to write a program and many of them do.)

-andy
-- 
Andy Freeman
UUCP:  {arpa gateways, decwrl, sun, hplabs, rutgers}!sushi.stanford.edu!andy
ARPA:  andy@sushi.stanford.edu
(415) 329-1718/723-3088 home/cubicle