🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #72961

Replace GNU long options with X resources (Re: Who wants long options anyway?)

#72961
From: greg
Date: Wed, 20 Nov 1991 11:07
63 lines
3342 bytes
Let me know if this has already been discussed...

The GNU options conventions and the GNU getopt function are an
improvement over the old AT&T provisions but are primitive compared to
the standard X-Windows intrinsics mechanisms which can be seen as a
generalization of the GNU provisions.  Since many GNU programs will
use X and most users will use GNU through X there would be an
advantage in GNU programs using X resources.  I'll outline the X
approach and then make some more detailed suggestions for GNU.

HOW X DOES IT

All Xt (X-Windows Intrinsics library) based programs specify both a
short and a long name for all command line options (XrmOptionDescRec).
Interestingly, the long name is the X resource name which allows for a
very general option setting mechanism to be used.  This is managed by
the function XtAppInitialize.

XtAppInitialize automatically does the following:
(1) loads the application defaults
  - application defaults are provided by the application installer
    (usually based on one or more provided with the program)
  - a fallback in a program data structure is provided in case the
    application defaults file is not present
(2) loads the user's defaults
  - first checking the server, otherwise loading ~/.Xdefaults if the user
    hasn't loaded their options into the server
  - user defaults override application defaults
(3) parses the command line
  - translates short names into long names (resource names)
  - command line settings override user defaults and application defaults

There is other machinery provided (class and instance names, tree
structured components with pattern matching, and more) which I won't
go into here.

MY POINTS

There is nothing in all of these X resource manager mechanisms that is
specific to graphic or GUI programs, so these mechanisms might as well
be available to all programs.  Not only does this increase the
sophistication of all programs but it simplifies things for the use
since s/he will not have to learn two mechanisms.

MY PROPOSAL

As it stands, if you want to take advantage of the X resource manager
you have to link with all of the X libraries.  I propose that GNU
getopt be replaced as soon as possible with a version of
XtAppInitialize that does not require all of the other X and Xt
overhead.  I propose that GNU's argument handling conventions be
replaced with the X conventions.

Comments?

_Greg


J. Greg Davidson	Institute for Software Research and Development
+1 (619) 452-8059       6231 Branting Street  San Diego, CA  92122  USA
 
vis!greg@nosc.mil					ucsd----+--vis
vis!greg@ucsd.edu		 			nosc----|
Technical Details
Message-ID: <9111210308.AA03917@ifsrad>
Path: arc1-ca.pugleaf.net!gmdzi!ieee.org!dorm.rutgers.edu!rutgers!cs.utexas.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!vis.UUCP!greg
References: <ANDREWFG.91Nov11124344@coral.dai.ed.ac.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1025b4,5071a1d1ccc07109
X-Google-Attributes: gid1025b4,public
X-Google-ArrivalTime: 1991-11-21 02:02:31 PST
Path: arc1-ca.pugleaf.net!gmdzi!ieee.org!dorm.rutgers.edu!rutgers!cs.utexas.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!vis.UUCP!greg
From: greg@vis.UUCP
Newsgroups: gnu.misc.discuss
Subject: Replace GNU long options with X resources (Re: Who wants long options anyway?)
Message-ID: <9111210308.AA03917@ifsrad>
Date: 20 Nov 91 11:07:58 GMT
References: <ANDREWFG.91Nov11124344@coral.dai.ed.ac.uk>
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 63