1 Content-type: text/html
3 <HTML><HEAD><TITLE>Manpage of IPSEC_OPTIONSFROM</TITLE>
5 <H1>IPSEC_OPTIONSFROM</H1>
6 Section: C Library Functions (3)<BR>Updated: 16 Oct 1998<BR><A HREF="#index">Index</A>
7 <A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
10 <A NAME="lbAB"> </A>
13 ipsec optionsfrom - read additional ``command-line'' options from file
14 <A NAME="lbAC"> </A>
17 <B>#include <<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>></B>
20 <B>const char *optionsfrom(char *filename, int *argcp,</B>
24 <B>char ***argvp, int optind, FILE *errsto);</B>
26 <A NAME="lbAD"> </A>
31 is called from within a
32 <I><A HREF="getopt_long.3.html">getopt_long</A></I>(3)
35 as the result of the appearance of an option (preferably
38 to insert additional ``command-line'' arguments
39 into the scan immediately after
41 Typically this would be done to pick up options which are
42 security-sensitive and should not be visible to
43 <I><A HREF="ps.1.html">ps</A></I>(1)
46 and hence cannot be supplied as part
47 of the actual command line or the environment.
52 reads the additional arguments from the specified
55 allocates a new argument vector to hold pointers to the existing
56 arguments plus the new ones,
69 which must point to the
76 <I><A HREF="getopt_long.3.html">getopt_long</A></I>(3))
81 must be the index, in the original argument vector,
91 returns NULL for success and
92 a pointer to a string-literal error message for failure;
97 is non-NULL and an error occurs,
100 prints a suitable complaint onto the
103 descriptor and invokes
106 with an exit status of 2;
107 this is a convenience for cases where more sophisticated
108 responses are not required.
111 The text of existing arguments is not disturbed by
114 so pointers to them and into them remain valid.
117 The file of additional arguments is an ASCII text file.
118 Lines consisting solely of white space,
119 and lines beginning with
122 are comments and are ignored.
123 Otherwise, a line which does not begin with
126 is taken to be a single argument;
127 if it both begins and ends with double-quote ("),
128 those quotes are stripped off (note, no other processing is done within
130 A line beginning with
133 is considered to contain multiple arguments separated by white space.
139 reads its entire file before the
140 <I><A HREF="getopt_long.3.html">getopt_long</A></I>(3)
145 file can contain another
149 Obviously, infinite loops are possible here.
156 considers it an error to be called more than 100 times.
161 loop detection is up to the caller
162 (and the internal loop counter is zeroed out).
163 <A NAME="lbAE"> </A>
166 A reasonable way to invoke
173 <B>#include <<A HREF="file:/usr/include/getopt.h">getopt.h</A>>
175 struct option opts[] = {
177 "optionsfrom", 1, NULL, '+',
190 while ((opt = getopt_long(argc, argv, "", opts, NULL)) != EOF)
193 case '+': /* optionsfrom */
194 optionsfrom(optarg, &argc, &argv, optind, stderr);
195 /* does not return on error */
202 <A NAME="lbAF"> </A>
205 <A HREF="getopt_long.3.html">getopt_long</A>(3)
206 <A NAME="lbAG"> </A>
214 attempt to allocate temporary storage for argument or
215 argument vector failed;
218 <A NAME="lbAH"> </A>
221 Written for the FreeS/WAN project by Henry Spencer.
222 <A NAME="lbAI"> </A>
225 The double-quote convention is rather simplistic.
228 Line length is currently limited to 1023 bytes,
229 and there is no continuation convention.
232 The restriction of error reports to literal strings
233 (so that callers don't need to worry about freeing them or copying them)
234 does limit the precision of error reporting.
237 The error-reporting convention lends itself
238 to slightly obscure code,
239 because many readers will not think of NULL as signifying success.
242 There is a certain element of unwarranted chumminess with
244 <I><A HREF="getopt_long.3.html">getopt_long</A></I>(3)
247 No non-public interfaces are actually used, but
251 <I><A HREF="getopt_long.3.html">getopt_long</A></I>(3)
253 being well-behaved in certain ways that are not actually
254 promised by the specs.
258 <A NAME="index"> </A><H2>Index</H2>
260 <DT><A HREF="#lbAB">NAME</A><DD>
261 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
262 <DT><A HREF="#lbAD">DESCRIPTION</A><DD>
263 <DT><A HREF="#lbAE">EXAMPLE</A><DD>
264 <DT><A HREF="#lbAF">SEE ALSO</A><DD>
265 <DT><A HREF="#lbAG">DIAGNOSTICS</A><DD>
266 <DT><A HREF="#lbAH">HISTORY</A><DD>
267 <DT><A HREF="#lbAI">BUGS</A><DD>
270 This document was created by
271 <A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
272 using the manual pages.<BR>
273 Time: 05:09:32 GMT, June 19, 2001