aboutsummaryrefslogtreecommitdiff
path: root/man/man3/9p-cmdbuf.html
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-14 03:45:44 +0000
committerrsc <devnull@localhost>2005-01-14 03:45:44 +0000
commit78e51a8c6678b6e3dff3d619aa786669f531f4bc (patch)
tree015e00fde4fc837fd31b705e18d17dc913829388 /man/man3/9p-cmdbuf.html
parent2634795b5f0053bc0ff08e5d7bbc0eda8efea061 (diff)
downloadplan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.gz
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.bz2
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.zip
checkpoint
Diffstat (limited to 'man/man3/9p-cmdbuf.html')
-rw-r--r--man/man3/9p-cmdbuf.html128
1 files changed, 128 insertions, 0 deletions
diff --git a/man/man3/9p-cmdbuf.html b/man/man3/9p-cmdbuf.html
new file mode 100644
index 00000000..122a5857
--- /dev/null
+++ b/man/man3/9p-cmdbuf.html
@@ -0,0 +1,128 @@
+<head>
+<title>9p-cmdbuf(3) - Plan 9 from User Space</title>
+<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
+</head>
+<body bgcolor=#ffffff>
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=10><td>
+<tr><td width=20><td>
+<tr><td width=20><td><b>9P-CMDBUF(3)</b><td align=right><b>9P-CMDBUF(3)</b>
+<tr><td width=20><td colspan=2>
+ <br>
+<p><font size=+1><b>NAME </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ Cmdbuf, parsecmd, respondcmderror, lookupcmd &ndash; control message
+ parsing<br>
+
+</table>
+<p><font size=+1><b>SYNOPSIS </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>#include &lt;u.h&gt;<br>
+ #include &lt;libc.h&gt;<br>
+ #include &lt;fcall.h&gt;<br>
+ #include &lt;thread.h&gt;<br>
+ #include &lt;9p.h&gt;<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ typedef struct Cmdbuf<br>
+ {<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*buf;<br>
+ char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**f;<br>
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nf;<br>
+
+ </table>
+ } Cmdbuf;<br>
+ typedef struct Cmdtab<br>
+ {<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index;<br>
+ char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*cmd;<br>
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;narg;<br>
+
+ </table>
+ };<br>
+ Cmdbuf &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*parsecmd(char *p, int n)<br>
+ Cmdtab &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*lookupcmd(Cmdbuf *cb, Cmdtab *tab, int ntab)<br>
+ void &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;respondcmderror(Req *r, Cmdbuf *cb, char *fmt, ...)<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>DESCRIPTION </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ These data structures and functions provide parsing of textual
+ control messages.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Parsecmd</i> treats the <i>n</i> bytes at <i>p</i> (which need not be NUL-terminated)
+ as a UTF string and splits it using <i>tokenize</i> (see <a href="../man3/getfields.html"><i>getfields</i>(3)</a>).
+ It returns a <tt><font size=+1>Cmdbuf</font></tt> structure holding pointers to each field in
+ the message.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Lookupcmd</i> walks through the array <i>ctab</i>, which has <i>ntab</i> entries,
+ looking for the first <tt><font size=+1>Cmdtab</font></tt> that matches the parsed command.
+ (If the parsed command is empty, <i>lookupcmd</i> returns nil immediately.)
+ A <tt><font size=+1>Cmdtab</font></tt> matches the command if <i>cmd</i> is equal to <i>cb</i><tt><font size=+1>&#8722;&gt;</font></tt><i>f</i><tt><font size=+1>[0]</font></tt> or if
+ <i>cmd</i> is <tt><font size=+1>*</font></tt>. Once a matching <tt><font size=+1>Cmdtab</font></tt> has been
+ found, if <i>narg</i> is not zero, then the parsed command must have
+ exactly <i>narg</i> fields (including the command string itself). If
+ the command has the wrong number of arguments, <i>lookupcmd</i> returns
+ nil. Otherwise, it returns a pointer to the <tt><font size=+1>Cmdtab</font></tt> entry. If <i>lookupcmd</i>
+ does not find a matching command at all, it returns
+ nil. Whenever <i>lookupcmd</i> returns nil, it sets the system error
+ string.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Respondcmderror</i> resoponds to request <i>r</i> with an error of the form
+ &#8216;<i>fmt</i>: <i>cmd</i>,&#8217; where <i>fmt</i> is the formatted string and <i>cmd</i> is a reconstruction
+ of the parsed command. Fmt is often simply <tt><font size=+1>%r .<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>EXAMPLES </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ This interface is not used in any distributed 9P servers. It was
+ lifted from the Plan 9 kernel. Almost any Plan 9 kernel driver
+ (<tt><font size=+1>/sys/src/9/*/dev*.c</font></tt> on Plan 9) is a good example.<br>
+
+</table>
+<p><font size=+1><b>SOURCE </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>/usr/local/plan9/src/lib9p/parse.c<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>SEE ALSO </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <a href="../man3/9p.html"><i>9p</i>(3)</a><br>
+
+</table>
+
+<td width=20>
+<tr height=20><td>
+</table>
+<!-- TRAILER -->
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=15><td width=10><td><td width=10>
+<tr><td><td>
+<center>
+<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
+</center>
+</table>
+<!-- TRAILER -->
+</body></html>