autodoc.git
/
traditional_manual
/
chapter_9.html
version
»
Context lines:
10
20
40
80
file
none
3
autodoc.git/traditional_manual/chapter_9.html:398:
called once.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function is only available on some platforms.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Inherit</span>
+
<span class='homogen--name'><b>Fd</b></span>
+
</dt>
+
<dd><p><code><span class='datatype'><code class='modifier'>optional</code> inherit Fd</span> : <span class='inherit'>Fd</span></code></p></dd>
+
</dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Inherit</span>
<span class='homogen--name'><b>Fd_ref</b></span> </dt> <dd><p><code><span class='datatype'><code class='modifier'>optional</code> inherit Fd_ref</span> : <span class='inherit'>Fd_ref</span></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>is_open</b></span>
autodoc.git/traditional_manual/chapter_9.html:610:
<dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>close()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>open_socket</b></span> </dt>
-
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>open_socket</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>port</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>address</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>family</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>open_socket</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>port</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>address</code>, <code class='datatype'>int</code>|<code class='datatype'>
string</code>|<code class='datatype'>
void</code> <code class='argument'>family
_hint
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This makes this file into a socket ready for connections. The reason for this function is so that you can set the socket to nonblocking or blocking (default is blocking) before you call <code>connect()</code>.</p>
-
<p> If you give a <code>port</code> number to this function, the socket will be
-
bound to this <code>port</code> locally before connecting anywhere. This is
-
only useful for some silly protocols like <b>FTP</b>. You may also
-
specify an <code>address</code> to bind to if your machine has many IP numbers.</p>
-
<p> <code>port</code> can also be specified as a string, giving the name of the
-
service associated with the port.</p>
-
<p> Finally, a protocol <code>family</code> for the socket can be specified.
-
If no <code>family</code> is specified, one which is appropriate for the
-
<code>address</code> is automatically selected. Thus, there is normally
-
no need to specify it.</p>
+
</dd>
-
+
<dt class='head--doc'><span id='p-port'></span>Parameter <code class='parameter'>port</code></dt>
+
<dd></dd><dd class='body--doc'><p>If you give a port number to this function, the socket will be
+
bound to this port locally before connecting anywhere. This is
+
only useful for some silly protocols like <b>FTP</b>. The port can
+
also be specified as a string, giving the name of the service
+
associated with the port.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-address'></span>Parameter <code class='parameter'>address</code></dt>
+
<dd></dd><dd class='body--doc'><p>You may specify an address to bind to if your machine has many IP
+
numbers.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-family_hint'></span>Parameter <code class='parameter'>family_hint</code></dt>
+
<dd></dd><dd class='body--doc'><p>A protocol family for the socket can be specified. If no family is
+
specified, one which is appropriate for the address is automatically
+
selected. Thus, there is normally no need to specify it. If you
+
do not want to specify a bind address, you can provide the address
+
as a hint here instead, to allow the automatic selection to work
+
anyway.</p>
+
</dd>
<dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>This function returns 1 for success, 0 otherwise.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>connect()</code>, <code>set_nonblocking()</code>, <code>set_blocking()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>open_socket</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>open_socket</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>port</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>addr</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>family</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
+
<span class='homogen--name'><b>openat</b></span>
+
</dt>
+
<dd><p><code><code class='object unresolved'>File</code> <b><span class='method'>openat</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code><br>
+
<code><code class='object unresolved'>File</code> <b><span class='method'>openat</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code>, <code class='datatype'>int</code> <code class='argument'>mask</code><b>)</b></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Open a file relative to an open directory.</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p><code>File.statat()</code>, <code>File.unlinkat()</code></p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
<span class='homogen--name'><b>openpt</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>openpt</span>(</b><code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Open the master end of a pseudo-terminal pair. The parameter <code>mode</code> should contain one or more of the following letters:</p> <table class='box'><tr><td><code><code class='key'>"r"</code></code></td><td><p>Open terminal for reading.</p> </td></tr> <tr><td><code><code class='key'>"w"</code></code></td><td><p>Open terminal for writing.</p>
autodoc.git/traditional_manual/chapter_9.html:1194:
running at a time, so you don't need mutexes between them.</p> <p> Unless you've specified otherwise with the <code>set_backend</code> function, the default backend <code>Pike.DefaultBackend</code> will be used. It's normally activated by returning <code class='expr'>-1</code> from the <tt>main</tt> function and will then execute in the main thread.</p> <ul> <li><p>When data arrives on the stream, <code>read_cb</code> will be called with some or all of that data as the second argument.</p> </li><li><p>When the stream has buffer space over for writing, <code>write_cb</code> will be called so that you can write more data to it.</p>
+
<p> This callback is also called after the remote end of a socket
+
connection has closed the write direction. An attempt to write
+
data to it in that case will generate a <code>System.EPIPE</code> errno.
+
If the remote end has closed both directions simultaneously
+
(the usual case), Pike will first attempt to call <code>close_cb</code>,
+
then this callback (unless <code>close_cb</code> has closed the stream).</p>
</li><li><p>When out-of-band data arrives on the stream, <code>read_oob_cb</code> will be called with some or all of that data as the second argument.</p> </li><li><p>When the stream allows out-of-band data to be sent, <code>write_oob_cb</code> will be called so that you can write more out-of-band data to it.</p>
-
<
/li
><
li
><
p
>
When
the
stream
has
been
shut
down
,
either
due
to
an
error
or
-
a
close
from
the
other
end, <code>close_cb</code> will be called.
-
<code>errno</code> will return the
error
that
has
occurred
or zero in
-
the
case
of
a
normal
close
.
Note
that
<code>close_cb</code>
will
not be
-
called for a local close, neither by a call to <code>close</code> or by
-
destructing this object.</p>
-
</li></ul><p>All callbacks will receive the <tt>id</tt> set by <code>set_id</code> as
+
<
p> If the OS doesn't separate the write events for normal and
+
out-of-band data, Pike will try to call <code>write_oob_cb<
/
code
>
first.
+
If it doesn't write anything, then
<
code
>
write_cb
<
/code
>
will be tried.
+
This also means that <code>write_oob_cb</code> might get called when
the
+
remote
end
of
a
connection
has
closed the write direction.</p>
+
</li><li><p>When
an error or
an
end-of-stream
in
the
read
direction
+
occurs
, <code>close_cb</code> will be called. <code>errno</code> will return the
+
error,
or zero in
the case of an end-of-stream.</p>
+
<p>
The
name
of
this callback is rather unfortunate since it
+
really has nothing to do with
a close
:
The
stream
is still
+
open when
<code>close_cb</code>
is
called (you might
not be
able to read
+
and/or write to it, but you can still use things like
+
<code>query_address</code>, and the underlying file descriptor is still
+
allocated). Also, this callback will not be
called for a local
+
close, neither by a call to <code>close</code> or by destructing this
+
object.</p>
+
<
p> Also, <code>close_cb<
/
code> will not be called if a remote close only
+
occurs in the write direction; that is handled by <code>write_cb</code>
+
(or possibly <code>write_oob_cb</code>).</p>
+
<p> Events to <code>read_cb</code> and <code>close_cb</code> will be automatically
+
deregistered if an end-of-stream occurs, and all events in the
+
case of an error. I.e. there won't be any more calls to the
+
callbacks unless they are reinstalled. This doesn't affect the
+
callback settings - <code>query_read_callback</code> et al will still
+
return the installed callbacks.</p>
+
</
li></ul><p>
If the stream is a socket performing a nonblocking connect (see
+
<code>open_socket</code> and <code>connect</code>), a connection failure will call
+
<code>close_cb</code>, and a successful connect will call either
+
<code>read_cb</code> or <code>write_cb</code> as above.</p>
+
<p>
All callbacks will receive the <tt>id</tt> set by <code>set_id</code> as
first argument.</p> <p> If a callback returns <code class='expr'>-1</code>, no other callback or call out will be called by the backend in that round. I.e. the caller of the backend will get control back right away. For the default backend that means it will immediately start another round and check files and call outs anew.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>These functions do not set the file nonblocking.</p> </dd>
autodoc.git/traditional_manual/chapter_9.html:1672:
<dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Returns an <code class='expr'>int</code> and not a <code class='expr'>string</code> of length 1.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>gets</b></span> </dt>
-
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>gets</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>gets</span>(</b><
code class='datatype'>bool</code>|<code class='datatype'>void</code> <code class='argument'>not_all</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Read one line of input with support for input conversion.</p> </dd>
-
+
<dt class='head--doc'><span id='p-not_all'></span>Parameter <code class='parameter'>not_all</code></dt>
+
<dd></dd><dd class='body--doc'><p>Set this parameter to ignore partial lines at EOF. This
+
is useful for eg monitoring a growing logfile.</p>
+
</dd>
<dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>This function returns the line read if successful, and <code class='expr'>0</code> if no more lines are available.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>ngets()</code>, <code>read()</code>, <code>line_iterator()</code>, <code>set_charset()</code></p> </dd></dl> <hr />
autodoc.git/traditional_manual/chapter_9.html:1707:
<dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>line_iterator</b></span> </dt> <dd><p><code><code class='datatype'>object</code> <b><span class='method'>line_iterator</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>trim</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns an iterator that will loop over the lines in this file. If <code>trim</code> is true, all <tt>'\r'</tt> characters will be removed from the input.</p> </dd>
+
<dt class='head--doc'>Note</dt>
+
<dd class='body--doc'><p>It's not supported to call this method more than once
+
unless a call to <code>seek</code> is done in advance. Also note that it's
+
not possible to intermingle calls to <code>read</code>, <code>gets</code> or other
+
functions that read data with the line iterator, it will produce
+
unexpected results since the internal buffer in the iterator will not
+
contain sequential file-data in those cases.</p>
+
</dd>
<dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>_get_iterator()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>ngets</b></span> </dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>) <b><span class='method'>ngets</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int(1..)</code> <code class='argument'>n</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>) <b><span class='method'>ngets</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int(1..)</code> <code class='argument'>n</code>
,
<
code class='datatype'>bool</code>|<code class='datatype'>void</code> <code class='argument'>not_all</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Get <code>n</code> lines.</p> </dd> <dt class='head--doc'><span id='p-n'></span>Parameter <code class='parameter'>n</code></dt> <dd></dd><dd class='body--doc'><p>Number of lines to get, or all remaining if zero.</p>
-
+
</dd>
+
<dt class='head--doc'><span id='p-not_all'></span>Parameter <code class='parameter'>not_all</code></dt>
+
<dd></dd><dd class='body--doc'><p>Set this parameter to ignore partial lines at EOF. This
+
is useful for eg monitoring a growing logfile.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
+
<span class='homogen--name'><b>openat</b></span>
+
</dt>
+
<dd><p><code><code class='object unresolved'>FILE</code> <b><span class='method'>openat</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code><br>
+
<code><code class='object unresolved'>FILE</code> <b><span class='method'>openat</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code>, <code class='datatype'>int</code> <code class='argument'>mask</code><b>)</b></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Same as <code>Stdio.File()->openat()</code>, but returns a <code>Stdio.FILE</code>
+
object.</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p><code>Stdio.File()->openat()</code></p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
<span class='homogen--name'><b>pipe</b></span> </dt>
-
<dd><p><code><code class='object unresolved'>File</code> <b><span class='method'>pipe</span>(</b><code class='datatype'>
void
</code>|<code class='datatype'>
int
</code> <code class='argument'>flags</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='object unresolved'>File</code> <b><span class='method'>pipe</span>(</b><code class='datatype'>
int
</code>|<code class='datatype'>
void
</code> <code class='argument'>flags</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Same as <code>Stdio.File()->pipe()</code>.</p> </dd> <dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>Returns an <code>Stdio.File</code> object, NOT
a
<code>Stdio.FILE</code> object.</p>
+
<dd class='body--doc'><p>Returns an <code>Stdio.File</code> object, NOT
an
<code>Stdio.FILE</code> object.</p>
+
<p> In future releases of Pike this will most likely change
+
to returning an <code>Stdio.FILE</code> object. This is already
+
the case if <code class='expr'>STDIO_DIRECT_FD</code> has been defined.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>printf</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>printf</span>(</b><code class='datatype'>string</code> <code class='argument'>format</code>, <code class='datatype'>mixed</code> ... <code class='argument'>data</code><b>)</b></code></p></dd>
autodoc.git/traditional_manual/chapter_9.html:1770:
<dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>read</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>bytes</code>, <code class='datatype'>void</code>|<code class='datatype'>bool</code> <code class='argument'>now</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Read <code>bytes</code> (wide-) characters with buffering and support for input conversion.</p> </dd> <dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>Stdio.File()->read()</code>, <code>set_charset()</code></p>
+
<dd class='body--doc'><p><code>Stdio.File()->read()</code>, <code>set_charset()</code>
,
<
code>unread()<
/
code></
p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_charset</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_charset</span>(</b><code class='datatype'>string</code> <code class='argument'>charset</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Sets the input and output charset of this file to the specified <code>charset</code>.</p> <p> The default charset is <tt>"ISO-8859-1"</tt>.</p>
-
+
</dd><dt class='head--fixme'>FIXME</dt>
+
<dd class='body--fixme'><p>Consider using one of
+
ISO-IR-196 (<tt>"\e%G"</tt> - switch to UTF-8 with return)
+
or ISO-IR-190 (<tt>"\e%/G"</tt> - switch to UTF-8 level 1 no return)
+
or ISO-IR-191 (<tt>"\e%/H"</tt> - switch to UTF-8 level 2 no return)
+
or ISO-IR-192 (<tt>"\e%/I"</tt> - switch to UTF-8 level 3 no return)
+
or ISO-IR-193 (<tt>"\e%/J"</tt> - switch to UTF-16 level 1 no return)
+
or ISO-IR-194 (<tt>"\e%/K"</tt> - switch to UTF-16 level 2 no return)
+
or ISO-IR-195 (<tt>"\e%/L"</tt> - switch to UTF-16 level 3 no return)
+
or ISO-IR-162 (<tt>"\e%/@"</tt> - switch to UCS-2 level 1)
+
or ISO-IR-163 (<tt>"\e%/A"</tt> - switch to UCS-4 level 1)
+
or ISO-IR-174 (<tt>"\e%/C"</tt> - switch to UCS-2 level 2)
+
or ISO-IR-175 (<tt>"\e%/D"</tt> - switch to UCS-4 level 2)
+
or ISO-IR-176 (<tt>"\e%/E"</tt> - switch to UCS-2 level 3)
+
or ISO-IR-177 (<tt>"\e%/F"</tt> - switch to UCS-4 level 3)
+
or ISO-IR-178 (<tt>"\e%B"</tt> - switch to UTF-1)
+
automatically to encode wide strings.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>ungets</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>ungets</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This function puts a
string
back in the input buffer. The
string
+
<dd class='body--doc'><p>This function puts a
line
back in the input buffer. The
line
can then be read with eg <code>read()</code>, <code>gets()</code> or <code>getchar()</code>.</p> </dd> <dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>The string
must
not
contain
line-
feeds
.</p>
+
<dd class='body--doc'><p>The string
is
autoterminated
by
an extra
line-
feed
.</p>
</dd> <dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>read()</code>, <code>gets()</code>, <code>getchar()</code></p>
+
<dd class='body--doc'><p><code>read()</code>, <code>gets()</code>, <code>getchar()</code>
,
<
code>unread()<
/
code></
p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
+
<span class='homogen--name'><b>unread</b></span>
+
</dt>
+
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>unread</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>This function puts a string back in the input buffer. The string
+
can then be read with eg <code>read()</code>, <code>gets()</code> or <code>getchar()</code>.</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p><code>read()</code>, <code>gets()</code>, <code>getchar()</code>, <code>ungets()</code></p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
<span class='homogen--name'><b>write</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>write</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>string</code> <code class='argument'>what</code>, <code class='datatype'>mixed</code> ... <code class='argument'>fmt</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Write <code>what</code> with support for output_conversion.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>Stdio.File()->write()</code></p> </dd></dl>
autodoc.git/traditional_manual/chapter_9.html:1952:
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>If the last call done on this port failed, errno will return an integer describing what went wrong. Refer to your unix manual for further information.</p> </dd></dl> <hr /> <dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
+
<span class='homogen--name'><b>fd_factory</b></span>
+
</dt>
+
<dd><p><code><code class='modifier'>protected</code> <code class='object unresolved'>Fd</code> <b><span class='method'>fd_factory</span>(</b><b>)</b></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Factory creating empty <code>Fd</code> objects.</p>
+
<p> This function is called by <code>accept()</code> when it needs to create
+
a new file.</p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
<dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>_port</b></span> </dt> <dd><p><code><span class='datatype'>inherit _port</span> : <span class='inherit'>_port</span></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
autodoc.git/traditional_manual/chapter_9.html:3847:
</dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>PROP_SHUTDOWN</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span>
+
<span class='homogen--name'><b>TCSADRAIN</b></span>
+
</dt>
+
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>string</code> Stdio.<code class='constant'>TCSADRAIN</code></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Argument to <code>Stdio.File()->tcsetattr()</code>.</p>
+
<p> Change after all output has been written.</p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Constant</span>
+
<span class='homogen--name'><b>TCSAFLUSH</b></span>
+
</dt>
+
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>string</code> Stdio.<code class='constant'>TCSAFLUSH</code></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Argument to <code>Stdio.File()->tcsetattr()</code>.</p>
+
<p> Change after all output has been written,
+
and empty the input buffers.</p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Constant</span>
+
<span class='homogen--name'><b>TCSANOW</b></span>
+
</dt>
+
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>string</code> Stdio.<code class='constant'>TCSANOW</code></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Argument to <code>Stdio.File()->tcsetattr()</code>.</p>
+
<p> Change immediately.</p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Constant</span>
<span class='homogen--name'><b>__HAVE_OOB__</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>__HAVE_OOB__</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Exists and has the value 1 if OOB operations are available.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>In Pike 7.5 and later OOB operations are always present.</p> </dd></dl>
autodoc.git/traditional_manual/chapter_9.html:3907:
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>append_file</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>str</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>access</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Append the string <code>str</code> onto the file <code>filename</code>.</p> <p> For a description of <code>access</code>, see <code>Stdio.File->open()</code>.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>Throws an error if <code>filename</code> couldn't be opened for writing.</p> </dd> <dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>Returns the number of bytes written.</p>
+
<dd class='body--doc'><p>Returns the number of bytes written
, i
.
e.
<
code class='expr'>sizeof(str)<
/
code>.</
p>
</dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>write_file()</code>, <code>read_bytes()</code>, <code>Stdio.File()->open()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>append_path</b></span><br>
autodoc.git/traditional_manual/chapter_9.html:3992:
(<code>to</code>) may be truncated.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>cp()</code>, <code>sendfile()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
+
<span class='homogen--name'><b>convert_modestring2int</b></span>
+
</dt>
+
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>convert_modestring2int</span>(</b><code class='datatype'>string</code> <code class='argument'>mode_string</code><b>)</b></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Convert the mode_string string as returned by Stdio.Stat object
+
to int suitable for chmod</p>
+
</dd>
+
<dt class='head--doc'><span id='p-mode_string'></span>Parameter <code class='parameter'>mode_string</code></dt>
+
<dd></dd><dd class='body--doc'><p>The string as return from Stdio.Stat()->mode_string</p>
+
</dd>
+
<dt class='head--doc'>Returns</dt>
+
<dd class='body--doc'><p>An int matching the permission of the mode_string string suitable for
+
chmod</p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
<span class='homogen--name'><b>cp</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>cp</span>(</b><code class='datatype'>string</code> <code class='argument'>from</code>, <code class='datatype'>string</code> <code class='argument'>to</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Copies the file <code>from</code> to the new position <code>to</code>. If there is no system function for cp, a new file will be created and the
-
old one copied manually in chunks of 65536 bytes.</p>
+
old one copied manually in chunks of 65536 bytes.
+
This function can also copy directories recursively.
</p>
+
</dd>
+
<dt class='head--doc'>Returns</dt>
+
<dd class='body--doc'><p>0 on error, 1 on success</p>
+
</dd>
+
<dt class='head--doc'>Note</dt>
+
<dd class='body--doc'><p>This function keeps file and directory mode bits, unlike in Pike
+
7.6 and earlier.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>exist</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>exist</span>(</b><code class='datatype'>string</code> <code class='argument'>path</code><b>)</b></code></p></dd>
autodoc.git/traditional_manual/chapter_9.html:4050:
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>file_size</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>file_size</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Give the size of a file. Size -1 indicates that the file either does not exist, or that it is not readable by you. Size -2
-
indicates that it is a directory.</p>
+
indicates that it is a directory
, -3 that it is a symlink and -4
+
that it is a device
.</p>
</dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>file_stat()</code>, <code>write_file()</code>, <code>read_bytes()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_all_active_fd</b></span>
autodoc.git/traditional_manual/chapter_9.html:4213:
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>read_bytes</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read_bytes</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>int</code> <code class='argument'>start</code>, <code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>read_bytes</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>int</code> <code class='argument'>start</code><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>read_bytes</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Read <code>len</code> number of bytes from
the
file <code>filename</code> starting at byte
-
<code>start</code>, and return it as a string.</p>
+
<dd class='body--doc'><p>Read <code>len</code> number of bytes from
a
regular
file <code>filename</code>
+
starting at byte <code>start</code>, and return it as a string.</p>
<p> If <code>len</code> is omitted, the rest of the file will be returned.</p> <p> If <code>start</code> is also omitted, the entire file will be returned.</p> </dd> <dt class='head--doc'>Throws</dt>
-
<dd class='body--doc'><p>Throws an error
if
<code>filename<
/
code>
isn
't
a
regular
file
.</p>
+
<dd class='body--doc'><p>Throws an error
on
any I
/
O
error except when the file doesn
't
+
exist
.</p>
</dd> <dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>Returns <code class='expr'>0</code> (zero)
on
failure
to
open
<code>
filename
</code>.</p>
+
<dd class='body--doc'><p>Returns <code class='expr'>0</code> (zero)
if
the
file
doesn't
exist or if
+
<code>
start
</code>
is beyond the end of it
.</p>
<p> Returns a string with the requested data otherwise.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>read_file</code>, <code>write_file()</code>, <code>append_file()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>read_file</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read_file</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>read_file</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>int</code> <code class='argument'>start</code>, <code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Read <code>len</code> lines from a file <code>filename</code> after skipping <code>start</code> lines
-
and return those lines as a string. If both <code>start</code> and <code>len</code> are omitted
-
the whole file is read.</p>
+
<dd class='body--doc'><p>Read <code>len</code> lines from a
regular
file <code>filename</code> after skipping
+
<code>start</code> lines and return those lines as a string. If both
+
<code>start</code> and <code>len</code> are omitted the whole file is read.</p>
</dd>
-
+
<dt class='head--doc'>Throws</dt>
+
<dd class='body--doc'><p>Throws an error on any I/O error except when the file doesn't
+
exist.</p>
+
</dd>
+
<dt class='head--doc'>Returns</dt>
+
<dd class='body--doc'><p>Returns <code class='expr'>0</code> (zero) if the file doesn't exist or if
+
<code>start</code> is beyond the end of it.</p>
+
<p> Returns a string with the requested data otherwise.</p>
+
</dd>
<dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>read_bytes()</code>, <code>write_file()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
+
<span class='homogen--name'><b>recursive_mv</b></span>
+
</dt>
+
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>recursive_mv</span>(</b><code class='datatype'>string</code> <code class='argument'>from</code>, <code class='datatype'>string</code> <code class='argument'>to</code><b>)</b></code></p></dd>
+
+
<dt class='head--doc'>Description</dt>
+
<dd class='body--doc'><p>Copy a file or a directory tree by copying and then
+
removing. Mode bits are preserved in the copy.
+
It's not the fastest but works on every OS and
+
works well across different file systems.</p>
+
</dd>
+
<dt class='head--doc'>Returns</dt>
+
<dd class='body--doc'><p>Returns 0 on failure, nonzero otherwise.</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p><code>recursive_rm</code> <code>cp</code></p>
+
</dd></dl>
+
+
+
<hr />
+
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
<span class='homogen--name'><b>recursive_rm</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>recursive_rm</span>(</b><code class='datatype'>string</code> <code class='argument'>path</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Remove a file or
directory
a directory tree.</p>
+
<dd class='body--doc'><p>Remove a file or a directory tree.</p>
</dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns 0 on failure, nonzero otherwise.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>rm</code></p> </dd></dl> <hr />
autodoc.git/traditional_manual/chapter_9.html:4324:
<dd class='body--doc'><p>Returns a canonic representation of <code>path</code> (without /./, /../, // and similar path segments).</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>stderr</b></span> </dt>
-
<dd><p><code><code class='object unresolved'>
File
</code> Stdio.<b><span class='variable'>stderr</span></b></code></p></dd>
+
<dd><p><code><code class='object unresolved'>
FILE
</code> Stdio.<b><span class='variable'>stderr</span></b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>An instance of <tt>FILE("stderr")</tt>, the standard error stream. Use this when you want to output error messages.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>predef::werror()</code></p> </dd></dl>
autodoc.git/traditional_manual/chapter_9.html:4365:
write("%5d: %s\n", line++, s); }</p> </pre></dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>stdout</b></span> </dt>
-
<dd><p><code><code class='object unresolved'>
File
</code> Stdio.<b><span class='variable'>stdout</span></b></code></p></dd>
+
<dd><p><code><code class='object unresolved'>
FILE
</code> Stdio.<b><span class='variable'>stdout</span></b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>An instance of <tt>FILE("stdout")</tt>, the standatd output stream. Use this when you want to write anything to the standard output.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>predef::write()</code></p> </dd></dl>
autodoc.git/traditional_manual/chapter_9.html:4411:
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Write the string <code>str</code> onto the file <code>filename</code>. Any existing data in the file is overwritten.</p> <p> For a description of <code>access</code>, see <code>Stdio.File()->open()</code>.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>Throws an error if <code>filename</code> couldn't be opened for writing.</p> </dd> <dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>Returns the number of bytes written.</p>
+
<dd class='body--doc'><p>Returns the number of bytes written
, i
.
e.
<
code class='expr'>sizeof(str)<
/
code>.</
p>
</dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>append_file()</code>, <code>read_bytes()</code>, <code>Stdio.File()->open()</code></p> </dd></dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.BlockFile</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The Stdio.BlockFile API.</p> <p> This class exists purely for typing reasons.</p> <p> Use in types in place of <code>Stdio.File</code> where only blocking