Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!husc6!think!barmar
From: barmar@think.UUCP
Newsgroups: comp.unix.wizards
Subject: Re: more rm insanity
Message-ID: <12726@think.UUCP>
Date: Thu, 3-Dec-87 23:16:22 EST
Article-I.D.: think.12726
Posted: Thu Dec  3 23:16:22 1987
Date-Received: Sun, 6-Dec-87 21:14:24 EST
References: <1257@boulder.Colorado.EDU> <6840002@hpcllmv.HP.COM>
Sender: usenet@think.UUCP
Reply-To: barmar@sauron.UUCP (Barry Margolin)
Organization: Thinking Machines Corporation, Cambridge, MA
Lines: 57

In article <1895@celtics.UUCP> roger@celtics.UUCP (Roger B.A. Klorese) writes:
>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 Multics or PRIMOS?  The decision of which types of
>pattern matches are expanded by the command interpreter and which by the
>program can be set in the linking process.

Not QUITE correct, at least in the Multics case.  Wildcards are never
interpreted by the command processor.  If a command wishes to treat an
argument as a pathname it calls expand_pathname_ on it (this
translates relative paths to absolute paths, as the system calls only
accept absolute paths) and if wildcard expansion is appropriate then
it calls hcs_$star_ (or one of a few variants).

To Roger:
If TOPS-10 doesn't provide a library that allows all commands to
operate consistently, that is a TOPS-10 problem, but don't assume that
all systems that don't expand in the shell are just like TOPS-10.

You complained about some programs allowing directories and some not.
On both Unix and Multics users are required to use different commands
to delete files and directories.  It would make sense that in "rm *"
the * should not match directories, and "rmdir *" should not match
files.

I know this isn't really a good answer, but on Multics it is possible
to make any command that doesn't accept wildcards do so, using command
line functions.  If a command doesn't do wildcard processing, you can
do:
	command [files ]

(the [...] syntax on Multics is similar to Unix's `...`); the files
function returns the pathnames of files that match the wildcard.  Yes,
I realize that this can be done on Unix using `find ...`.

---
Barry Margolin
Thinking Machines Corp.

barmar@think.com
seismo!think!barmar