Bug 17612
Summary: | ability to parse argv[0] | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Matt Domsch <matt_domsch> |
Component: | popt | Assignee: | Jeff Johnson <jbj> |
Status: | CLOSED WORKSFORME | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.1 | CC: | johnsonm |
Target Milestone: | --- | Keywords: | FutureFeature |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2000-10-09 17:38:41 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Matt Domsch
2000-09-18 17:06:09 UTC
rpm uses popt to parse options, and does logic based on argv[0] tests. The "trick" is to call poptGetContext with different values for the 1st and 4th args, and to make heavy use of nested "struct poptOption" tables using POPT_ARG_INCLUDE_TABLES to eliminate redundancy. Otherwise, I need an explicit example of what you are trying to do to even consider an implementation. Feel free to reopen with a more explicit example ... MKJ wrote a nice program 'ttywatch'. It uses popt to parse a configuration file (see below). Essentially, each line is read in and placed in argv, and then parsed using popt. As argv[0] can't be parsed, the first argument (-- name) actually has to be shifted by one, and a dummy value put in argv[0]. See MKJ for further details, and look at ttywatch in your CVS to see what he did. ### A sample configuration follows: # # --name m1 # --name m2 --port /dev/ttyS1 --bps 9600 # --name m3 --port /dev/ttyS2 --bps 57600 # ### ### machine one (m1) is connected to ttyS0 and talks 115200 bps (default) ### its log is kept in /var/log/ttywatch/m1 ### /dev/m1 is a link to /dev/ttyS0 ### machine two (m2) is connected to ttyS1 and talks 9600 bps ### its log is kept in /var/log/ttywatch/m2 ### machine three (m3) is connected to ttyS2 and talks 57600 bps ### its log is kept in /var/log/ttywatch/m3 ### --name ttyS0 Per MKJ, the functionality is apparently already in popt, but not documented. He promises to send me a doco patch. Please reopen if on or the other of us Johnson's fails to fix :-) |