Xref: utzoo comp.lang.c:8803 comp.unix.wizards:7519 Path: utzoo!mnetor!uunet!yale!husc6!cca!g-rh From: g-rh@cca.CCA.COM (Richard Harter) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: command line options Message-ID: <26423@cca.CCA.COM> Date: 1 Apr 88 09:03:51 GMT References: <2414@zyx.UUCP> <738@srs.UUCP> Reply-To: g-rh@CCA.CCA.COM.UUCP (Richard Harter) Organization: Computer Corp. of America, Cambridge, MA Lines: 62 The discussions on options are of particular interest to me because I expect to be revising an options package in the near future. (Real soon now.) I don't mind a fair bit of work, but I want to get the spec's right. Here are some considerations: (1) Must be able to handle multiple calls with different argument vectors. [This is an internal requirement.] (2) Must be able to turn flags on and off. This is hand in hand with requirement (1). This is a problem. Currently we are using - for off and + for on. From a human engineering viewpoint this seems essential. However this conflicts with unix usage. (3) Must be case insensitive if the key values are all the same case. (4) Must be able to handle key values with more than one letter. (5) Must be able to handle abbreviations to the level of ambiguity. (6) Insofar as possible, must be consistent with getopt. In particular if all key values are unambiguous at the one letter level, one should be able to group them. (7) Should be able to handle various types and do the appropriate interpretation. Should also be able to invoke a processing routine for an option value. (8) Should be able to handle a list of positional arguments which don't have option keys. It should be possible to intermix these with options which do have keys. [Compatibility considerations.] (9) Must be able to return a list of all arguments which are not key value or postional options, or some equivalent mechanism. (10) For sundry internal reasons, must be able to support -key value and key=value. (11) Under consideration is white space elimination and white space requirement rules. In particular, if k is a key letter, getopt allows -kvalue We would like to do this, to be consistent with getopt. Precise rules for doing this while allowing multiple letter keys are yet to be determined. There are also questions about -foo-bar (12) Error handlers should be specifiable. (13) It would be preferable that the entire options processing package be self contained. (14) Also preferred is that there be no globals involved. As I say, these are preliminary desiderata. Any suggestions or comments would be appreciated. -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.