Path: utzoo!attcan!uunet!husc6!mailrus!wasatch!uplherc!wicat!landru!gsarff From: gsarff@landru.UUCP (Gary Sarff) Newsgroups: comp.sys.amiga Subject: Re: AmigaDos vs Unix wildcards/pathnames Message-ID: <00150@landru.UUCP> Date: 17 Mar 89 21:56:08 GMT References: <600@jc3b21.UUCP>,<6235@cbmvax.UUCP> Organization: Programmers in Exile Lines: 88 In article <600@jc3b21.UUCP> fgd3@jc3b21.UUCP (Fabbian G. Dufoe) >From article <6235@cbmvax.UUCP>, by daveh@cbmvax.UUCP (Dave Haynie): >> [discussion of AmigaDOS versus Unix wild card styles deleted.] >> That's a detail of the AmigaDOS copy program, not the wild card system. > > I think this is the real problem with the way AmigaDOS handles wild >cards. Instead of building the pattern matching code into each command I'd >like to see filename patterns expanded by the shell, as in Unix. The shell >would then pass the appropriate arguments to the commands, providing the >user with a standard, consistent way to specify a filename pattern for >every command. > You could have a standard consistent way to use wildcards with commands with the wildcarding code built in to each one if they would all use THE SAME method, i.e. a linkable library routine that all the programmers who write the utilities must use. I am using an operating system that does this, so that the utilities expand the wildcards themselves instead of the shell. One problem I DO NOT have that UNIX utilities do is that I can wildcard a huge number of files, my entire hard disk say and not worry about huge command line lengths. You run into this on many Unix systems that are running Usenet News, go to some directory like /usr/spool/news/talk/politics (or maybe comp.sys.amiga on a busy week 8-) and do a grep Subject: * or something and watch the thing tell you "command line too long". So, all the nice Unix utilities that you wanted to wildcard won't work anymore because the shell can't build the whole command line, now you are well and stuck unless you want to write a shell script to do the files one at a time, (No I don't need other examples of how to do this, that isn't the point). On the other hand if the utilities do the expansion I can do grep Subject: /usr/spool/news/*/* i.e. grep all files in all subdirectories, how long do you think the command line for that would be if the shell put each file name on grep's command line, complete with directory path? The OS I am using has the utilities all written using the same routines to expand wildcards, to retrieve command line arguments, etc. So that ALL utilities act in the same way. Command line arguments can be positional, or keyword or both, and can be switches or values, the syntax is that switches (boolean, or value) start with a colon (:), followed by the alphabetic characters making up the switch, such as del /.*/*.c :exclude=abs.c,sub.c :before=20-mar-1989_08:00:00 :auto where :exclude= is a value switch, i.e. a list of values follows the switch. :auto is a boolean switch, only :auto or :noauto are acceptable. :auto means do not prompt for operator verification, just delete the files. :Noauto would be the same as not using the Auto switch at all. But it would do what the user expects if they were strange enough to use it. It all means delete all the files in all subdirectories of the current dir, with extensions of .c that were created on or before 20th march etc, EXCEPT the two files abs.c and sub.c, and DO NOT ask me if I am sure I want to delete them. The great thing to me about these routines is that they are quite flexible, with unambiguous switch completion. So I wouldn't have to spell out :exclude, I could just say :excl or maybe :ex or even :e if no other arguments for this command start with :e. Also the command line parsing routine, which calls the wildcard expansion routines and the argument parsing routines allows you to place things in any order that pleases you, something not possible really on the Amiga. So I could have as easily have said del :exclude=abs.c,sub.c /.*/*.c :auto :before=20-mar-1989_08:00:00 or any of the other possible variations of position and shortening of :exclude, :before, and :auto switch names. Interspersed with switches and file wildcards I can redirect I/O with < and > symbols, on the Amiga as of now we have to put these right after the command name if we are going to use them at all, in the above example they could have been put anywhere on the line and the < and > need not be consecutive arguments either. The shell will find them, open the needed I/O channels and remove them from the command line so that the argument numbers that the program sees will not include them at all. Since these routines are used in all utilities, any command that says it will allow file wildcarding, will let me used things like /.*/* and :exclude,:before, :since, etc, etc. because the routines are the same in each utility. Of course they could be in the shell and it could do all this but some wildcard directives could be complicated and this delays program start up. Seems on the Amiga this would be ideal for a shared library. This behaviour is something that both Amigados and Unix are sadly lacking in. They both look like their utilities were designed by many different people over time who didn't talk to each other and so we get this mishmash of command characteristics, in Unix some commands want files then -'ed switches, others the switches first, then the file names, some will process a directory tree, some won't, and so on, and no one really seems to care, they just say, "It's Unix, we can't change it", and I agree sort of, it's way too late for Unix to change. But on a new system one would hope that there would have been some consistency to the way things were done, and a little more power to the wildcarding too. Well enough ranting, blame it on my upbringing with a different OS. 8-) ----------------------------------------------------------------------------- "Do you have any Venezualan Beaver cheese?" -- The Cheese Shop, Monty Python I've often wondered why no one makes cheese from cat's milk?