[alt.sources.d] getarg - a replacement for getopt

darcy@druid.uucp (D'Arcy J.M. Cain) (06/28/90)

In article <1969@cirrusl.UUCP> dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) writes:
>In <1990Jun22.172759.27249@druid.uucp> darcy@druid.uucp (D'Arcy J.M.
>Cain) writes:
>
>>The global variable opterr is not implemented.  With Windows and other
>>screen based applications getting to be so popular it is assumed that the
>>calling routine will want to handle its own error message handling.  I am
>>also thinking about dropping optind as a global since I haven't figured
>>out any use for it now.
>
>Compatibility would be a good reason for including both opterr and
>otpind.  Then your routine could be easily plugged into existing
>applications that currently use getopt().

I wasn't trying to make a plug replacement for getopt, otherwise I would
have called it that.  The calling procedure is so different than getopt that
it is kind of hopeless to try to make it look the same to the programmer.
What I did try for is to make it look the same to a user so that they could
use it the same as a program that uses getopt if they didn't care about
the extra functionality.

In fact, if I could think of another name for optarg that I could be sure
wouldn't conflict with user's variables I would have done that as well.
That way getarg could be added to the standard library without conflicting
with getopt and the user can use getopt or getarg as they wish.

BTW:  I forgot to include code to handle "--".  I will post that change
shortly.


-- 
D'Arcy J.M. Cain (darcy@druid)     |   Government:
D'Arcy Cain Consulting             |   Organized crime with an attitude
West Hill, Ontario, Canada         |
(416) 281-6094                     |