🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.d
Article #1910

Re: v20i005: getopt.h - simple interface to getopt, Part01/01

#1910
From: Peter da Silva
Date: Wed, 22 May 1991 17:45
35 lines
1487 bytes
In article <1991May22.033524.16372@sparky.IMD.Sterling.COM> dm@bloom-beacon.mit.edu@think (Dave Mankins) writes:
> Below is a macro package I wrote the second time I had to refer to the
> getopt(3) man page to remind myself how getopt() is used.  I think this
> simplifies the use of getopt tremendously.

Another reason to use parseargs instead (as if there was any need for more
reasons...).

BOOL killmeans = 0;
BOOL quiet = 0;
struct arglist *Files = NULL;

ARGDESC	ArgDesc[] =
{
	'q',	ARGOPT,		argBool,	__ &quiet,
		"quiet (Don't print headers)",
	'g',	ARGOPT,		argBool,	__ &killmeans,
		"GeoTRIM (don't display users below geometric mean)",
	' ',	ARGOPT|ARGLIST,	listStr,	__ &Files,
		"FILES (file containing acctusers output)",
	ENDOFARGS
};

main(argc, argv)
int argc;
char *argv[];
ARGDESC *ArgDesc;
{
	parseargs(argv, ArgDesc);

	...
}
-- 
Peter da Silva; Ferranti International Controls Corporation; +1 713 274 5180;
Sugar Land, TX  77487-5012;         `-_-' "Have you hugged your wolf, today?"
Technical Details
Message-ID: <0OHBT18@xds13.ferranti.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!ficc!peter
References: <1991May22.033524.16372@sparky.IMD.Sterling.COM>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sources.d
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!ficc!peter
From: peter@ficc.ferranti.com (Peter da Silva)
Subject: Re: v20i005:  getopt.h - simple interface to getopt, Part01/01
Message-ID: <0OHBT18@xds13.ferranti.com>
Reply-To: peter@ficc.ferranti.com (Peter da Silva)
Organization: Xenix Support, FICC
References: <1991May22.033524.16372@sparky.IMD.Sterling.COM>
Date: Wed, 22 May 91 17:45:12 GMT