aboutsummaryrefslogtreecommitdiff
path: root/man/man3/dirread.html
diff options
context:
space:
mode:
Diffstat (limited to 'man/man3/dirread.html')
-rw-r--r--man/man3/dirread.html114
1 files changed, 114 insertions, 0 deletions
diff --git a/man/man3/dirread.html b/man/man3/dirread.html
new file mode 100644
index 00000000..7c5ba4ed
--- /dev/null
+++ b/man/man3/dirread.html
@@ -0,0 +1,114 @@
+<head>
+<title>dirread(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>DIRREAD(3)</b><td align=right><b>DIRREAD(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>
+
+ dirread, dirreadall &ndash; read directory<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;
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>long dirread(int fd, Dir **buf)
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>long dirreadall(int fd, Dir **buf)
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>#define &nbsp;&nbsp;&nbsp;&nbsp;STATMAX &nbsp;&nbsp;&nbsp;&nbsp;65535U
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>#define &nbsp;&nbsp;&nbsp;&nbsp;DIRMAX &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(sizeof(Dir)+STATMAX)<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>
+
+ The data returned by a <a href="../man3/read.html"><i>read</i>(3)</a> on a directory is a set of complete
+ directory entries in a machine-independent format, exactly equivalent
+ to the result of a <a href="../man3/stat.html"><i>stat</i>(3)</a> on each file or subdirectory in the
+ directory. <i>Dirread</i> decodes the directory entries into a machine-dependent
+ form. It reads from <i>fd</i> and unpacks the data
+ into an array of <tt><font size=+1>Dir</font></tt> structures whose address is returned in <tt><font size=+1>*buf</font></tt>
+ (see <a href="../man3/stat.html"><i>stat</i>(3)</a> for the layout of a <tt><font size=+1>Dir</font></tt>). The array is allocated
+ with <a href="../man3/malloc.html"><i>malloc</i>(3)</a> each time <i>dirread</i> is called.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Dirreadall</i> is like <i>dirread</i>, but reads in the entire directory;
+ by contrast, <i>dirread</i> steps through a directory one <a href="../man3/read.html"><i>read</i>(3)</a> at
+ a time.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ Directory entries have variable length. A successful <i>read</i> of a
+ directory always returns an integral number of complete directory
+ entries; <i>dirread</i> always returns complete <tt><font size=+1>Dir</font></tt> structures. See <i>read</i>(9p)
+ for more information.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ The constant <tt><font size=+1>STATMAX</font></tt> is the maximum size that a directory entry
+ can occupy. The constant <tt><font size=+1>DIRMAX</font></tt> is an upper limit on the size
+ necessary to hold a <tt><font size=+1>Dir</font></tt> structure and all the associated data.
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Dirread</i> and <i>dirreadall</i> return the number of <tt><font size=+1>Dir</font></tt> structures filled
+ in <tt><font size=+1>buf</font></tt>. The file offset is advanced by the number of bytes actually
+ read.<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/lib9/dirread.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/intro.html"><i>intro</i>(3)</a>, <a href="../man3/open.html"><i>open</i>(3)</a>, <a href="../man3/read.html"><i>read</i>(3)</a><br>
+
+</table>
+<p><font size=+1><b>DIAGNOSTICS </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <i>Dirread</i> and <i>Dirreadall</i> return zero for end of file and a negative
+ value for error. In either case, <tt><font size=+1>*buf</font></tt> is set to <tt><font size=+1>nil</font></tt> so the pointer
+ can always be freed with impunity.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ These functions set <i>errstr</i>.<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>