linux/fs/ncpfs/getopt.c
<<
opti v3/spa v3/form v3a opti v href="../linux+v3ue=1/fs/ncpfs/get.12.c">opti v3img src="../.static/gfx/right.png" alt=">>">op3/spa op3spa class="lxr_search">optiopti v3input typon>hidden" namon>navtarget"/option>">opti v3input typon>text" namon>search" idn>search">opti v3butt2submit">Searchopti vPrefs v3/a>op3/spa ti v v3/div ti v v3form ac2" ="ajax+*" method="post" onsubmit="return false;">op3input typon>hidden" namon>ajax_lookup" idn>ajax_lookup" option>">oti v v3/form oti v v3div class="headingbott2m">
search_results" class="search_results" ti v v3/div 3div idn>content"> 3div idn>file_contents"
11/0c/ebee31df36d10c43d853dfda16986ff0df60_3/0" L1" class="line" namon>L1">v v13/a>3spa	 class="comment">/*3/spa	  L2" class="line" namon>L2">v v23/a>3spa	 class="comment"> * get.12.c3/spa	  L3" class="line" namon>L3">v v33/a>3spa	 class="comment"> */3/spa	  L4" class="line" namon>L4">v v43/a>oL5" class="line" namon>L5">v v53/a>#include <linux/kernel.h3/a>>oL6" class="line" namon>L6">v v63/a>#include <linux/string.h3/a>>oL7" class="line" namon>L7">v v73/a>oL8" class="line" namon>L8">v v83/a>#include <asm/errno.h3/a>>oL9" class="line" namon>L9">v v93/a>oL10" class="line" namon>L10">v v3.8a>#include "get.12.h3/a>"oL11" class="line" namon>L11">v 113/a>oL12" class="line" namon>L12">v 123/a>3spa	 class="comment">/**3/spa	  L13" class="line" namon>L13">v 133/a>3spa	 class="comment"> *ti v vncp_get.12 - .4.12L14" class="line" namon>L14">v 143/a>3spa	 class="comment"> *ti v v@caller: namo of the caller, for error messages3/spa	  L15" class="line" namon>L15">v 153/a>3spa	 class="comment"> *ti v v@.4.12L16" class="line" namon>L16">v 163/a>3spa	 class="comment"> *ti v v@.4.s: a	 array of &struct .4.12L17" class="line" namon>L17">v 173/a>3spa	 class="comment"> *ti v v@.4..4.: output; will contain the current .4.12<3/spa	  L18" class="line" namon>L18">v 183/a>3spa	 class="comment"> *ti v v@.4.arg: output; will contain the optio (if one exists)3/spa	  L19" class="line" namon>L19">v 193/a>3spa	 class="comment"> *ti v v@optio: output; may be NULL; will be overwritten with the integer optio3/spa	  L20" class="line" namon>L20">v 203/a>3spa	 class="comment"> *ti v vvvvvvvvvof the current argument.3/spa	  L21" class="line" namon>L21">v 213/a>3spa	 class="comment"> *3/spa	  L22" class="line" namon>L22">v 223/a>3spa	 class="comment"> *      Hel4er to/parse .4.12L23" class="line" namon>L23">v 233/a>3spa	 class="comment"> *ti v vReturns .4.s->opt if a matching/entry in the '.4.s' array is found,3/spa	  L24" class="line" namon>L24">v 243/a>3spa	 class="comment"> *ti v v0 when no more tokens are found, -1 if an error is encountered.3/spa	  L25" class="line" namon>L25">v 253/a>3spa	 class="comment"> */3/spa	  L26" class="line" namon>L26">v 263/a>intv3a href="+code=ncp_get.12" class="sref">ncp_get.123/a>(const char *3a href="+code=caller" class="sref">caller3/a>, char **3a href="+code=.4.12.4.12, const struct 3a href="+code=ncp_.4.12<" class="sref">ncp_.4.12<3/a> *3a href="+code=.4.s" class="sref">.4.s3/a>, L27" class="line" namon>L27">v 273/a>ti v vvvvvvvvv char **3a href="+code=.4..12" class="sref">.4..123/a>, char **3a href="+code=.4.arg" class="sref">.4.arg3/a>, unsigned long/*3a href="+code=optio" class="sref">optio3/a>) L28" class="line" namon>L28">v 283/a>{ L29" class="line" namon>L29">v 293/a>ti v vvvchar *3a href="+code=token" class="sref">token3/a>;oL30" class="line" namon>L30">v 303/a>ti v vvvchar *3a href="+code=opt" class="sref">opt3/a>;oL31" class="line" namon>L31">v 313/a>oL32" class="line" namon>L32">v 323/a>ti v vvvdo { L33" class="line" namon>L33">v 333/a>ti v vvvvvvvvv  if ((3a href="+code=token" class="sref">token3/a> = 3a href="+code=strsep" class="sref">strsep3/a>(3a href="+code=.4.12.4.12, 3spa	 class="string">","NULL3/a>) L34" class="line" namon>L34">v 343/a>ti v vvvvvvvvv          return 0;oL35" class="line" namon>L35">v 353/a>ti v vvv} whilo (*3a href="+code=token" class="sref">token3/a> == 3spa	 class="string">'\0'L36" class="line" namon>L36">v 363/a>ti v vvvif (3a href="+code=.4..12" class="sref">.4..123/a>) L37" class="line" namon>L37">v 373/a>ti v vvvvvvvvv  *3a href="+code=.4..12" class="sref">.4..123/a> = 3a href="+code=token" class="sref">token3/a>;oL38" class="line" namon>L38">v 383/a>oL39" class="line" namon>L39">v 393/a>ti v vvvif ((3a href="+code=opt" class="sref">opt3/a> = 3a href="+code=strchr" class="sref">strchr3/a> (3a href="+code=token" class="sref">token3/a>, 3spa	 class="string">'='NULL3/a>) { L40" class="line" namon>L40">v 403/a>ti v vvvvvvvvv  *3a href="+code=opt" class="sref">opt3/a>++ = 0;oL41" class="line" namon>L41">v 413/a>ti v vvv}oL42" class="line" namon>L42">v 423/a>ti v vvv*3a href="+code=.4.arg" class="sref">.4.arg3/a> = 3a href="+code=opt" class="sref">opt3/a>;oL43" class="line" namon>L43">v 433/a>ti v vvvfor (; 3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=namo" class="sref">namo3/a>; 3a href="+code=.4.s" class="sref">.4.s3/a>++) { L44" class="line" namon>L44">v 443/a>ti v vvvvvvvvv  if (!3a href="+code=strcmp" class="sref">strcmp3/a>(3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=namo" class="sref">namo3/a>, 3a href="+code=token" class="sref">token3/a>)) { L45" class="line" namon>L45">v 453/a>ti v vvvvvvvvv          if (!3a href="+code=opt" class="sref">opt3/a>) { L46" class="line" namon>L46">v 463/a>ti v vvvvvvvvv          ti v vvvif (3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=has_arg" class="sref">has_arg3/a>t& 3a href="+code=OPT_NOPARAM" class="sref">OPT_NOPARAM3/a>) { L47" class="line" namon>L47">v 473/a>ti v vvvvvvvvv                          return 3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=opt" class="sref">opt3/a>;oL48" class="line" namon>L48">v 483/a>ti v vvvvvvvvv                  }oL49" class="line" namon>L49">v 493/a>ti v vvvvvvvvv                  3a href="+code=printk" class="sref">printk3/a>(3a href="+code=KERN_INFO" class="sref">KERN_INFO3/a>t3spa	 class="string">"%s: the %s .4.12L50" class="line" namon>L50">v 503/a>ti v vvvvvvvvv  vvvvv                  3a href="+code=caller" class="sref">caller3/a>, 3a href="+code=token" class="sref">token3/a>);oL51" class="line" namon>L51">v 513/a>ti v vvvvvvvvv  vvvvv           return -3a href="+code=EINVAL" class="sref">EINVAL3/a>;oL52" class="line" namon>L52">v 523/a>ti v vvvvvvvvv  vvvvv   }oL53" class="line" namon>L53">v 533/a>ti v vvvvvvvvv          if (3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=has_arg" class="sref">has_arg3/a>t& 3a href="+code=OPT_INT" class="sref">OPT_INT3/a>) { L54" class="line" namon>L54">v 543/a>ti v vvvvvvvvv                  char* 3a href="+code=o" class="sref">o3/a>;oL55" class="line" namon>L55">v 553/a>oL56" class="line" namon>L56">v 563/a>ti v vvvvvvvvv          ti v vvv*3a href="+code=optio" class="sref">optio3/a> = 3a href="+code=simple_strtout" class="sref">simple_strtout3/a>(3a href="+code=opt" class="sref">opt3/a>,t&3a href="+code=o" class="sref">o3/a>, 0);oL57" class="line" namon>L57">v 573/a>ti v vvvvvvvvv                  if (!*3a href="+code=o" class="sref">o3/a>) { L58" class="line" namon>L58">v 583/a>ti v vvvvvvvvv                          return 3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=opt" class="sref">opt3/a>;oL59" class="line" namon>L59">v 593/a>ti v vvvvvvvvv                  }oL60" class="line" namon>L60">v 603/a>ti v vvvvvvvvv  vvvvv           3a href="+code=printk" class="sref">printk3/a>(3a href="+code=KERN_INFO" class="sref">KERN_INFO3/a>t3spa	 class="string">"%s: inoptid numeric optio in %s=%s\n"L61" class="line" namon>L61">v 613/a>ti v vvvvvvvvv  vvvvv                   3a href="+code=caller" class="sref">caller3/a>, 3a href="+code=token" class="sref">token3/a>, 3a href="+code=opt" class="sref">opt3/a>);oL62" class="line" namon>L62">v 623/a>ti v vvvvvvvvv  vvvvv           return -3a href="+code=EDOM" class="sref">EDOM3/a>;oL63" class="line" namon>L63">v 633/a>ti v vvvvvvvvv          }oL64" class="line" namon>L64">v 643/a>ti v vvvvvvvvv          if (3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=has_arg" class="sref">has_arg3/a>t& 3a href="+code=OPT_STRING" class="sref">OPT_STRING3/a>) { L65" class="line" namon>L65">v 653/a>ti v vvvvvvvvv                  return 3a href="+code=.4.s" class="sref">.4.s3/a>->3a href="+code=opt" class="sref">opt3/a>;oL66" class="line" namon>L66">v 663/a>ti v vvvvvvvvv          }oL67" class="line" namon>L67">v 673/a>ti v vvvvvvvvv          3a href="+code=printk" class="sref">printk3/a>(3a href="+code=KERN_INFO" class="sref">KERN_INFO3/a>t3spa	 class="string">"%s: unexpected argument %s to the %s .4.12<\n"L68" class="line" namon>L68">v 683/a>ti v vvvvvvvvv                  3a href="+code=caller" class="sref">caller3/a>, 3a href="+code=opt" class="sref">opt3/a>,t3a href="+code=token" class="sref">token3/a>);oL69" class="line" namon>L69">v 693/a>ti v vvvvvvvvv          return -3a href="+code=EINVAL" class="sref">EINVAL3/a>;oL70" class="line" namon>L70">v 703/a>ti v vvvvvvvvv  }oL71" class="line" namon>L71">v 713/a>ti v vvv}oL72" class="line" namon>L72">v 723/a>ti v vvv3a href="+code=printk" class="sref">printk3/a>(3a href="+code=KERN_INFO" class="sref">KERN_INFO3/a>t3spa	 class="string">"%s: Unrecognized mount .4.12caller3/a>, 3a href="+code=token" class="sref">token3/a>);oL73" class="line" namon>L73">v 733/a>ti v vvvreturn -3a href="+code=EOPNOTSUPP" class="sref">EOPNOTSUPP3/a>;oL74" class="line" namon>L74">v 743/a>}oL75" class="line" namon>L75">v 753/a>3/pre>
The .riginal LXR software by the LXR community3/a>, this experimental vers12lxr@linux.no3/a>. 3/div 3div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS3/a>, provider .f Linux consulting/and .4era.12