diff options
Diffstat (limited to 'doc/manpage.d/ipsec_optionsfrom.3.html')
-rw-r--r-- | doc/manpage.d/ipsec_optionsfrom.3.html | 275 |
1 files changed, 275 insertions, 0 deletions
diff --git a/doc/manpage.d/ipsec_optionsfrom.3.html b/doc/manpage.d/ipsec_optionsfrom.3.html new file mode 100644 index 000000000..05d045e4d --- /dev/null +++ b/doc/manpage.d/ipsec_optionsfrom.3.html @@ -0,0 +1,275 @@ +Content-type: text/html + +<HTML><HEAD><TITLE>Manpage of IPSEC_OPTIONSFROM</TITLE> +</HEAD><BODY> +<H1>IPSEC_OPTIONSFROM</H1> +Section: C Library Functions (3)<BR>Updated: 16 Oct 1998<BR><A HREF="#index">Index</A> +<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR> + + +<A NAME="lbAB"> </A> +<H2>NAME</H2> + +ipsec optionsfrom - read additional ``command-line'' options from file +<A NAME="lbAC"> </A> +<H2>SYNOPSIS</H2> + +<B>#include <<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>></B> + +<P> +<B>const char *optionsfrom(char *filename, int *argcp,</B> + +<BR> + +<B>char ***argvp, int optind, FILE *errsto);</B> + +<A NAME="lbAD"> </A> +<H2>DESCRIPTION</H2> + +<I>Optionsfrom</I> + +is called from within a +<I><A HREF="getopt_long.3.html">getopt_long</A></I>(3) + +scan, +as the result of the appearance of an option (preferably +<B>--optionsfrom</B>) + +to insert additional ``command-line'' arguments +into the scan immediately after +the option. +Typically this would be done to pick up options which are +security-sensitive and should not be visible to +<I><A HREF="ps.1.html">ps</A></I>(1) + +and similar commands, +and hence cannot be supplied as part +of the actual command line or the environment. +<P> + +<I>Optionsfrom</I> + +reads the additional arguments from the specified +<I>filename</I>, + +allocates a new argument vector to hold pointers to the existing +arguments plus the new ones, +and amends +<I>argc</I> + +and +<I>argv</I> + +(via the pointers +<I>argcp</I> + +and +<I>argvp</I>, + +which must point to the +<I>argc</I> + +and +<I>argv</I> + +being supplied to +<I><A HREF="getopt_long.3.html">getopt_long</A></I>(3)) + +accordingly. +<I>Optind</I> + +must be the index, in the original argument vector, +of the next argument. +<P> + +If +<I>errsto</I> + +is NULL, +<I>optionsfrom</I> + +returns NULL for success and +a pointer to a string-literal error message for failure; +see DIAGNOSTICS. +If +<I>errsto</I> + +is non-NULL and an error occurs, +<I>optionsfrom</I> + +prints a suitable complaint onto the +<I>errsto</I> + +descriptor and invokes +<I>exit</I> + +with an exit status of 2; +this is a convenience for cases where more sophisticated +responses are not required. +<P> + +The text of existing arguments is not disturbed by +<I>optionsfrom</I>, + +so pointers to them and into them remain valid. +<P> + +The file of additional arguments is an ASCII text file. +Lines consisting solely of white space, +and lines beginning with +<B>#</B>, + +are comments and are ignored. +Otherwise, a line which does not begin with +<B>-</B> + +is taken to be a single argument; +if it both begins and ends with double-quote ("), +those quotes are stripped off (note, no other processing is done within +the line!). +A line beginning with +<B>-</B> + +is considered to contain multiple arguments separated by white space. +<P> + +Because +<I>optionsfrom</I> + +reads its entire file before the +<I><A HREF="getopt_long.3.html">getopt_long</A></I>(3) + +scan is resumed, an +<I>optionsfrom</I> + +file can contain another +<B>--optionsfrom</B> + +option. +Obviously, infinite loops are possible here. +If +<I>errsto</I> + +is non-NULL, +<I>optionsfrom</I> + +considers it an error to be called more than 100 times. +If +<I>errsto</I> + +is NULL, +loop detection is up to the caller +(and the internal loop counter is zeroed out). +<A NAME="lbAE"> </A> +<H2>EXAMPLE</H2> + +A reasonable way to invoke +<I>optionsfrom</I> + +would be like so: +<P> + +<PRE> +<B>#include <<A HREF="file:/usr/include/getopt.h">getopt.h</A>> + +struct option opts[] = { + /* ... */ + "optionsfrom", 1, NULL, '+', + /* ... */ +}; + +int +main(argc, argv) +int argc; +char *argv[]; +{ + int opt; + extern char *optarg; + extern int optind; + + while ((opt = getopt_long(argc, argv, "", opts, NULL)) != EOF) + switch (opt) { + /* ... */ + case '+': /* optionsfrom */ + optionsfrom(optarg, &argc, &argv, optind, stderr); + /* does not return on error */ + break; + /* ... */ + } + /* ... */ +</B></PRE> + +<A NAME="lbAF"> </A> +<H2>SEE ALSO</H2> + +<A HREF="getopt_long.3.html">getopt_long</A>(3) +<A NAME="lbAG"> </A> +<H2>DIAGNOSTICS</H2> + +Errors in +<I>optionsfrom</I> + +are: +unable to open file; +attempt to allocate temporary storage for argument or +argument vector failed; +read error in file; +line too long. +<A NAME="lbAH"> </A> +<H2>HISTORY</H2> + +Written for the FreeS/WAN project by Henry Spencer. +<A NAME="lbAI"> </A> +<H2>BUGS</H2> + +The double-quote convention is rather simplistic. +<P> + +Line length is currently limited to 1023 bytes, +and there is no continuation convention. +<P> + +The restriction of error reports to literal strings +(so that callers don't need to worry about freeing them or copying them) +does limit the precision of error reporting. +<P> + +The error-reporting convention lends itself +to slightly obscure code, +because many readers will not think of NULL as signifying success. +<P> + +There is a certain element of unwarranted chumminess with +the insides of +<I><A HREF="getopt_long.3.html">getopt_long</A></I>(3) + +here. +No non-public interfaces are actually used, but +<I>optionsfrom</I> + +does rely on +<I><A HREF="getopt_long.3.html">getopt_long</A></I>(3) + +being well-behaved in certain ways that are not actually +promised by the specs. +<P> + +<HR> +<A NAME="index"> </A><H2>Index</H2> +<DL> +<DT><A HREF="#lbAB">NAME</A><DD> +<DT><A HREF="#lbAC">SYNOPSIS</A><DD> +<DT><A HREF="#lbAD">DESCRIPTION</A><DD> +<DT><A HREF="#lbAE">EXAMPLE</A><DD> +<DT><A HREF="#lbAF">SEE ALSO</A><DD> +<DT><A HREF="#lbAG">DIAGNOSTICS</A><DD> +<DT><A HREF="#lbAH">HISTORY</A><DD> +<DT><A HREF="#lbAI">BUGS</A><DD> +</DL> +<HR> +This document was created by +<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>, +using the manual pages.<BR> +Time: 21:40:18 GMT, November 11, 2003 +</BODY> +</HTML> |