[net.lang.c] Modern Arguments to main

david@ztivax.UUCP (03/05/86)

Modern Command Line Arguments

Soon, I hope, none of us will be working with command line oriented
systems.  The Mac (or more accurately, Xerox Star/Tajo/Viewpoint) user
interface is clearly preferable, in many ways.
                                    ^^^^

The current C argument "standard" for the entry point:

main(argc,argv)
int argc;
char **argv;
{ ...

is fine for command line oriented systems.  It is intuitive, and
therefore easy for programmers to quickly spec (in the mind) and
implement some tool.  All those neat UNIX tools we use came into being
because 1) they were easy to think of, and 2) they were easy to
implement.

As icon oriented systems become more widely used, perhaps the
main(argv,argc) standard should be re-thought.

Example:  You have an icon representing a program, and a window with
some text in it.  You want some part of the info to be passed to the
program.  Pass it as a) args in argv/argc (parse text with window
shell), B) pass as stdin, C) some new method.

David Smyth
seismo!unido!ztivax!david

pdg@ihdev.UUCP (P. D. Guthrie) (03/08/86)

I think that what the previous postings have been missing in the
discussion on command line arguments in icon-type environments is that
command line arguments are not really used to pass the input to the
program, rather set switches to control the execution, much as the /
switches in TOPS-20.  To pass data gathered by pointing the mouse at
displayed text, etc, stdin should be used.  Perhaps when selecting an
icon to execute with certain data, a distinctive method is used to bring
up a front end menu of command line arguments to be turned on or off (or
set) and when modified to satisfaction, the menu is closed and the
command executed.  A front end could take a "usage description" for any
program from a file like this:
@/bin/cat "usvte"* FILE*  #name, options and file, the * means 0 or more
u:SWITCH:Unbuffered:Buffered
s:SWITCH:Silent:Not Silent
v:SWITCH:Visible:Not Visible
t:SWITCH:Tabs:No Tabs
e:SWITCH:EOL indicate:No EOL indicate

So with this method, no changes to existing code would be needed, and
the option file(s) could even be used to produce from a non-iconic
shell.   The front end simply changes the switches taken from the menu
into a shell line and executes the command.  Does anyone know of a
system that uses this type of thing currently?  The only icon based
shell that I have worked with is Sydix,  and with that, when you define
an icon on your desktop,  you say that it is a certain command with
arguments, so you would have to define something like :
1. a cat icon , no arguments,
2. a see icon,  cat -v

I think the method I have listed above would be more versatile.
-- 

Paul Guthrie				`When the going gets weird,
ihnp4!ihdev!pdg				 The weird turn pro'
					  - H. Thompson