Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!edcastle!yfcw14 From: yfcw14@castle.ed.ac.uk (K P Donnelly) Newsgroups: comp.lang.fortran Subject: Re: Command line arguements? Message-ID: <10756@castle.ed.ac.uk> Date: 2 Jun 91 16:32:16 GMT References: <1991May31.234623.7735@murdoch.acc.Virginia.EDU> <24885@lanl.gov> Organization: Edinburgh University Lines: 52 Here is my explanation for the trouble writing a program on Unix which acquires parameters from the command line but which doesn't need ugly quoting to stop the shell trying to do wildcarding on filenames:- Standard Unix does not have dynamic loading or shareable libraries or whatever you want to call it. So standard Unix does not have a "parameter acquisition mechanism" usable by all commands. Without shareable libraries, a parameter acquisition mechanism would probably add 100K or more to the size of every executable. One consequence of this is that every Unix command has its own command line syntax. There is very little consistency between commands, and most of them have a very primitive and non robust method of parameter acquisition (or "option" acquisition, since most parameters are called "options" on Unix). Another consequence is that commands depend on the shell to do an extremely primitive form of command line parsing. The shell knows nothing about the kind of parameters the command is expecting, so the kinds of things it does to the command line may be completely inappropriate. This is what is happening in the phone sm*th* example. The shell doesn't whether or not the "phone" command is expecting a filename parameter, so it just goes ahead and assumes that it is anyway. Contrast with this Edinburgh University's own operating system, EMAS, which has had dynamic linking at for a decade or more. It has a "parameter aquisition mechanism" (PAM) which all commands make use of. It is linked in at load time so it doesn't add to the size of executables. Commands like "cp" would tell PAM that they were expecting filename parameters - in fact possibly too filenames which which agree in their wildcarding, so cp dir1/* dir2/* would copy all files from directory dir1 to dir2. Commands like "phone" would not tell PAM that they were expecting a filename parameter, so "sm*th*" would not be interpreted as a set of filenames. No cumbersome quoting is necessary to switch off such interpretation. As well as that, parameter acquisition is much more user friendly. If the parameter is not of the type expected (e.g. a filename which is exists and is readable) then PAM issues a meaningful error message and reprompts the user for the parameter. Unfortunately Edinburgh University's EMAS operating system is disappearing exactly one year from now. They are moving over to Unix to be the same as everyone else. Does anyone know whether any kind of user friendly parameter acquisition mechanism is available for versions of Unix like SunOS which do have shareable libraries? Kevin Donnelly