Bug 56860 - ENH: parse a file as a command line
Summary: ENH: parse a file as a command line
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: popt
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-11-29 01:36 UTC by Need Real Name
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-11-29 01:38:37 UTC
Embargoed:


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

Description Need Real Name 2001-11-29 01:36:37 UTC
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-29 01:37:52 UTC
Created attachment 39004 [details]
diffs to add poptConfigFileToString function

Comment 2 Need Real Name 2001-11-29 01:38:31 UTC
Created attachment 39005 [details]
unit tests for poptConfigFileToString function

Comment 3 Jeff Johnson 2002-07-20 18:52:04 UTC
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.