📄 flagutil.html
字号:
<html><head><!-- /vobs/wpwr/docs/tornado-api/tgtint/flagutil.html - generated by refgen from flagutil.c --> <title> flagutil </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>Tornado API Reference : Target Server Internal Routines</i></a></p></blockquote><h1>flagutil</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>flagutil</strong> - argument parsing utility </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./flagutil.html#flagName">flagName</a></i>( )</b> - interprets an argument as a "string parameter required" argument.<br><b><i><a href="./flagutil.html#flagInt">flagInt</a></i>( )</b> - interprets an argument as an "integer parameter required" argument.<br><b><i><a href="./flagutil.html#flagBool">flagBool</a></i>( )</b> - interprets an argument as a boolean.<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library contains routines which can be used by backends to interpretarguments given to target server's command line.Those routines can be put in the<b>rtn</b> field of the <b>FLAG_DESC</b> structure array given by the backend in responseto a <b>bkendFlagsGet ()</b> invokation (see <i>API Programmer's Guide: Target ServerBack End</i> for details).Each of those routines is given the following two parameters :<pre>int argc, /* number of arguments */char * argv[], /* table of arguments */</pre>The last parameter differs according to the routine called. For instance, the<b>flagInt ()</b> routine takes an int address where to return the parsed value.<p>Each routine parses the <b>argv</b> vector of arguments, and can interpret up to<b>argc</b> arguments (<b>argc</b> represents the number of remaining arguments in thevector, and is used for boundary conditions). The first argument (<b>argv[0]</b>)represents the argument which caused the call to the routine. For instance, ifthe <b>"-foo"</b> argument causes the call to the <b>flagInt ()</b> routine, the firstargument will be <b>"-foo"</b> itself. The second argument should be an integervalue. The <b>flagInt ()</b> routine will store the integer value represented by thesecond argument at the given location. Each routine returns the number ofparsed arguments. The <b>flagInt ()</b> routine returns 1 if an argument has beenevaluated.<p></blockquote><h4>INCLUDE</h4><blockquote><p>#include "<b>flagutil.h</b>"<p></blockquote><h4>LIBRARY</h4><blockquote><p>Those routines are available when linking with the <b>libwpwr</b> shared lib.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./flagutil.html#top">flagutil</a></b>, <i>API Programmer's Guide: Target Server Back End </i>.<hr><a name="flagName"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines : Routines</i></a></p></blockquote><h1><i>flagName</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>flagName</i>( )</strong> - interprets an argument as a "string parameter required" argument.</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int flagName ( int argc, /* number of remaining arguments */ char * argv[], /* table of remaining arguments */ char * * pName /* pointer to name to set */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the given pointer to the address of the argument followingthe argument causing the call to this routine if this argument exists anddoes not begins with "-".<p>Use this routine to evaluate an argument like :<pre>-file /tmp/foo</pre>This routine will store the <b>"/tmp/foo"</b> string address in the pointer pointedto by <b>pName</b>.<p></blockquote><h4>RETURNS </h4><blockquote><p>1 if a parameter as been correctly evaluated, O otherwise.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./flagutil.html#top">flagutil</a></b><hr><a name="flagInt"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines : Routines</i></a></p></blockquote><h1><i>flagInt</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>flagInt</i>( )</strong> - interprets an argument as an "integer parameter required" argument.</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int flagInt ( int argc, /* number of remaining arguments */ char * argv[], /* table of remaining arguments */ int * pInt /* pointer to integer to set */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine evaluates the argument following the argument causing the call tothis routine as an integer. An integer can be signed (with a leading `<b>-</b>'),and can be represented in <b>octal</b> (with a leading `<b>0</b>'), <b>decimal</b> (default),or <b>hexadecimal</b> (with a leading <b>"0x"</b> or <b>"0X"</b>). All the argument stringmust be evaluated (e.g. a string like <b>"0FF"</b> won't be considered as correctbecause the `<b>0</b>' indicates an octal representation, and `<b>F</b>' is out of theoctal representaion characters array).<p>Use this routine to evaluate an argument like :<pre>-speed 9600</pre>This routine will store the value <b>9600</b> in the integer pointed to by <b>pInt</b>.<p></blockquote><h4>RETURNS </h4><blockquote><p>1 if an argument as been correctly translated, O otherwise.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./flagutil.html#top">flagutil</a></b><hr><a name="flagBool"></a><p align=right><a href="rtnIndex.html"><i>Target Server Internal Routines : Routines</i></a></p></blockquote><h1><i>flagBool</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>flagBool</i>( )</strong> - interprets an argument as a boolean.</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int flagBool ( int argc, /* number of remaining arguments */ char * argv[], /* table of remaining arguments */ BOOL * pBool /* pointer to boolean to set */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the given boolean pointer to TRUE.<p>Use this routine to evaluate an argument like :<pre>-Debug </pre>This routine will set <b>TRUE</b> in the BOOL pointed to by <b>pBool</b>.<p></blockquote><h4>RETURNS </h4><blockquote><p>0 always (it does not take any arguments).</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./flagutil.html#top">flagutil</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -