Bug 56860 - ENH: parse a file as a command line
ENH: parse a file as a command line
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: popt (Show other bugs)
7.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-11-28 20:36 EST by Need Real Name
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-11-28 20:38:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
diffs to add poptConfigFileToString function (6.89 KB, patch)
2001-11-28 20:37 EST, Need Real Name
no flags Details | Diff
unit tests for poptConfigFileToString function (3.54 KB, application/octet-stream)
2001-11-28 20:38 EST, Need Real Name
no flags Details

  None (edit)
Description Need Real Name 2001-11-28 20:36:37 EST
for our project, we wanted to have a flexable and easy to use config file
parser.  using tools we already like would be a plus, so, popt came to mind.

popt has the ability to read from a poptrc file for doing the aliases - but
this is not what we wanted.  our going is a standard

# comment
var=val

# long
# comment
val2=long value

type config file.  so, we wrote a function to convert this type of file to
a string which allowed us to slam the result through poptParseArgvString()
and then via the poptGetNextOpt() methods to fully read the file.  now, we
just set up the popt array and management is much easier.  in fact, we can
also use the same array for reading command line and config file options.

so, basically, the first step is to write a config-file-to-string function
- which is attached to this bug (along with unit tests).

our code did many more complicated things, some of which i'll contribute
back to popt, but this function is the first step.  please examine,
comment, and perhaps we need to change the calling conventions and such.

two attachments: a cvs diff and a tgz of new files.
Comment 1 Need Real Name 2001-11-28 20:37:52 EST
Created attachment 39004 [details]
diffs to add poptConfigFileToString function
Comment 2 Need Real Name 2001-11-28 20:38:31 EST
Created attachment 39005 [details]
unit tests for poptConfigFileToString function
Comment 3 Jeff Johnson 2002-07-20 14:52:04 EDT
OK, your patch is going in on my next checkin,
should be in popt-1.7-0.51.

Be forewarned, I'm not sure how useful parsing
a config file into a string of options is, so
expect the code to change, and possibly be reverted.

Note You need to log in before you can comment on or make changes to this bug.