author | Rich Burridge <rich.burridge@oracle.com> |
Mon, 17 Dec 2012 15:52:33 -0800 | |
changeset 1086 | 658961e6c9b9 |
child 5826 | 9c90e4a8156c |
permissions | -rw-r--r-- |
1086
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1 |
'\" te |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
2 |
.TH libpopt 3 "31 May 2004" "" "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
3 |
.SH "NAME" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
4 |
libpopt \- parse |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
5 |
command-line options |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
6 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
7 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
8 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
9 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
10 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
11 |
poptContext poptGetContext(const char * name, int argc, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
12 |
const char ** argv, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
13 |
const struct poptOption * options, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
14 |
int flags); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
15 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
16 |
void poptFreeContext(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
17 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
18 |
void poptResetContext(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
19 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
20 |
int poptGetNextOpt(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
21 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
22 |
const char * poptGetOptArg(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
23 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
24 |
const char * poptGetArg(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
25 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
26 |
const char * poptPeekArg(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
27 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
28 |
const char ** poptGetArgs(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
29 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
30 |
const char *const poptStrerror(const int error); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
31 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
32 |
const char * poptBadOption(poptContext con, int flags); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
33 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
34 |
int poptReadDefaultConfig(poptContext con, int flags); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
35 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
36 |
int poptReadConfigFile(poptContext con, char * fn); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
37 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
38 |
int poptAddAlias(poptContext con, struct poptAlias alias, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
39 |
int flags); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
40 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
41 |
int poptParseArgvString(char * s, int * argcPtr, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
42 |
const char *** argvPtr); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
43 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
44 |
int poptDupArgv(int argc, const char ** argv, int * argcPtr, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
45 |
const char *** argvPtr); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
46 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
47 |
int poptStuffArgs(poptContext con, const char ** argv);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
48 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
49 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
50 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
51 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
52 |
The \fBpopt\fR library parses command-line options\&. The \fBpopt\fR library provides an alternative to parsing the \fBargv\fR array by hand, or using the \fBgetopt\fR(3) functions \fBgetopt()\fR and \fBgetopt_long()\fR\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
53 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
54 |
The \fBpopt\fR library has the following advantages: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
55 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
56 |
.in +2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
57 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
58 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
59 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
60 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
61 |
\fBpopt\fR does not use global variables, thus |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
62 |
enabling multiple passes in parsing \fBargv\fR\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
63 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
64 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
65 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
66 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
67 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
68 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
69 |
\fBpopt\fR can parse an arbitrary array of \fBargv\fR-style elements, allowing parsing of command-line strings from |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
70 |
any source\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
71 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
72 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
73 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
74 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
75 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
76 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
77 |
\fBpopt\fR provides a standard method of option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
78 |
aliasing\&. This feature is discussed in detail below\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
79 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
80 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
81 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
82 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
83 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
84 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
85 |
\fBpopt\fR can exec external option filters\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
86 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
87 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
88 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
89 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
90 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
91 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
92 |
\fBpopt\fR can automatically generate help |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
93 |
and usage messages for the application\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
94 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
95 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
96 |
.in -2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
97 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
98 |
The \fBpopt\fR library supports short and long options\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
99 |
A short option consists of a hyphen followed by a single alphanumeric character\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
100 |
A long option, common in GNU utilities, consists of two hyphens followed by |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
101 |
a string composed of letters, numbers, and hyphens\&. Long options can optionally |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
102 |
begin with a single hyphen, primarily to allow command-line compatibility |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
103 |
between \fBpopt\fR applications and X toolkit applications\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
104 |
Either type of option can be followed by an argument\&. A space separates a |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
105 |
short option from its argument\&. Either a space or an equals sign separates |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
106 |
a long option from an argument\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
107 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
108 |
The \fBpopt\fR library is highly portable and should |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
109 |
work on any POSIX platform\&. The latest version is distributed with \fBrpm\fR and is available from: \fBftp://ftp\&.rpm\&.org/pub/rpm/dist\fR\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
110 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
111 |
The \fBpopt\fR library may be redistributed under the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
112 |
X consortium license, see the file \fBCOPYING\fR in the \fBpopt\fR source distribution for details\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
113 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
114 |
.SS "Option Tables" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
115 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
116 |
Each application provides \fBpopt\fR with information |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
117 |
about the command-line options for the application, by means of an option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
118 |
table\&. An option table is an array of \fBstruct poptOption\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
119 |
structures, with the following format: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
120 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
121 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
122 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
123 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
124 |
struct poptOption { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
125 |
const char * longName; /* may be NULL */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
126 |
char shortName; /* may be \&'\0\&' */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
127 |
int argInfo; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
128 |
void * arg; /* depends on argInfo */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
129 |
int val; /* 0 means do not return, just update flag */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
130 |
char * descrip; /* description for autohelp -- may be NULL */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
131 |
char * argDescrip; /* argument description for autohelp */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
132 |
};\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
133 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
134 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
135 |
.SS "Option Table Members" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
136 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
137 |
Each member of the table defines a single option that may be passed |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
138 |
to the program\&. Long and short options are considered to be a single option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
139 |
that can occur in two different forms\&. The option table members are as follows: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
140 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
141 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
142 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
143 |
\fB\fBlongName\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
144 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
145 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
146 |
Defines |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
147 |
the name of the option in a long name\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
148 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
149 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
150 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
151 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
152 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
153 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
154 |
\fB\fBshortName\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
155 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
156 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
157 |
Defines |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
158 |
the name of the option in a single character\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
159 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
160 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
161 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
162 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
163 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
164 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
165 |
\fB\fBargInfo\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
166 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
167 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
168 |
Tells \fBpopt\fR what type of argument is expected after the option\&. Valid |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
169 |
values are as follows: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
170 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
171 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
172 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
173 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
174 |
\fBPOPT_ARG_DOUBLE\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
175 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
176 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
177 |
Double argument |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
178 |
expected, \fBarg\fR type: \fBdouble\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
179 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
180 |
.sp 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
181 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
182 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
183 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
184 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
185 |
\fBPOPT_ARG_FLOAT\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
186 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
187 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
188 |
Float argument expected, \fBarg\fR type: \fBfloat\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
189 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
190 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
191 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
192 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
193 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
194 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
195 |
\fBPOPT_ARG_INT\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
196 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
197 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
198 |
Integer argument expected, \fBarg\fR type: \fBint\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
199 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
200 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
201 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
202 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
203 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
204 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
205 |
\fBPOPT_ARG_LONG\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
206 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
207 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
208 |
Long integer expected, \fBarg\fR type: \fBlong\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
209 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
210 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
211 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
212 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
213 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
214 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
215 |
\fBPOPT_ARG_NONE\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
216 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
217 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
218 |
No argument expected, \fBarg\fR type: \fBint\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
219 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
220 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
221 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
222 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
223 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
224 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
225 |
\fBPOPT_ARG_STRING\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
226 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
227 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
228 |
No type checking |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
229 |
to be performed, \fBarg\fR type: \fBchar *\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
230 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
231 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
232 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
233 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
234 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
235 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
236 |
\fBPOPT_ARG_VAL\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
237 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
238 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
239 |
Integer value taken |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
240 |
from val, \fBarg\fR type: \fBint\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
241 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
242 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
243 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
244 |
For numeric values, if the \fBargInfo\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
245 |
value is bitwise or\&'d with one of POPT_ARGFLAG_OR, POPT_ARGFLAG_AND, or POPT_ARGFLAG_XOR, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
246 |
the value is saved by performing an OR, AND, or XOR\&. If the \fBargInfo\fR value is bitwise or\&'d with POPT_ARGFLAG_NOT, the value is negated |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
247 |
before saving\&. For the common operations of setting or clearing bits, POPT_BIT_SET |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
248 |
and POPT_BIT_CLR have the appropriate flags set to perform bit operations\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
249 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
250 |
If the \fBargInfo\fRvalue is bitwise or\&'d with POPT_ARGFLAG_ONEDASH, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
251 |
the long argument may be given with a single hyphen instead of two\&. For example, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
252 |
if -\fB-longopt\fR is an option with POPT_ARGFLAG_ONEDASH, -\fBlongopt\fR is also accepted\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
253 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
254 |
.sp 0 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
255 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
256 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
257 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
258 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
259 |
\fB\fBarg\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
260 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
261 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
262 |
Allows \fBpopt\fR to automatically update program variables\&. If \fBarg\fR is NULL, \fBpopt\fR ignores \fBarg\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
263 |
and takes no special action\&. Otherwise, \fBarg\fR points to a |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
264 |
variable of the appropriate type, as follows: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
265 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
266 |
.in +2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
267 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
268 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
269 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
270 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
271 |
If \fBargInfo\fR is POPT_ARG_NONE, the variable |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
272 |
pointed to by \fBarg\fR is set to 1 when the option is used\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
273 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
274 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
275 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
276 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
277 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
278 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
279 |
If the option takes an argument, the variable pointed to by \fBarg\fR is updated to reflect the value of the argument\&. Any string |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
280 |
is acceptable for POPT_ARG_STRING arguments\&. POPT_ARG_INT, POPT_ARG_LONG, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
281 |
POPT_ARG_FLOAT, and POPT_ARG_DOUBLE arguments are converted to the appropriate |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
282 |
type, and an error returned if the conversion fails\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
283 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
284 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
285 |
.in -2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
286 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
287 |
POPT_ARG_VAL causes \fBarg\fR to be set to the integer |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
288 |
value of \fBval\fR when the argument is found\&. This is useful |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
289 |
for mutually-exclusive arguments in cases where it is not an error for multiple |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
290 |
arguments to occur and where you want the last argument specified to take |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
291 |
precedence, for example, \fBrm -i -f\fR\&. POPT_ARG_VAL causes |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
292 |
the parsing function not to return a value, because the value of \fBval\fR has already been used\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
293 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
294 |
If the \fBargInfo\fR value is bitwise or\&'d with POPT_ARGFLAG_OPTIONAL, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
295 |
the argument to the long option may be omitted\&. If the long option is used |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
296 |
without an argument, a default value of zero or NULL is saved if the \fBarg\fR pointer is present\&. Otherwise, the behavior is identical to |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
297 |
that of a long option with an argument\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
298 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
299 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
300 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
301 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
302 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
303 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
304 |
\fB\fBval\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
305 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
306 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
307 |
The value |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
308 |
returned by the \fBpopt\fR parsing function when the option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
309 |
is encountered\&. If \fBval\fR is 0, the parsing function does |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
310 |
not return a value\&. Instead, \fBpopt\fR parses the next command-line |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
311 |
argument\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
312 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
313 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
314 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
315 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
316 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
317 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
318 |
\fBdescrip\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
319 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
320 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
321 |
Text description of the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
322 |
argument\&. Only required if automatic help messages are desired\&. Automatic |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
323 |
usage messages can be generated without this argument\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
324 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
325 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
326 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
327 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
328 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
329 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
330 |
\fBargDescrip\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
331 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
332 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
333 |
Short summary of the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
334 |
type of arguments expected by the option, or NULL if the option does not require |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
335 |
any arguments\&. Only required if automatic help messages are desired\&. Automatic |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
336 |
usage messages can be generated without this argument\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
337 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
338 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
339 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
340 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
341 |
The final structure in the table should have all pointer |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
342 |
values set to NULL and all arithmetic values set to 0, marking the end of |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
343 |
the table\&. The macro POPT_TABLEEND performs these tasks\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
344 |
.SS "Help and Usage Output" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
345 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
346 |
If \fBpopt\fR should automatically provide -\fB\(miusage\fR and -\fB\(mihelp\fR options, one line in the option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
347 |
table should contain the macro POPT_AUTOHELP\&. This macro includes another |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
348 |
option table, via POPT_ARG_INCLUDE_TABLE, which provides the table entries |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
349 |
for these arguments\&. When the -\fB\(miusage\fR or -\fB\(mihelp\fR option is passed to applications that use \fBpopt\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
350 |
automatic help, \fBpopt\fR displays the appropriate message |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
351 |
on \fBstderr\fR, and exits the application with a return code |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
352 |
of 0\&. To use \fBpopt\fR automatic help generation in a different |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
353 |
way, you must explicitly add the option entries to the application\&'s option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
354 |
table, instead of using POPT_AUTOHELP\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
355 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
356 |
If the \fBargInfo\fR value is bitwise or\&'d with POPT_ARGFLAG_DOC_HIDDEN, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
357 |
the argument is not shown in help output\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
358 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
359 |
If the \fBargInfo\fR value is bitwise or\&'d with POPT_ARGFLAG_SHOW_DEFAULT, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
360 |
the inital value of the \fBarg\fR is shown in help output\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
361 |
.SS "Special Option Table Entries" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
362 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
363 |
Two types of option table entries do not specify command-line options\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
364 |
When either of these types of entries is used, the \fBlongName\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
365 |
element must be NULL and the \fBshortName\fR element must be \fB\\0\fR\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
366 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
367 |
The first of these special entry types allows the application to nest |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
368 |
another option table in the current option table\&. Such nesting may extend |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
369 |
quite deeply, the actual depth is limited by the application stack\&. Including |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
370 |
other option tables allows a library to provide a standard set of command-line |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
371 |
options to every application that uses the library\&. This is often done in |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
372 |
graphical programming toolkits, for example\&. To nest another option table, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
373 |
set the \fBargInfo\fR field to POPT_ARG_INCLUDE_TABLE and the \fBarg\fR field to point to the table that is being included\&. If automatic |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
374 |
help generation is used, the \fBdescrip\fR field should contain |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
375 |
an overall description of the option table being included\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
376 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
377 |
The other special option table entry type tells \fBpopt\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
378 |
to call a function when any option in that table is found\&. This callback functionality |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
379 |
is especially useful when included option tables are used, because the application |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
380 |
that provides the top-level option table does not need to be aware of the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
381 |
other options that are provided by the included table\&. When a callback is |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
382 |
set for a table, the parsing function never returns information on an option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
383 |
in the table\&. Instead, option information must be retained via the callback |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
384 |
or by having \fBpopt\fR set a variable through the option\&'s \fBarg\fR field\&. Option callbacks should match the following prototype: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
385 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
386 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
387 |
void poptCallbackType(poptContext con, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
388 |
const struct poptOption * opt, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
389 |
const char * arg, void * data); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
390 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
391 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
392 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
393 |
The callback uses the following parameters: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
394 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
395 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
396 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
397 |
\fB\fBcon\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
398 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
399 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
400 |
The context |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
401 |
that is being parsed\&. See the next section for information on contexts\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
402 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
403 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
404 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
405 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
406 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
407 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
408 |
\fB\fBopt\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
409 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
410 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
411 |
The option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
412 |
that triggered this callback\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
413 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
414 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
415 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
416 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
417 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
418 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
419 |
\fB\fBarg\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
420 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
421 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
422 |
The argument |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
423 |
for the \fBopt\fR option\&. If the option does not take an argument, \fBarg\fR is NULL\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
424 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
425 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
426 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
427 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
428 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
429 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
430 |
\fB\fBdata\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
431 |
.in +16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
432 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
433 |
Taken from |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
434 |
the \fBdescrip\fR field of the option table entry that defined |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
435 |
the callback\&. As \fBdescrip\fR is a pointer, this allows you |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
436 |
to pass an arbitrary set of data to callback functions, though a typecast |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
437 |
must be used\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
438 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
439 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
440 |
.in -16n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
441 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
442 |
The option table entry that defines a callback has an \fBargInfo\fR of POPT_ARG_CALLBACK, an \fBarg\fR that points |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
443 |
to the callback function, and a \fBdescrip\fR field that specifies |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
444 |
an arbitrary pointer to be passed to the callback\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
445 |
.SS "Creating a Context" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
446 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
447 |
\fBpopt\fR can interleave the parsing of multiple command-line |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
448 |
sets\&. \fBpopt\fR allows this by keeping all of the state information |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
449 |
for a particular set of command-line arguments in a \fBpoptContext\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
450 |
data structure, an opaque type that should not be modified outside the \fBpopt\fR library\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
451 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
452 |
New \fBpopt\fR contexts are created by \fBpoptGetContext()\fR: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
453 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
454 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
455 |
\f(CWpoptContext poptGetContext(const char * name, int argc, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
456 |
const char ** argv, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
457 |
const struct poptOption * options, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
458 |
int flags);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
459 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
460 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
461 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
462 |
The \fBpoptGetContext()\fR function takes the following |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
463 |
parameters: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
464 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
465 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
466 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
467 |
\fB\fBname\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
468 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
469 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
470 |
Used only |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
471 |
for alias handling\&. \fBname\fR should be the name of the application |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
472 |
whose options are being parsed, or should be NULL if no option aliasing is |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
473 |
desired\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
474 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
475 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
476 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
477 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
478 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
479 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
480 |
\fB\fBargc\fR, \fBargv\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
481 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
482 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
483 |
Specifies the command-line arguments to parse\&. These arguments |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
484 |
are generally passed to \fBpoptGetContext()\fR exactly as they |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
485 |
were passed to the application\&'s \fBmain()\fR function\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
486 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
487 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
488 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
489 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
490 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
491 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
492 |
\fB\fBoptions\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
493 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
494 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
495 |
Points |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
496 |
to the table of command-line options\&. See the Option Tables section above\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
497 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
498 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
499 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
500 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
501 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
502 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
503 |
\fB\fBflags\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
504 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
505 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
506 |
Can take |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
507 |
one of the following values: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
508 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
509 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
510 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
511 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
512 |
\fBPOPT_CONTEXT_NO_EXEC\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
513 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
514 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
515 |
Ignore \fBexec\fR expansions |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
516 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
517 |
.sp 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
518 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
519 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
520 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
521 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
522 |
\fBPOPT_CONTEXT_KEEP_FIRST\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
523 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
524 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
525 |
Do not ignore \fBargv[0]\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
526 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
527 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
528 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
529 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
530 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
531 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
532 |
\fBPOPT_CONTEXT_POSIXMEHARDER\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
533 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
534 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
535 |
Options |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
536 |
cannot follow arguments |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
537 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
538 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
539 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
540 |
.sp 0 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
541 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
542 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
543 |
A \fBpoptContext\fR keeps track of which |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
544 |
options have already been parsed and which remain to be parsed\&. If an application |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
545 |
wishes to restart processing the options of a set of arguments, the application |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
546 |
can reset the \fBpoptContext\fR by passing the context as the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
547 |
sole argument to \fBpoptResetContext()\fR\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
548 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
549 |
When argument processing is complete, the process should free the \fBpoptContext\fR, as it contains dynamically allocated components\&. The \fBpoptFreeContext()\fR function takes a \fBpoptContext\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
550 |
as its sole argument and frees the resources that the context is using\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
551 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
552 |
Here are the prototypes of both \fBpoptResetContext()\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
553 |
and \fBpoptFreeContext()\fR: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
554 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
555 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
556 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
557 |
void poptFreeContext(poptContext con); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
558 |
void poptResetContext(poptContext con);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
559 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
560 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
561 |
.SS "Parsing the Command Line" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
562 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
563 |
After an application has created a \fBpoptContext\fR, the \fBpoptContext\fR may begin parsing arguments\&. \fBpoptGetNextOpt()\fR performs the actual argument parsing: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
564 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
565 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
566 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
567 |
int poptGetNextOpt(poptContext con);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
568 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
569 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
570 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
571 |
Taking the context as its sole argument, the \fBpoptGetNextOpt()\fR function parses the next command-line argument found\&. When \fBpoptGetNextOpt()\fR finds the next argument in the option table, the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
572 |
function populates the object pointed to by the option table entry\&'s \fBarg\fR pointer, if the pointer is not NULL\&. If the \fBval\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
573 |
entry for the option is not zero, the function returns that value\&. Otherwise, \fBpoptGetNextOpt()\fR continues to the next argument\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
574 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
575 |
\fBpoptGetNextOpt()\fR returns \(mi1 when the final |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
576 |
argument has been parsed, and other negative values when errors occur\&. Therefore, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
577 |
you should ensure that the \fBval\fR elements in the option table |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
578 |
are greater than 0\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
579 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
580 |
If all of the command-line options are handled through \fBarg\fR pointers, command-line parsing is reduced to the following line |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
581 |
of code: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
582 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
583 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
584 |
\f(CWrc = poptGetNextOpt(poptcon);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
585 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
586 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
587 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
588 |
Many applications require more complex command-line parsing than this, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
589 |
however, and use the following structure: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
590 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
591 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
592 |
\f(CWwhile ((rc = poptGetNextOpt(poptcon)) > 0) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
593 |
switch (rc) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
594 |
/* specific arguments are handled here */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
595 |
} |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
596 |
}\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
597 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
598 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
599 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
600 |
When returned options are handled, the application needs to know the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
601 |
value of any arguments that were specified after the option\&. There are two |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
602 |
ways to discover these values: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
603 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
604 |
.in +2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
605 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
606 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
607 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
608 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
609 |
Ask \fBpopt\fR to populate a variable with |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
610 |
the value of the option from the option table\&'s \fBarg\fR elements\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
611 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
612 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
613 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
614 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
615 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
616 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
617 |
Use \fBpoptGetOptArg()\fR: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
618 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
619 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
620 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
621 |
const char * poptGetOptArg(poptContext con);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
622 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
623 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
624 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
625 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
626 |
.in -2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
627 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
628 |
The \fBpoptGetOptArg()\fR function returns the argument |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
629 |
given for the final option returned by \fBpoptGetNextOpt()\fR, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
630 |
or returns NULL if no argument was specified\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
631 |
.SS "Leftover Arguments" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
632 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
633 |
Many applications take an arbitrary number of command-line arguments, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
634 |
such as a list of file names\&. When \fBpopt\fR encounters an |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
635 |
argument that does not begin with a hyphen, \fBpopt\fR assumes |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
636 |
that this is such an argument, and adds the argument to a list of leftover |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
637 |
arguments\&. Three functions allow applications to access such arguments: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
638 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
639 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
640 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
641 |
\fB\fBconst char * poptGetArg(poptContext con);\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
642 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
643 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
644 |
Returns the next leftover argument and marks the argument |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
645 |
as processed\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
646 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
647 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
648 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
649 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
650 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
651 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
652 |
\fB\fBconst char * poptPeekArg(poptContext con);\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
653 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
654 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
655 |
Returns the next leftover argument but does not mark the argument |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
656 |
as processed\&. This allows an application to look ahead into the argument list, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
657 |
without modifying the list\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
658 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
659 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
660 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
661 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
662 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
663 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
664 |
\fB\fBconst char ** poptGetArgs(poptContext con);\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
665 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
666 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
667 |
Returns all of the leftover arguments in a manner identical |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
668 |
to \fBargv\fR\&. The final element in the returned array points |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
669 |
to NULL, indicating the end of the arguments\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
670 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
671 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
672 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
673 |
.SS "Automatic Help Messages" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
674 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
675 |
The popt library can automatically generate help messages that describe |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
676 |
the options that an application accepts\&. Two types of help messages can be |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
677 |
generated: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
678 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
679 |
.in +2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
680 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
681 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
682 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
683 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
684 |
Usage messages are short messages that list valid options, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
685 |
but do not describe the options\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
686 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
687 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
688 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
689 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
690 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
691 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
692 |
Help messages describe each option in one or more lines, resulting |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
693 |
in a longer but more useful message\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
694 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
695 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
696 |
.in -2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
697 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
698 |
Whenever automatic help messages are used, the \fBdescrip\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
699 |
and \fBargDescrip\fR members of the \fBstruct poptOption\fR structure should be populated for each option\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
700 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
701 |
The POPT_AUTOHELP macro makes it easy to add usage and help messages |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
702 |
to your application, as described earlier in this man page\&. If you need more |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
703 |
control over your help messages, use the following functions: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
704 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
705 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
706 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
707 |
void poptPrintHelp(poptContext con, FILE * f, int flags); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
708 |
void poptPrintUsage(poptContext con, FILE * f, int flags);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
709 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
710 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
711 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
712 |
\fBpoptPrintHelp()\fR displays the standard help message |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
713 |
to the \fBstdio\fR file descriptor \fBf\fR, while \fBpoptPrintUsage()\fR displays the shorter usage message\&. Both functions |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
714 |
currently ignore the \fBflags\fR argument, which is provided |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
715 |
for future functionality\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
716 |
.SS "Option Aliasing" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
717 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
718 |
One of the primary benefits of \fBpopt\fR is the ability |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
719 |
to use option aliasing\&. Option aliasing allows the user to specify options |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
720 |
that \fBpopt\fR expands into other options\&. For example\&. if |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
721 |
the standard \fBgrep\fR command made use of \fBpopt\fR, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
722 |
users could add a -\fB\(mitext\fR option that expanded to \fB-i -n -E -2\fR, to allow users to more easily find information in text |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
723 |
files\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
724 |
.SS "Specifying Aliases" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
725 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
726 |
Aliases are normally specified in two places: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
727 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
728 |
.in +2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
729 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
730 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
731 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
732 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
733 |
\fB/etc/popt\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
734 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
735 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
736 |
\(bu |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
737 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
738 |
.in +3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
739 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
740 |
\fB$HOME/\&.popt\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
741 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
742 |
.in -3 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
743 |
.in -2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
744 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
745 |
Both files have the same format, that is, an arbitrary number of lines |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
746 |
formatted as follows: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
747 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
748 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
749 |
\fIappname\fR alias \fInewoption\fR \fIexpansion\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
750 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
751 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
752 |
An alias specification is composed of the following elements: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
753 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
754 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
755 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
756 |
\fB\fIappname\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
757 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
758 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
759 |
Specifies the name of the application, which must be the same as the \fBname\fR parameter passed to \fBpoptGetContext()\fR\&. This |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
760 |
allows each file to specify aliases for multiple programs\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
761 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
762 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
763 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
764 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
765 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
766 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
767 |
\fBalias\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
768 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
769 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
770 |
Specifies that an alias is |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
771 |
being defined\&. Currently, \fBpopt\fR configuration files support |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
772 |
only aliases, but other abilities may be added in the future\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
773 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
774 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
775 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
776 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
777 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
778 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
779 |
\fB\fInewoption\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
780 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
781 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
782 |
Specifies the option that should be aliased, either a short option or |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
783 |
a long option\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
784 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
785 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
786 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
787 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
788 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
789 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
790 |
\fB\fIexpansion\fR\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
791 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
792 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
793 |
Specifies the expansion for the alias\&. The expansion is parsed in a |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
794 |
similar way to a shell command: backslashes are allowed, and single quotation |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
795 |
marks can be used for quoting\&. If a backslash is the final character on a |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
796 |
line, the next line in the file is assumed to be a logical continuation of |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
797 |
the line containing the backslash, just as in a shell command\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
798 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
799 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
800 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
801 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
802 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
803 |
For example, the following entry would add to the \fBgrep\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
804 |
command the -\fB\(mitext\fR option described earlier: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
805 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
806 |
\f(CWgrep alias --text -i -n -E -2\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
807 |
.SS "Enabling Aliases" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
808 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
809 |
An application must enable alias expansion for a \fBpoptContext\fR, before calling \fBpoptGetNextArg()\fR for the first |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
810 |
time\&. Three functions define aliases for a context: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
811 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
812 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
813 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
814 |
\fBint poptReadDefaultConfig(poptContext con, int flags);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
815 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
816 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
817 |
Reads aliases from \fB/etc/popt\fR and \fB$HOME/\&.popt\fR\&. The \fBflags\fR argument should be NULL, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
818 |
it is provided only for future expansion\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
819 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
820 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
821 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
822 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
823 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
824 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
825 |
\fBint poptReadConfigFile(poptContext con, char * fn);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
826 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
827 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
828 |
Opens the file specified by \fBfn\fR and parses |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
829 |
the file as a \fBpopt\fR configuration file\&. This allows applications |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
830 |
to use application-specific configuration files\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
831 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
832 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
833 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
834 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
835 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
836 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
837 |
\fBint poptAddAlias(poptContext con, struct poptAlias alias, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
838 |
int flags);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
839 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
840 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
841 |
Adds a new alias to a context\&. This function |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
842 |
is useful when processes want to specify aliases without having to read them |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
843 |
from a configuration file\&. The \fBflags\fR argument should be |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
844 |
0, it is provided only for future expansion\&. The new alias is specified as |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
845 |
a \fBstruct poptAlias\fR, which is defined as follows: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
846 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
847 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
848 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
849 |
\f(CWstruct poptAlias { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
850 |
const char * longName; /* may be NULL */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
851 |
char shortName; /* may be \&'\0\&' */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
852 |
int argc; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
853 |
const char ** argv; /* must be free()able */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
854 |
};\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
855 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
856 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
857 |
\fBlongName\fR and \fBshortName\fR specify |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
858 |
the option that is aliased\&. \fBargc\fR and \fBargv\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
859 |
define the expansion to use when the aliases option is encountered\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
860 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
861 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
862 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
863 |
.SS "Parsing Argument Strings" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
864 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
865 |
\fBpopt\fR usually parses arguments that are already |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
866 |
divided into an \fBargv\fR-style array\&. However, some applications |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
867 |
need to parse strings that are formatted identically to command lines\&. To |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
868 |
facilitate this, \fBpopt\fR provides a function that parses a |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
869 |
string into an array of strings, using rules similar to those of normal shell |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
870 |
parsing: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
871 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
872 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
873 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
874 |
int poptParseArgvString(char * s, int * argcPtr, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
875 |
char *** argvPtr); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
876 |
int poptDupArgv(int argc, const char ** argv, int * argcPtr, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
877 |
const char *** argvPtr);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
878 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
879 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
880 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
881 |
The string \fBs\fR is parsed into an \fBargv\fR-style |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
882 |
array\&. The integer pointed to by the \fBargcPtr\fR parameter |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
883 |
contains the number of elements parsed, and the final \fBargvPtr\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
884 |
parameter contains the address of the newly created array\&. The routine \fBpoptDupArgv()\fR can be used to make a copy of an existing argument |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
885 |
array\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
886 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
887 |
The \fBargvPtr\fR created by \fBpoptParseArgvString()\fR or \fBpoptDupArgv()\fR can be passed directly to \fBpoptGetContext()\fR\&. Both routines return a single dynamically allocated |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
888 |
contiguous block of storage and should be freed using \fBfree()\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
889 |
when the application is finished with the storage\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
890 |
.SS "Handling Extra Arguments" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
891 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
892 |
Some applications implement the equivalent of option aliasing but do |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
893 |
so using special logic\&. The \fBpoptStuffArgs()\fR function allows |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
894 |
an application to insert new arguments into the current \fBpoptContext\fR: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
895 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
896 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
897 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
898 |
int poptStuffArgs(poptContext con, const char ** argv);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
899 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
900 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
901 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
902 |
The passed \fBargv\fR must have a NULL pointer as its final |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
903 |
element\&. When \fBpoptGetNextOpt()\fR is next called, the "stuffed" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
904 |
arguments are the first to be parsed\&. \fBpopt\fR returns to |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
905 |
the normal arguments when all of the stuffed arguments have been exhausted\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
906 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
907 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
908 |
All of the \fBpopt\fR functions that can return errors |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
909 |
return integers\&. When an error occurs, a negative error code is returned\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
910 |
The following error codes can occur: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
911 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
912 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
913 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
914 |
\fBPOPT_ERROR_BADNUMBER\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
915 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
916 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
917 |
A string-to-number |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
918 |
conversion failed because the string contains nonnumeric characters\&. This |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
919 |
occurs when \fBpoptGetNextOpt()\fR is processing an argument |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
920 |
of type POPT_ARG_INT, POPT_ARG_LONG, POPT_ARG_FLOAT, or POPT_ARG_DOUBLE\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
921 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
922 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
923 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
924 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
925 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
926 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
927 |
\fBPOPT_ERROR_BADOPT\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
928 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
929 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
930 |
An option was |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
931 |
specified in \fBargv\fR but is not in the option table\&. This |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
932 |
error can be returned only from \fBpoptGetNextOpt()\fR\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
933 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
934 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
935 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
936 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
937 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
938 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
939 |
\fBPOPT_ERROR_BADQUOTE\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
940 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
941 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
942 |
A parsed string |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
943 |
has a quotation mismatch, for example, a single quotation mark\&. \fBpoptParseArgvString()\fR, \fBpoptReadConfigFile()\fR, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
944 |
or \fBpoptReadDefaultConfig()\fR can return this error\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
945 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
946 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
947 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
948 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
949 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
950 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
951 |
\fBPOPT_ERROR_ERRNO\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
952 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
953 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
954 |
A system call returned |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
955 |
with an error, and \fBerrno\fR still contains the error from |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
956 |
the system call\&. Both \fBpoptReadConfigFile()\fR and \fBpoptReadDefaultConfig()\fR can return this error\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
957 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
958 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
959 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
960 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
961 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
962 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
963 |
\fBPOPT_ERROR_NOARG\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
964 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
965 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
966 |
An option that |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
967 |
requires an argument was specified on the command line, but no argument was |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
968 |
given\&. This error can be returned only by \fBpoptGetNextOpt()\fR\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
969 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
970 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
971 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
972 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
973 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
974 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
975 |
\fBPOPT_ERROR_OPTSTOODEEP\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
976 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
977 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
978 |
A set of |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
979 |
option aliases is nested too deeply\&. Currently, \fBpopt\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
980 |
follows options to only 10 levels, to prevent infinite recursion\&. Only \fBpoptGetNextOpt()\fR can return this error\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
981 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
982 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
983 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
984 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
985 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
986 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
987 |
\fBPOPT_ERROR_OVERFLOW\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
988 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
989 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
990 |
A string-to-number |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
991 |
conversion failed because the number is too large or too small\&. This error |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
992 |
can occur only when \fBpoptGetNextOpt()\fR is processing an |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
993 |
argument of type POPT_ARG_INT, POPT_ARG_LONG, POPT_ARG_FLOAT, or POPT_ARG_DOUBLE\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
994 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
995 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
996 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
997 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
998 |
Two functions allow applications to provide good error |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
999 |
messages: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1000 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1001 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1002 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1003 |
\fBconst char *const poptStrerror(const int error);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1004 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1005 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1006 |
Takes a \fBpopt\fR error code and returns a string |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1007 |
describing the error, just as with the standard \fBstrerror()\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1008 |
function\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1009 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1010 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1011 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1012 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1013 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1014 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1015 |
\fBconst char * poptBadOption(poptContext con, int flags);\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1016 |
.sp .6 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1017 |
.in +4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1018 |
Returns the option that caused the error, if an error |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1019 |
occurred during \fBpoptGetNextOpt()\fR\&. If the \fBflags\fR argument is set to POPT_BADOPTION_NOALIAS, the outermost option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1020 |
is returned\&. Otherwise, \fBflags\fR should be 0, and the option |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1021 |
that is returned may have been specified through an alias\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1022 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1023 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1024 |
.in -4 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1025 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1026 |
These two functions ensure that \fBpopt\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1027 |
error handling is trivial for most applications\&. When an error is detected |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1028 |
from most of the functions, an error message is printed along with the error |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1029 |
string from \fBpoptStrerror()\fR\&. When an error occurs during |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1030 |
argument parsing, code similar to the following displays a useful error message: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1031 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1032 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1033 |
\f(CWfprintf(stderr, "%s: %s\n", |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1034 |
poptBadOption(optCon, POPT_BADOPTION_NOALIAS), |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1035 |
poptStrerror(rc));\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1036 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1037 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1038 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1039 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1040 |
\fBExample 1: Parse Program Created From robin Program\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1041 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1042 |
The following example is a simplified version of the \fBrobin\fR program that appears in Chapter 15 of "Linux Application |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1043 |
Development" by Michael K\&. Johnson and Erik W\&. Troan (copyright 1998 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1044 |
by Addison Wesley Longman, Inc\&.)\&. The \fBrobin\fR program has |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1045 |
been stripped of everything but its argument-parsing logic, slightly reworked, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1046 |
and renamed \fBparse\fR\&. This program illustrates some of the |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1047 |
features of the extremely rich \fBpopt\fR library\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1048 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1049 |
.nf |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1050 |
\f(CW#include <popt\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1051 |
#include <stdio\&.h> |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1052 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1053 |
void usage(poptContext optCon, int exitcode, char *error, char *addl) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1054 |
poptPrintUsage(optCon, stderr, 0); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1055 |
if (error) fprintf(stderr, "%s: %s0, error, addl); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1056 |
exit(exitcode); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1057 |
} |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1058 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1059 |
int main(int argc, char *argv[]) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1060 |
char c; /* used for argument parsing */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1061 |
int i = 0; /* used for tracking options */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1062 |
char *portname; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1063 |
int speed = 0; /* used in argument parsing to set speed */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1064 |
int raw = 0; /* raw mode? */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1065 |
int j; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1066 |
char buf[BUFSIZ+1]; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1067 |
poptContext optCon; /* context for parsing command-line options */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1068 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1069 |
struct poptOption optionsTable[] = { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1070 |
{ "bps", \&'b\&', POPT_ARG_INT, &speed, 0, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1071 |
"signaling rate in bits-per-second", "BPS" }, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1072 |
{ "crnl", \&'c\&', 0, 0, \&'c\&', |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1073 |
"expand cr characters to cr/lf sequences" }, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1074 |
{ "hwflow", \&'h\&', 0, 0, \&'h\&', |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1075 |
"use hardware (RTS/CTS) flow control" }, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1076 |
{ "noflow", \&'n\&', 0, 0, \&'n\&', |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1077 |
"use no flow control" }, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1078 |
{ "raw", \&'r\&', 0, &raw, 0, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1079 |
"don\&'t perform any character conversions" }, |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1080 |
{ "swflow", \&'s\&', 0, 0, \&'s\&', |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1081 |
"use software (XON/XOF) flow control" } , |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1082 |
POPT_AUTOHELP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1083 |
{ NULL, 0, 0, NULL, 0 } |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1084 |
}; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1085 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1086 |
optCon = poptGetContext(NULL, argc, argv, optionsTable, 0); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1087 |
poptSetOtherOptionHelp(optCon, "[OPTIONS]* <port>"); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1088 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1089 |
if (argc < 2) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1090 |
poptPrintUsage(optCon, stderr, 0); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1091 |
exit(1); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1092 |
} |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1093 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1094 |
/* Now do options processing, get portname */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1095 |
while ((c = poptGetNextOpt(optCon)) >= 0) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1096 |
switch (c) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1097 |
case \&'c\&': |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1098 |
buf[i++] = \&'c\&'; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1099 |
break; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1100 |
case \&'h\&': |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1101 |
buf[i++] = \&'h\&'; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1102 |
break; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1103 |
case \&'s\&': |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1104 |
buf[i++] = \&'s\&'; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1105 |
break; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1106 |
case \&'n\&': |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1107 |
buf[i++] = \&'n\&'; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1108 |
break; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1109 |
} |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1110 |
} |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1111 |
portname = poptGetArg(optCon); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1112 |
if((portname == NULL) || !(poptPeekArg(optCon) == NULL)) |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1113 |
usage(optCon, 1, "Specify a single port", "\&.e\&.g\&., /dev/cua0"); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1114 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1115 |
if (c < -1) { |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1116 |
/* an error occurred during option processing */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1117 |
fprintf(stderr, "%s: %s\n", |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1118 |
poptBadOption(optCon, POPT_BADOPTION_NOALIAS), |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1119 |
poptStrerror(c)); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1120 |
return 1; |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1121 |
} |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1122 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1123 |
/* Print out options, portname chosen */ |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1124 |
printf("Options chosen: "); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1125 |
for(j = 0; j < i ; j++) |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1126 |
printf("-%c ", buf[j]); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1127 |
if(raw) printf("-r "); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1128 |
if(speed) printf("-b %d ", speed); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1129 |
printf("\nPortname chosen: %s\n", portname); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1130 |
|
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1131 |
poptFreeContext(optCon); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1132 |
exit(0); |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1133 |
} |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1134 |
\fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1135 |
.fi |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1136 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1137 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1138 |
RPM, a popular Linux package management application, uses several \fBpopt\fR features\&. Many RPM command-line arguments are implemented |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1139 |
using \fBpopt\fR aliases, which makes RPM an excellent example |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1140 |
of how to take advantage of the \fBpopt\fR library\&. For more |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1141 |
information about RPM, see \fBhttp://www\&.rpm\&.org\fR\&. The \fBpopt\fR source code distribution includes test programs that use all |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1142 |
of the features of the \fBpopt\fR libraries in various ways\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1143 |
If a \fBpopt\fR feature does not work for you, check the \fBpopt\fR test code\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1144 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1145 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1146 |
The following files are used by this library: |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1147 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1148 |
.ne 2 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1149 |
.mk |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1150 |
\fB\fB/usr/lib/libpopt\&.so\fR \fR |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1151 |
.in +24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1152 |
.rt |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1153 |
Command Line Parser API shared library |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1154 |
.sp |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1155 |
.sp 1 |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1156 |
.in -24n |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1157 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1158 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1159 |
\fBgetopt\fR(3), |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1160 |
\fBattributes\fR(5) |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1161 |
.SH "" |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1162 |
.PP |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1163 |
Updated by Erwann Chenede, Sun Microsystems Inc\&., 2003\&. Written by Erik |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1164 |
W\&. Troan (ewt@redhat\&.com), Michael K\&. Johnson, and Robert Lynch\&. |
658961e6c9b9
15820214 SUNBT7202654 Move popt from Desktop consolidation to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1165 |
...\" created by instant / solbook-to-man, Tue 21 Aug 2012, 08:56 |