⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optionsfrom.3

📁 This a good VPN source
💻 3
字号:
.TH IPSEC_OPTIONSFROM 3 "16 Oct 1998".\" RCSID $Id: optionsfrom.3,v 1.9 2004/04/09 18:00:40 mcr Exp $.SH NAMEipsec optionsfrom \- read additional ``command-line'' options from file.SH SYNOPSIS.B "#include <freeswan.h>.sp.B "const char *optionsfrom(char *filename, int *argcp,".ti +1c.B "char ***argvp, int optind, FILE *errsto);".SH DESCRIPTION.I Optionsfromis called from within a.IR getopt_long (3)scan,as the result of the appearance of an option (preferably.BR \-\-optionsfrom )to insert additional ``command-line'' argumentsinto the scan immediately afterthe option.Typically this would be done to pick up options which aresecurity-sensitive and should not be visible to.IR ps (1)and similar commands,and hence cannot be supplied as partof the actual command line or the environment..PP.I Optionsfromreads the additional arguments from the specified.IR filename ,allocates a new argument vector to hold pointers to the existingarguments plus the new ones,and amends.I argcand.I argv(via the pointers.I argcpand.IR argvp ,which must point to the.I argcand.I argvbeing supplied to.IR getopt_long (3))accordingly..I Optindmust be the index, in the original argument vector,of the next argument..PPIf.I errstois NULL,.I optionsfromreturns NULL for success anda pointer to a string-literal error message for failure;see DIAGNOSTICS.If.I errstois non-NULL and an error occurs,.I optionsfromprints a suitable complaint onto the.I errstodescriptor and invokes.I exitwith an exit status of 2;this is a convenience for cases where more sophisticatedresponses are not required..PPThe text of existing arguments is not disturbed by.IR optionsfrom ,so pointers to them and into them remain valid..PPThe file of additional arguments is an ASCII text file.Lines consisting solely of white space,and lines beginning with.BR # ,are comments and are ignored.Otherwise, a line which does not begin with.BR \-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 withinthe line!).A line beginning with.B \-is considered to contain multiple arguments separated by white space..PPBecause.I optionsfromreads its entire file before the.IR getopt_long (3)scan is resumed, an.I optionsfromfile can contain another.B \-\-optionsfromoption.Obviously, infinite loops are possible here.If.I errstois non-NULL,.I optionsfromconsiders it an error to be called more than 100 times.If.I errstois NULL,loop detection is up to the caller(and the internal loop counter is zeroed out)..SH EXAMPLEA reasonable way to invoke.I optionsfromwould be like so:.PP.nf.ft B#include <getopt.h>struct option opts[] = {	/* ... */	"optionsfrom",	1,	NULL,	'+',	/* ... */};intmain(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;		/* ... */		}	/* ... */.ft.fi.SH SEE ALSOgetopt_long(3).SH DIAGNOSTICSErrors in.I optionsfromare:unable to open file;attempt to allocate temporary storage for argument orargument vector failed;read error in file;line too long..SH HISTORYWritten for the FreeS/WAN project by Henry Spencer..SH BUGSThe double-quote convention is rather simplistic..PPLine length is currently limited to 1023 bytes,and there is no continuation convention..PPThe 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..PPThe error-reporting convention lends itselfto slightly obscure code,because many readers will not think of NULL as signifying success..PPThere is a certain element of unwarranted chumminess withthe insides of.IR getopt_long (3)here.No non-public interfaces are actually used, but.IR optionsfromdoes rely on.IR getopt_long (3)being well-behaved in certain ways that are not actuallypromised by the specs.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -