Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!husc6!hscfvax!mohamed
From: mohamed@hscfvax.harvard.edu (Mohamed_el_Lozy)
Newsgroups: comp.unix.wizards
Subject: Re: Command interfaces
Message-ID: <489@hscfvax.harvard.edu>
Date: 15 Dec 87 23:42:31 GMT
References: <432@cresswell.quintus.UUCP> <57900005@ccvaxa> <22179@ucbvax.BERKELEY.EDU>
Reply-To: mohamed@hscfvax.UUCP (Mohamed_el_Lozy)
Organization: Health Sciences Computing Facility, Harvard University
Lines: 25
Posted: Tue Dec 15 18:42:31 1987

In article <22179@ucbvax.BERKELEY.EDU> bostic@ucbvax.BERKELEY.EDU
(Keith Bostic) writes:
>> > Henry Spencer on getopt():
>> > Why don't people use getopt
>> > more?  Because the interface to getopt is a little complicated and it is
>> > hard to get it right when you are typing a program in from scratch.  (For
>
>If the interface to the program is reasonably well defined, i.e. it follows
>the rules laid down in S5, it's not tough at all.  Just put the following 14
>lines in a file in some directory, copy them in and edit as needed.  It just
>doesn't get any easier, this side of 4th GL's.
>

It can (and perhaps should) be made even easier.  A year or so ago I
posted a program to the non-moderated sources group called mkprog that
would take (too many) arguments and produce the getopt(3) switch,
together with declaring the flags as suitable variables and many other
things.

Looking in ~pub on j.cc.purdue.edu I found a similar program called, as
I recall, mkcmd which allowed even more specification of exactly what
you want.  I believe that it has not been posted yet.

Complex interfaces can, and should, be made simpler by putting a
suitable wrapper around them.