Initial Spring 2016 commit.

This commit is contained in:
Geoffrey Challen
2015-12-23 00:50:04 +00:00
commit cafa9f5690
732 changed files with 92195 additions and 0 deletions

17
man/libc/Makefile Normal file
View File

@@ -0,0 +1,17 @@
# Man pages for libraries
TOP=../..
.include "$(TOP)/mk/os161.config.mk"
MANDIR=/man/libc
MANFILES=\
__vprintf.html abort.html assert.html atoi.html bzero.html \
calloc.html err.html exit.html free.html getchar.html getcwd.html \
index.html malloc.html memcpy.html memmove.html memset.html \
printf.html putchar.html puts.html random.html realloc.html \
setjmp.html snprintf.html stdarg.html strcat.html strchr.html \
strcmp.html strcpy.html strerror.html strlen.html strrchr.html \
strtok.html strtok_r.html system.html time.html warn.html
.include "$(TOP)/mk/os161.man.mk"

97
man/libc/__vprintf.html Normal file
View File

@@ -0,0 +1,97 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>__vprintf</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>__vprintf</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
__vprintf - printf backend
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>__vprintf(void (*</tt><em>func</em><tt>)(void
*</tt><em>clientdata</em><tt>,
const char *</tt><em>str</em><tt>,
size_t </tt><em>len</em><tt>),
void *</tt><em>clientdata</em><tt>,
const char *</tt><em>format</em><tt>,
va_list)</tt>
</p>
<h3>Description</h3>
<p>
In OS/161, __vprintf is the back-end engine for
<A HREF=printf.html>printf</A> and printf-like functions.
Note that it is not portable - application code should use
<A HREF=snprintf.html>snprintf or vsnprintf</A> when implementing
their own printf-like functions. This documentation is provided for
use when extending OS/161 itself.
</p>
<p>
The <em>format</em> and subsequent arguments are treated as described
under <A HREF=printf.html>printf</A>.
</p>
<p>
The <em>func</em> argument is called to print text generated by the
formatting process. The <em>clientdata</em> argument is passed
straight through __vprintf to <em>func</em>. The <em>str</em> argument
to func points to some text that is to be printed; the <em>len</em>
argument is the length of that string, which should not be assumed to
be null-terminated.
</p>
<p>
The strings passed to <em>func</em> may be small; if printing is
expensive buffering is probably wanted.
</p>
<h3>Return Values</h3>
<p>
__vprintf returns the number of characters printed.
</p>
</body>
</html>

68
man/libc/abort.html Normal file
View File

@@ -0,0 +1,68 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>abort</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>abort</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
abort - abnormal program termination
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;abort.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>abort(void);</tt>
</p>
<h3>Description</h3>
<p>
The <tt>abort</tt> function causes immediate abnormal program termination.
Cleanup is not performed.
</p>
<h3>Return Values</h3>
<p>
<tt>abort</tt> does not return.
</p>
</body>
</html>

74
man/libc/assert.html Normal file
View File

@@ -0,0 +1,74 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>assert</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>assert</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
assert - check assumptions at run time
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;assert.h&gt;</tt><br>
<br>
<tt>assert(expression);</tt>
</p>
<h3>Description</h3>
<p>
<tt>assert</tt> checks that its argument evaluates to true. If this is not the
case, an error message is printed and <A HREF=abort.html>abort</A> is
called.
</p>
<p>
<tt>assert</tt> is a macro. If the macro <tt>NDEBUG</tt> is defined at
compile time, assertion tests are removed.
</p>
<h3>Caution</h3>
<p>
Avoid writing assert expressions with side effects, as compiling with
<tt>NDEBUG</tt> normally causes the side effects to disappear.
</p>
</body>
</html>

73
man/libc/atoi.html Normal file
View File

@@ -0,0 +1,73 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>atoi</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>atoi</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
atoi - convert ascii to integer
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>atoi(const char *</tt><em>string</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<em>string</em>, which should be a textual representation of an
integer, is converted to the machine representation of that integer.
Leading whitespace, if any, is skipped. Conversion stops when a
non-numeric character is found.
</p>
<h3>Return Values</h3>
<p>
<tt>atoi</tt> returns the number converted. If no digits at all were
found, it returns 0.
If too many digits are found (resulting in overflow) the behavior is
formally undefined.
</p>
</body>
</html>

71
man/libc/bzero.html Normal file
View File

@@ -0,0 +1,71 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>bzero</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>bzero</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
bzero - zero out memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>bzero(void *</tt><em>buf</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The region of memory pointed to by <em>buf</em>, of length
<em>len</em>, is zeroed out.
</p>
<h3>Restrictions</h3>
<p>
Zeroing the bytes of a floating point number does not necessarily
produce a floating point zero value.
Similarly, zeroing the bytes of a pointer does not necessarily produce
<tt>NULL</tt>.
</p>
</body>
</html>

84
man/libc/calloc.html Normal file
View File

@@ -0,0 +1,84 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>calloc</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>calloc</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
calloc - allocate and clear memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>calloc(size_t </tt><em>number</em><tt>, size_t </tt><em>size</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>calloc</tt> allocates <em>number</em>*<em>size</em> bytes of
memory, zeros it, and returns a pointer to it. It is equivalent to
calling
<A HREF=malloc.html><tt>malloc</tt></A><tt>(</tt><em>number</em>*<em>size</em></tt>)</tt>
followed by <A HREF=bzero.html>bzero</A>.
</p>
<p>
If the product <em>number</em>*<em>size</em> overflows the range of
<tt>size_t</tt>, calloc fails.
</p>
<h3>Return Values</h3>
<p>
<tt>calloc</tt> returns a pointer to the memory allocated. If memory
cannot be obtained, NULL is returned.
</p>
<h3>See Also</h3>
<p>
<A HREF=malloc.html>malloc</A>,
<A HREF=realloc.html>realloc</A>,
<A HREF=free.html>free</A>
</p>
</body>
</html>

104
man/libc/err.html Normal file
View File

@@ -0,0 +1,104 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>err</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>err</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
err, errx, verr, verrx - print error messages
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;err.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>err(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>errx(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>verr(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, va_list);</tt><br>
<br>
<tt>void</tt><br>
<tt>verrx(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, va_list);</tt><br>
</p>
<h3>Description</h3>
<p>
The <tt>err</tt>, <tt>errx</tt>, <tt>verr</tt>, and <tt>verrx</tt>
functions print error messages to the standard error stream.
</p>
<p>
<tt>errx</tt> prints the name of the program, a colon, the text
generated by passing <em>format</em> and subsequent args through
<A HREF=printf.html>printf</A>, and a newline. Then,
<A HREF=exit.html>exit</A> is called and passed the supplied
<em>exitcode</em>.
</p>
<p>
<tt>err</tt> does the same thing, except that a colon and the error
string for the current error (obtained by calling
<A HREF=strerror.html>strerror</A> on
<A HREF=../syscall/errno.html>errno</A>) are printed prior to the
newline.
</p>
<p>
<tt>verrx</tt> and <tt>verr</tt> are the same as errx and err
respectively, except that the additional arguments for printf are
taken to have been already packaged up in a <tt>va_list</tt> by use of
the <A HREF=stdarg.html>stdarg</A> facility.
</p>
<h3>See Also</h3>
<p>
<A HREF=warn.html>warn</A>
</p>
</body>
</html>

100
man/libc/execvp.html Normal file
View File

@@ -0,0 +1,100 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>execvp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>execvp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
execvp - execute a program found on the search path
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>execvp(const char *</tt><em>program</em><tt>,
char **</tt><em>args</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>execvp</tt> searches for <em>program</em> on the program search
path and execs it with <A HREF=../syscall/execv.html>execv</A> if
found. If <em>program</em> is not found or a serious error occurs, it
returns.
</p>
<p>
If <em>program</em> contains a slash, no search is done; the specified
string is passed directly to <tt>execv</tt>.
</p>
<p>
The <em>args</em> argument should be prepared exactly as for
<tt>execv</tt>.
</p>
<p>
The search path is a colon-delimited list of directories retrieved by
calling <A HREF=getenv.html>getenv</A> to retrieve the <tt>PATH</tt>
environment variable. Unless you implement <tt>execve</tt> and
environment variable passing, the value used is from a default
environment compiled into libc. This path searches the <tt>/bin</tt>,
<tt>/sbin</tt>, and <tt>/testbin</tt> directories.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>execvp</tt> does not return; instead, the new program
begins executing. On failure, <tt>execvp</tt> returns -1, and sets
<A HREF=errno.html>errno</A> to a suitable error code for the error
condition encountered.
</p>
<h3>Errors</h3>
<p>
<tt>execvp</tt> can fail for any of the reasons <tt>execv</tt> can.
In addition, it produces ENOENT if the requested program is not
found.
</p>
</body>
</html>

69
man/libc/exit.html Normal file
View File

@@ -0,0 +1,69 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>exit</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>exit</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
exit - terminate program
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>exit(int </tt><em>code</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>exit</tt> causes the program to exit. It calls internal cleanup
routines, and then performs the actual exit by calling
<A HREF=../syscall/_exit.html>_exit</A>.
</p>
<h3>Return Values</h3>
<p>
exit does not return.
</p>
</body>
</html>

104
man/libc/free.html Normal file
View File

@@ -0,0 +1,104 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>free</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>free</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
free - release/deallocate memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>free(void *</tt><em>ptr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>free</tt> releases a block of memory previously allocated with
<A HREF=malloc.html>malloc</A>, <A HREF=calloc.html>calloc</A>,
or <A HREF=realloc.html>realloc</A>.
</p>
<p>
Once free has been called, <em>ptr</em> is no longer valid and
attempts to dereference it result in undefined behavior.
(Pedantically, in fact, even using the <i>value</i> of
<em>ptr</em> may produce undefined behavior.) Passing <em>ptr</em> to
free a second or subsequent time (unless of course the same pointer
value is again returned from malloc) is also undefined and
particularly likely to provoke adverse behavior in most
implementations.
</p>
<p>
<tt>free(NULL)</tt> has no effect.
</p>
<p>
In practice it is desirable for implementations of <tt>free</tt> to
detect, to the extent practically possible, pointers that were not
previously allocated by one of the above functions or that are passed
to <tt>free</tt> multiple times. However, this can be difficult and
there is no useful standard mechanism for error reporting.
</p>
<p>
<tt>free</tt> does not necessarily unmap free memory or return it to
the operating system, but may do so if it chooses.
</p>
<h3>Return Values</h3>
<p>
<tt>free</tt> returns no value.
<p>
<h3>See Also</h3>
<p>
<A HREF=calloc.html>calloc</A>,
<A HREF=malloc.html>malloc</A>,
<A HREF=realloc.html>realloc</A>
</p>
</body>
</html>

76
man/libc/getchar.html Normal file
View File

@@ -0,0 +1,76 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>getchar</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>getchar</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
getchar - read character from standard input
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>getchar(void);</tt>
</p>
<h3>Description</h3>
<p>
<tt>getchar</tt> reads a single character from standard input. The
character is converted to unsigned char before being returned.
EOF, which is negative, is thus not a possible successful return value.
</p>
<h3>Return Values</h3>
<p>
On success, getchar returns the character read. On error, or end of
file, EOF is returned.
</p>
<h3>Errors</h3>
<p>
Any of the errors associated with <A HREF=../syscall/read>read</A>
may occur.
</p>
</body>
</html>

100
man/libc/getcwd.html Normal file
View File

@@ -0,0 +1,100 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>getcwd</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>getcwd</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
getcwd - get name of current working directory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>getcwd(char *</tt><em>buf</em><tt>, size_t </tt><em>buflen</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The name of the current directory is computed and stored in
<em>buf</em>, an area of size <em>buflen</em>. The resulting string is
0-terminated.
</p>
<p>
This call is a wrapper (for Unix compatibility) around the system call
<A HREF=../syscall/__getcwd.html>__getcwd</A>.
</p>
<p>
Note, however, that the BSD extension whereby space is allocated with
<A HREF=malloc.html>malloc</A> if <em>buf</em> is <tt>NULL</tt> is not
supported.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>getcwd</tt> returns <em>buf</em>.
On error, <tt>NULL</tt> is returned, and <A HREF=errno.html>errno</A>
is set according to the error encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other errors not
mentioned here.
</p>
<table width=90%>
<tr><td width=5% rowspan=3>&nbsp;</td>
<td>ENOENT</td>
<td width=5% rowspan=3>&nbsp;</td>
<td>A component of the pathname no longer exists.</td></tr>
<tr><td>EIO</td>
<td>A hard I/O error occurred.</td></tr>
<tr><td>EFAULT</td>
<td><em>buf</em> points to an invalid address.</td></tr>
</table>
</body>
</html>

82
man/libc/getenv.html Normal file
View File

@@ -0,0 +1,82 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>getenv</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>getenv</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
getenv - retrieve an environment variable
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>getenv(const char *</tt><em>variable</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>getenv</tt> retrieves the value of the environment variable
<em>variable</em> from the current process environment.
Unless you implement <tt>execve</tt> and environment variable passing,
the environment used is a default environment compiled into libc.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>getenv</tt> returns a pointer to the value of the
requested variable.
This pointer points to internal storage and the contents should not be
modified.
The contents will in turn be stable until/unless the process
environment is modified.
If the requested variable is not found, <tt>getenv</tt> returns
<tt>NULL</tt>.
</p>
<h3>See Also</h3>
<p>
<A HREF=execvp.html>execvp</A>
</p>
</body>
</html>

96
man/libc/index.html Normal file
View File

@@ -0,0 +1,96 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>OS/161 C Standard Library</title>
<link rel="stylesheet" type="text/css" media="all" href="../manindex.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>OS/161 C Standard Library (libc)</h2>
<p align=center>
<A HREF=..>Top</A> |
<A HREF=../bin>Binaries</A> |
<A HREF=../sbin>Sysadmin binaries</A> |
<A HREF=../testbin>Test binaries</A> |
<A HREF=../syscall>System calls</A> |
<A HREF=../dev>Device drivers</A> |
<A HREF=../misc>Miscellaneous</A>
</p>
<br>
<ul>
<li> <A HREF=__vprintf.html>__vprintf</A> - printf backend
<li> <A HREF=abort.html>abort</A> - abnormal program termination
<li> <A HREF=assert.html>assert</A> - check assumptions at run time
<li> <A HREF=atoi.html>atoi</A> - convert ascii to integer
<li> <A HREF=bzero.html>bzero</A> - zero out memory
<li> <A HREF=calloc.html>calloc</A> - allocate and clear memory
<li> <A HREF=err.html>err, errx</A> - print error messages
<li> <A HREF=execvp.html>execvp</A> - exec on the search path
<li> <A HREF=exit.html>exit</A> - terminate program
<li> <A HREF=free.html>free</A> - release/deallocate memory
<li> <A HREF=getchar.html>getchar</A> - read character from standard input
<li> <A HREF=getcwd.html>getcwd</A> - get name of current working directory
<li> <A HREF=getenv.html>getenv</A> - get environment variable
<li> <A HREF=setjmp.html>longjmp</A> - non-local jump operations
<li> <A HREF=malloc.html>malloc</A> - allocate memory
<li> <A HREF=memcmp.html>memcmp</A> - compare regions of memory
<li> <A HREF=memcpy.html>memcpy</A> - copy region of memory
<li> <A HREF=memmove.html>memmove</A> - copy region of memory
<li> <A HREF=memset.html>memset</A> - initialize region of memory
<li> <A HREF=printf.html>printf</A> - print formatted output
<li> <A HREF=putchar.html>putchar</A> - print character to standard output
<li> <A HREF=puts.html>puts</A> - print string to standard output
<li> <A HREF=random.html>random</A> - pseudorandom number generation
<li> <A HREF=realloc.html>realloc</A> - resize allocated memory
<li> <A HREF=setjmp.html>setjmp</A> - non-local jump operations
<li> <A HREF=snprintf.html>snprintf</A> - print formatted text to string
<li> <A HREF=stdarg.html>stdarg</A> - handle functions with variable arguments
<li> <A HREF=strcat.html>strcat</A> - concatenate strings
<li> <A HREF=strchr.html>strchr</A> - search string for character
<li> <A HREF=strcmp.html>strcmp</A> - compare strings
<li> <A HREF=strcpy.html>strcpy</A> - copy string
<li> <A HREF=strerror.html>strerror</A> - get error message for error code
<li> <A HREF=strlen.html>strlen</A> - determine length of string
<li> <A HREF=strrchr.html>strrchr</A> - search string for character
<li> <A HREF=strtok.html>strtok</A> - tokenize string
<li> <A HREF=strtok_r.html>strtok_r</A> - tokenize string reentrantly
<li> <A HREF=system.html>system</A> - run command as subprocess
<li> <A HREF=time.html>time</A> - get time of day
<li> <A HREF=err.html>verr, verrx</A> - print error messages
<li> <A HREF=printf.html>vprintf</A> - print formatted output
<li> <A HREF=snprintf.html>vsnprintf</A> - print formatted text to string
<li> <A HREF=warn.html>vwarn, vwarnx</A> - print warning messages
<li> <A HREF=warn.html>warn, warnx</A> - print warning messages
</ul>
</body>
</html>

108
man/libc/malloc.html Normal file
View File

@@ -0,0 +1,108 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>malloc</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>malloc</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
malloc - allocate memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>malloc(size_t </tt><em>size</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>malloc</tt> allocates <em>size</em> bytes of memory and returns a
pointer to it. The memory is not necessarily zero-filled. (To get
zero-filled memory, call <A HREF=bzero.html>bzero</A> or
<A HREF=memset.html>memset</A>, or use
<A HREF=calloc.html>calloc</A>.)
</p>
<p>
The pointer returned must be suitably aligned for use with any data
type.
</p>
<p>
When asked to allocate zero bytes, <tt>malloc</tt> may either always
return <tt>NULL</tt>, or may return distinct non-null pointers that do
not point to any storage.
</p>
<p>
While <tt>malloc</tt> may at its option allocate more than
<em>size</em> bytes to fill a request, code that calls <tt>malloc</tt>
may not depend on such behavior and must not perform any accesses
outside of the bounds defined by <em>size</em>.
</p>
<p>
It is legitimate for memory returned by malloc to not actually be
physically mapped until it is used.
If at the time it is used, no physical memory is available and there
is no space to swap something out to make room, the process may
potentially receive a fatal signal or be killed.
This behavior is often somewhat contentious; a full discussion of the
possible alternatives and their pros and cons is well beyond the scope
of this man page.
</p>
<h3>Return Values</h3>
<p>
<tt>malloc</tt> returns a pointer to the memory allocated. If memory
cannot be obtained, NULL is returned.
</p>
<h3>See Also</h3>
<p>
<A HREF=calloc.html>calloc</A>,
<A HREF=realloc.html>realloc</A>,
<A HREF=free.html>free</A>
</p>
</body>
</html>

81
man/libc/memcmp.html Normal file
View File

@@ -0,0 +1,81 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strcmp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcmp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memcmp - compare memory blocks
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>memcmp(const void *</tt><em>block1</em><tt>,
const void *</tt><em>block2</em><tt>,
size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The two memory regions <em>block1</em> and <em>block2</em>, both of
length <em>len</em>, are compared lexicographically.
</p>
<h3>Return Values</h3>
<p>
If <em>block1</em> sorts before <em>block2</em>, -1 is returned.
</p>
<p>
If <em>block1</em> sorts after <em>block2</em>, 1 is returned.
</p>
<p>
If <em>block1</em> is the same as <em>block2</em>, 0 is returned.
</p>
<p>
The sort order used is derived from the natural ordering of
the numerical values of (unsigned) characters.
</p>
</body>
</html>

76
man/libc/memcpy.html Normal file
View File

@@ -0,0 +1,76 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>memcpy</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>memcpy</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memcpy - copy region of memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>memcpy(void *</tt><em>dest</em><tt>,
const void *</tt><em>src</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The block of memory beginning at <em>src</em>, of length <em>len</em>,
is copied to <em>dest</em>. <em>dest</em> must point to a region large
enough to hold it.
</p>
<p>
<tt>memcpy</tt> is not guaranteed to operate correctly if <em>src</em>
and <em>dest</em> overlap. Use <A HREF=memmove.html>memmove</A> on
overlapping regions.
</p>
<h3>Return Values</h3>
<p>
<tt>memcpy</tt> returns <em>dest</em>.
</p>
</body>
</html>

75
man/libc/memmove.html Normal file
View File

@@ -0,0 +1,75 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>memmove</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>memmove</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memmove - copy region of memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>memmove(void *</tt><em>dest</em><tt>,
const void *</tt><em>src</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The block of memory beginning at <em>src</em>, of length <em>len</em>,
is copied to <em>dest</em>. <em>dest</em> must point to a region large
enough to hold it.
</p>
<p>
Unlike <A HREF=memcpy.html>memcpy</A>, <tt>memmove</tt> is guaranteed
to operate correctly if <em>src</em> and <em>dest</em> overlap.
</p>
<h3>Return Values</h3>
<p>
<tt>memmove</tt> returns <em>dest</em>.
</p>
</body>
</html>

82
man/libc/memset.html Normal file
View File

@@ -0,0 +1,82 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>memset</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>memset</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memset - initialize region of memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>memset(void *</tt><em>buf</em><tt>,
int </tt><em>chr</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The memory region pointed to by <em>buf</em>, of length <em>len</em>,
is initialized by setting each location of it to <em>chr</em>
(converted to unsigned char).
</p>
<p>
Beware of writing
<pre>
memset(buf, len, 0);
</pre>
(which does nothing at all) when you meant
<pre>
memset(buf, 0, len);
</pre>
instead.
</p>
<h3>Return Values</h3>
<p>
<tt>memset</tt> returns <em>buf</em>.
</p>
</body>
</html>

143
man/libc/printf.html Normal file
View File

@@ -0,0 +1,143 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>printf</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>printf</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
printf - print formatted output
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>printf(const char *</tt><em>format</em><tt>, ...);</tt>
</p>
<h3>Description</h3>
<p>
<tt>printf</tt> prints formatted text to standard output. The text is
generated from the <em>format</em> argument and subsequent arguments
according to the following rules.
</p>
<p>
Characters in <em>format</em> that are not the percent sign
(<tt>%</tt>) are printed verbatim. When a percent sign is encountered,
the next argument of the arguments following <em>format</em> is
retrieved and printed. The type of the argument expected, as well as
some simple formatting instructions, are derived from the characters
following the percent sign.
</p>
<p>
The following characters designate types to print. One of these
characters concludes the format sequence begun with a percent sign,
and also determines the type expected as an argument.
</p>
<table width=90%>
<tr><td width=5% rowspan=9>
<td width=5%>%</td> <td>A percent sign is printed; no argument
is consumed.</td></tr>
<tr><td>c</td> <td>Character (char, passed as an integer value)</td></tr>
<tr><td>d</td> <td>Signed integer value printed in decimal</td></tr>
<tr><td>o</td> <td>Unsigned integer value printed in octal</td></tr>
<tr><td>p</td> <td>Pointer (void *)</td></tr>
<tr><td>s</td> <td>String (const char *)</td></tr>
<tr><td>u</td> <td>Unsigned integer value printed in decimal</td></tr>
<tr><td>x</td> <td>Unsigned integer value printed in hexadecimal</td></tr>
<tr><td>X</td> <td>Unsigned integer value printed in uppercase hex</td></tr>
</table>
<p>
The following characters are modifiers; they can be found between the
percent sign and the type designator.
</p>
<table width=90%>
<tr><td width=5% rowspan=6>
<td width=5% valign=top>#</td> <td>Select an "alternate
format". On integer formats this
causes the C base prefix to be printed
along with the integer. On other
formats, this has no effect.</td></tr>
<tr><td valign=top>l</td> <td>Assume an integer argument is
<tt>long</tt> or <tt>unsigned
long</tt> instead of <tt>int</tt> or
<tt>unsigned int</tt>. If repeated,
the argument is taken to be <tt>long
long</tt> or <tt>unsigned long
long</tt>. </td></tr>
<tr><td valign=top>z</td> <td>Assume an integer argument is
<tt>ssize_t</tt> or <tt>size_t</tt>
instead of <tt>int</tt> or
<tt>unsigned int</tt>. </td></tr>
<tr><td valign=top>0-9</td> <td>Digits are treated as a decimal number,
which is considered to be the field
width. The argument is printed
right-aligned in a field that many
characters wide.</td></tr>
<tr><td valign=top>0</td> <td>If the field width has a leading 0, the
padding character for alignment is
made 0 (zero) instead of
space.</td></tr>
<tr><td valign=top>-</td> <td>If a field width is given, use it for
left alignment instead of right
alignment.</td></tr>
</table>
<h3>Restrictions</h3>
<p>
Note that this is a limited printf implementation - it has no support
for precisions (".number" as a modifier), floating-point formats,
field widths passed as arguments, or the rarely-used plus and space
modifiers.
</p>
<h3>Return Values</h3>
<p>
<tt>printf</tt> returns the number of characters printed.
</p>
</body>
</html>

75
man/libc/putchar.html Normal file
View File

@@ -0,0 +1,75 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>putchar</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>putchar</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
putchar - print character to standard output
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>putchar(int </tt><em>chr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>putchar</tt> writes its argument character to standard output.
</p>
<h3>Return Values</h3>
<p>
<tt>putchar</tt> returns <em>chr</em>. On error, EOF is returned, and
<A HREF=../syscall/errno.html>errno</A> is set according to the error
encountered.
</p>
<h3>Errors</h3>
<p>
Any of the errors from <A HREF=../syscall/write.html>write</A> may
occur.
</p>
</body>
</html>

76
man/libc/puts.html Normal file
View File

@@ -0,0 +1,76 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>puts</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>puts</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
puts - print string to standard output
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>puts(const char *</tt><em>string</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The string <em>string</em>, and a following newline character, are
printed on the standard output.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>puts</tt> returns a nonnegative integer. On error, -1 is
returned, and <A HREF=../syscall/errno.html>errno</A> is set
according to the error encountered.
</p>
<h3>Errors</h3>
<p>
Any of the errors from <A HREF=../syscall/write.html>write</A> may
occur.
</p>
</body>
</html>

89
man/libc/random.html Normal file
View File

@@ -0,0 +1,89 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>random</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>random</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
random - pseudorandom number generation
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>long</tt><br>
<tt>random(void);</tt><br>
<br>
<tt>void</tt><br>
<tt>srandom(unsigned long </tt><em>seed</em><tt>);</tt><br>
</p>
<h3>Description</h3>
<p>
<tt>random</tt> returns a number between 0 and 0x7fffffff. This
number is selected using a rather complex generator which is believed
to generate randomness of an acceptable (though not cryptographic)
quality. Unlike with some generators, all bits of the values returned
are random.
</p>
<p>
<tt>srandom</tt> initializes the generator state based on the
passed-in <em>seed</em>. If <tt>srandom</tt> is not called, the
sequence of numbers returned by <tt>random</tt> is the same as if
<tt>srandom</tt> had been called with a <em>seed</em> of 1.
</p>
<p>
The symbolic constant <tt>RAND_MAX</tt> is provided to hold the
maximum value 0x7fffffff.
This is technically incorrect as the name <tt>RAND_MAX</tt> is
properly part of a different random number interface.
</p>
<p>
The implementation of <tt>random</tt> and <tt>srandom</tt> used in
OS/161 is software developed by the University of California, Berkeley
and its contributors.
</p>
</body>
</html>

104
man/libc/realloc.html Normal file
View File

@@ -0,0 +1,104 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>realloc</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>realloc</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
realloc - resize allocated memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>realloc(void *</tt><em>ptr</em><tt>,
size_t </tt><em>newsize</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>realloc</tt> attempts to change the size of the memory block
pointed to by <em>ptr</em> to <em>newsize</em>, causing the block to
shrink or grow as necessary. If the size cannot be changed, a new
block is allocated and the contents (up to the lesser of the previous
size and <em>newsize</em>) are copied, then the old block is freed.
</p>
<p>
The size of <tt>NULL</tt> is treated as 0. If the size is increased,
any newly allocated space has undefined contents. If the size is
decreased, the space discarded may no longer be accessed. Otherwise
the contents of the memory block are preserved.
</p>
<p>
<em>ptr</em> must be NULL or have been previously returned by
<A HREF=malloc.html>malloc</A>, <A HREF=calloc.html>calloc</A>, or
realloc.
</p>
The alignment and other restrictions described for
<A HREF=malloc.html>malloc</A> apply equally to realloc.
<p>
<h3>Return Values</h3>
<p>
<tt>realloc</tt> returns a pointer to the resized memory block. This
may not be the same pointer as <em>ptr</em>. If so, the old block is
invalidated and <em>ptr</em> becomes invalid.
</p>
<p>
If the operation cannot be performed at all, NULL is returned and
the original block pointed to by <em>ptr</em> is untouched
and remains valid.
</p>
<h3>See Also</h3>
<p>
<A HREF=calloc.html>calloc</A>,
<A HREF=malloc.html>malloc</A>,
<A HREF=free.html>free</A>
</p>
</body>
</html>

85
man/libc/setjmp.html Normal file
View File

@@ -0,0 +1,85 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>setjmp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>setjmp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
setjmp, longjmp - non-local jump operations
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;setjmp.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>setjmp(jmp_buf </tt><em>jb</em>)<tt>;</tt><br>
<br>
<tt>void</tt><br>
<tt>longjmp(jmp_buf </tt><em>jb</em><tt>,
int </tt><em>returncode</em>)<tt>;</tt><br>
</p>
<h3>Description</h3>
<p>
<tt>setjmp</tt> saves the current stack frame and processor state in
<em>jb</em>. A subsequent call to <tt>longjmp</tt> with the same
<em>jb</em> causes execution to jump to where <tt>setjmp</tt> was
called from.
</p>
<p>
If the stack frame that called <tt>setjmp</tt> returns before
<tt>longjmp</tt> is called, the results are undefined.
</p>
<h3>Return Values</h3>
<p>
When called, <tt>setjmp</tt> returns 0. When <tt>longjmp</tt> is
called, it does not itself return, but instead causes <tt>setjmp</tt>
to appear to return again, this time returning <em>returncode</em>.
</p>
<p>
If zero is passed as <em>returncode</em>, the value 1 is used instead.
</p>
</body>
</html>

84
man/libc/snprintf.html Normal file
View File

@@ -0,0 +1,84 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>snprintf</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>snprintf</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
snprintf - print formatted text to string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>snprintf(char *</tt><em>buf</em><tt>, size_t </tt><em>buflen</em><tt>,
const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>int</tt><br>
<tt>vsnprintf(char *</tt><em>buf</em><tt>, size_t </tt><em>buflen</em><tt>,
const char *</tt><em>format</em><tt>, va_list);</tt><br>
</p>
<h3>Description</h3>
<p>
<tt>snprintf</tt> performs <A HREF=printf.html>printf</A>-style
formatting on the string <em>format</em> and subsequent arguments. The
resulting string is placed in <em>buf</em>, which is a memory area at
least <em>buflen</em> bytes long. A null terminator is always added to
<em>buf</em>; the space for this is presumed to be counted in
<em>buflen</em>.
</p>
<p>
<tt>vsnprintf</tt> is the same as <tt>snprintf</tt>, except that the
subsequent arguments are presumed to have already been collected using
the <A HREF=stdarg.html>stdarg</A> facility.
</p>
<h3>Return Values</h3>
<p>
<tt>snprintf</tt> and <tt>vsnprintf</tt> return the number of
characters printed.
</p>
</body>
</html>

126
man/libc/stdarg.html Normal file
View File

@@ -0,0 +1,126 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>stdarg</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>stdarg</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
stdarg - handle functions with variable arguments
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdarg.h&gt;</tt><br>
<br>
<tt>va_start(va_list </tt><em>ap</em><tt>,
</tt><em>start-argument</em><tt>);</tt><br>
<br>
<tt>va_end(va_list </tt><em>ap</em><tt>);</tt><br>
<br>
<em>type</em><br>
<tt>va_arg(va_list </tt><em>ap</em><tt>, </tt><em>type</em><tt>);</tt><br>
<br>
<tt>va_copy(va_list </tt><em>dest</em><tt>,
va_list </tt><em>src</em><tt>);</tt><br>
</p>
<h3>Description</h3>
<p>
Functions where the number of arguments is not fixed at compile time
can be written using the stdarg facility. This provides a type,
<tt>va_list</tt>, and the macros listed above. These allow iterating
through the arguments.
</p>
<p>
<tt>va_start</tt> initializes a <tt>va_list</tt> <em>ap</em> to point
to the current function's arguments. The <em>start-argument</em>
argument should be the name of the last fixed parameter in the calling
sequence.
(There must be at least one fixed parameter.)
</p>
<p>
<tt>va_end</tt> cleans up a <tt>va_list</tt> once it is no longer
needed. While failure to use <tt>va_end</tt> may have no effect on
some architectures (in fact, in some cases <tt>va_end</tt> does
nothing at all) on other architectures it may be fatal.
</p>
<p>
<tt>va_arg</tt> retrieves the next argument, which is presumed to be
of type <em>type</em>. The function must have some way to determine
what types to expect, and how many arguments, as this information
cannot be extracted from the argument list itself. To rewind, use
<tt>va_end</tt> and then <tt>va_start</tt> again.
</p>
<p>
Remember that default C argument promotions occur when passing the
variable arguments. There is no run-time checking of any kind, and
little to no compile-time checking: if you use <tt>va_arg</tt> to
retrieve a type different from that which was passed, you will
silently get garbage for that and (usually) all subsequent arguments.
</p>
<p>
<tt>va_copy</tt> assigns a copy of <em>src</em> to
<em>dest</em>. Subsequent operations on either will not affect the
other. Both copies need to be cleaned up with <tt>va_end</tt>.
</p>
<h3>Restrictions</h3>
<p>
Because the <tt>va_list</tt> is not necessarily a simple type, but may
involve pointers to state maintained elsewhere, it is not necessarily
a simple value. Thus, assigning <tt>va_list</tt> objects to each other
with `=', memcpy, or the like, or passing them to functions, may not
give multiple independent objects. When in doubt, use
<tt>va_copy</tt>, or invoke <tt>va_start</tt> multiple times.
</p>
<h3>Return Values</h3>
<p>
<tt>va_start</tt>, <tt>va_end</tt>, and <tt>va_copy</tt> do not return
anything. <tt>va_arg</tt> returns the value of the requested argument.
</p>
</body>
</html>

80
man/libc/strcat.html Normal file
View File

@@ -0,0 +1,80 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strcat</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcat</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strcat - concatenate strings
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strcat(char *</tt><em>dest</em><tt>,
const char *</tt><em>src</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strcat</tt> appends the contents of the string <em>src</em> to the
string <em>dest</em>.
</p>
<h3>Restrictions</h3>
<p>
If <em>dest</em> does not point to enough space to hold both strings,
the resulting behavior is undefined.
</p>
<p>
If the memory areas pointed to by <em>dest</em> and <em>src</em>
overlap, the behavior is undefined.
</p>
<h3>Return Values</h3>
<p>
<tt>strcat</tt> returns <em>dest</em>.
</p>
</body>
</html>

72
man/libc/strchr.html Normal file
View File

@@ -0,0 +1,72 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strchr</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strchr</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strchr - search string for character
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strchr(const char *</tt><em>string</em><tt>,
int </tt><em>chr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strchr</tt> searches <em>string</em> from the left for the first
instance of the character <em>chr</em>.
The characters found and <em>chr</em> are cast to and compared as the
type <tt>unsigned char</tt>.
</p>
<h3>Return Values</h3>
<p>
<tt>strchr</tt> returns a pointer to the character found. If the
character is not found, NULL is returned.
</p>
</body>
</html>

80
man/libc/strcmp.html Normal file
View File

@@ -0,0 +1,80 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strcmp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcmp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strcmp - compare strings
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>strcmp(const char *</tt><em>str1</em><tt>,
const char *</tt><em>str2</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The two strings <em>str1</em> and <em>str2</em> are compared
lexicographically.
</p>
<h3>Return Values</h3>
<p>
If <em>str1</em> sorts before <em>str2</em>, -1 is returned.
</p>
<p>
If <em>str1</em> sorts after <em>str2</em>, 1 is returned.
</p>
<p>
If <em>str1</em> is the same as <em>str2</em>, 0 is returned.
</p>
<p>
The sort order used is derived from the natural ordering of
the numerical values of (unsigned) characters.
</p>
</body>
</html>

80
man/libc/strcpy.html Normal file
View File

@@ -0,0 +1,80 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strcpy</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcpy</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strcpy - copy string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strcpy(char *</tt><em>dest</em><tt>,
const char *</tt><em>src</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The contents of the string <em>src</em> are copied into
<em>dest</em>.
</p>
<h3>Restrictions</h3>
<p>
If <em>dest</em> does not point to enough space to hold the string,
the resulting behavior is undefined.
</p>
<p>
If the memory areas pointed to by <em>dest</em> and <em>src</em>
overlap, the behavior is undefined.
</p>
<h3>Return Values</h3>
<p>
<tt>strcpy</tt> returns <em>dest</em>.
</p>
</body>
</html>

75
man/libc/strerror.html Normal file
View File

@@ -0,0 +1,75 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strerror</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strerror</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strerror - get error message for error code
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>const char *</tt><br>
<tt>strerror(int </tt><em>code</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The error string for the error specified by <em>code</em> (see
<A HREF=../syscall/errno.html>errno</A> for more information) is
retrieved.
</p>
<p>
It is not itself an error to request error strings for out-of-range
values of <em>code</em>, but the string returned under such
circumstances may not be very enlightening when printed.
</p>
<h3>Return Values</h3>
<p>
The error string is returned.
</p>
</body>
</html>

63
man/libc/strlen.html Normal file
View File

@@ -0,0 +1,63 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strlen</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strlen</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strlen - determine length of string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>size_t</tt><br>
<tt>strlen(const char *</tt><em>string</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strlen</tt> returns the length of the string <em>string</em>. The
length does not include the null terminator.
</p>
</body>
</html>

72
man/libc/strrchr.html Normal file
View File

@@ -0,0 +1,72 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strrchr</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strrchr</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strrchr - search string for character
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strrchr(const char *</tt><em>string</em><tt>,
int </tt><em>chr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strrchr</tt> searches <em>string</em> from the right for the first
instance of the character <em>chr</em>.
The characters found and <em>chr</em> are cast to and compared as the
type <tt>unsigned char</tt>.
</p>
<h3>Return Values</h3>
<p>
<tt>strrchr</tt> returns a pointer to the character found. If the
character is not found, NULL is returned.
</p>
</body>
</html>

101
man/libc/strtok.html Normal file
View File

@@ -0,0 +1,101 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strtok</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strtok</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strtok - tokenize string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strtok(char *</tt><em>string</em><tt>,
const char *</tt><em>separators</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strtok</tt> splits up the string <em>string</em> into fields using
the characters found in <em>separators</em> as delimiters. The
delimiters found are discarded. Multiple delimiter characters in a row
are treated as a single delimiter.
</p>
<p>
When first called, <tt>strtok</tt> returns the first field of
<em>string</em>. To retrieve successive fields of <em>string</em>,
call <tt>strtok</tt> again repeatedly, passing <tt>NULL</tt> as the
first argument. When no more fields are left, <tt>NULL</tt> is
returned. If the string is empty or contains only delimiters,
<tt>NULL</tt> will be returned on the first call.
</p>
<h3>Cautions</h3>
<p>
Note that the state used to remember <em>string</em> across calls is
global. Thus, <tt>strtok</tt> cannot be used from more than one thread
at a time in a multithreaded program, nor can it be used in a
subroutine called from within a loop that itself uses
<tt>strtok</tt>. If these restrictions are problematic, use <A
HREF=strtok_r.html>strtok_r</A>.
</p>
<p>
The behavior if strtok is called again without passing a new
<em>string</em> after it has returned <tt>NULL</tt> is undefined.
</p>
<p>
The behavior if strtok is called with the first argument <tt>NULL</tt>
without having first passed a valid <em>string</em> is also undefined.
</p>
<h3>Return Values</h3>
<p>
<tt>strtok</tt> returns successive components of the passed-in string,
and <tt>NULL</tt> when no more remain.
</p>
</body>
</html>

81
man/libc/strtok_r.html Normal file
View File

@@ -0,0 +1,81 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>strtok_r</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strtok_r</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strtok_r - tokenize string reentrantly
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strtok_r(char *</tt><em>string</em><tt>,
const char *</tt><em>separators</em><tt>,
char **</tt><em>context</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strtok_r</tt> is a reentrant version of <A
HREF=strtok.html>strtok</A>. It behaves the same way, except that the
internal state is kept using the <em>context</em> parameter rather
than being global.
</p>
<p>
The value passed to the <em>context</em> parameter should be the
address of a <tt>char *</tt> whose value is preserved between
successive related calls to strtok_r. The <tt>char *</tt> need not be
initialized before the first call, and its value should not be
inspected.
</p>
<h3>Return Values</h3>
<p>
<tt>strtok_r</tt> returns successive components of the passed-in
string, and <tt>NULL</tt> when no more remain.
</p>
</body>
</html>

91
man/libc/system.html Normal file
View File

@@ -0,0 +1,91 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>system</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>system</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
system - run command as subprocess
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>system(const char *</tt><em>command</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The <tt>system</tt> routine executes <em>command</em> as if it were
typed into the shell.
</p>
<h3>Return Values</h3>
<p>
On success, system returns the exit status returned from
<A HREF=../syscall/waitpid.html>waitpid</A>.
On error, -1 is returned, and <A HREF=../syscall/errno.html>errno</A>
is set according to the error encountered.
</p>
<h3>Errors</h3>
<p>
Any of the errors from <A HREF=../syscall/fork.html>fork</A> or
<A HREF=../syscall/waitpid.html>waitpid</A>. Errors generated during
<A HREF=../syscall/execv.html>execv</A> cannot readily be reported
back in detail.
</p>
<h3>Restrictions</h3>
<p>
In OS/161 there may be no shell and when there is the shell's behavior
and syntax is not specified. For this reason we make no assumptions
about the shell's operation, and assume <tt>system</tt> cannot
reliably use the shell to parse and execute <em>command</em>.
Instead, <tt>system</tt> does this itself, in a way which may not
necessarily be compatible with the shell as it finally appears. You
may want to change <tt>system</tt> to invoke the shell in a suitable
fashion when/if a shell is available.
</p>
</body>
</html>

88
man/libc/time.html Normal file
View File

@@ -0,0 +1,88 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>time</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>time</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
time - get time of day
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;time.h&gt;</tt><br>
<br>
<tt>time_t</tt><br>
<tt>time(time_t *</tt><em>ptr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The current time (in seconds since midnight GMT on January 1, 1970) is
retrieved. If <em>ptr</em> is non-null, the time is stored through
<em>ptr</em>. The time is also returned.
</p>
<p>
time is a wrapper around the system call
<A HREF=../syscall/__time.html>__time</A>, which returns nanoseconds
as well as seconds.
</p>
<h3>Return Values</h3>
<p>
<tt>time</tt> returns the time. On error, -1 is returned, and errno is
set to indicate the error.
</p>
<h3>Errors</h3>
<p>
The following error is the only way <tt>time</tt> should be capable of
failing.
</p>
<table width=90%>
<tr><td width=5%>&nbsp;</td>
<td>EFAULT</td> <td><em>ptr</em> was an invalid non-NULL
address.</td></tr>
</table>
</body>
</html>

99
man/libc/warn.html Normal file
View File

@@ -0,0 +1,99 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
The President and Fellows of Harvard College.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>warn</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>warn</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
warn, warnx, vwarn, vwarnx - print warning messages
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;err.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>warn(const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>warnx(const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>vwarn(const char *</tt><em>format</em><tt>, va_list);</tt><br>
<br>
<tt>void</tt><br>
<tt>vwarnx(const char *</tt><em>format</em><tt>, va_list);</tt><br>
</p>
<h3>Description</h3>
<p>
The <tt>warn</tt>, <tt>warnx</tt>, <tt>vwarn</tt>, and <tt>vwarnx</tt>
functions print warning messages to the standard error stream.
</p>
<p>
<tt>warnx</tt> prints the name of the program, a colon, the text
generated by passing <em>format</em> and subsequent args through
<A HREF=printf.html>printf</A>, and a newline.
</p>
<p>
<tt>warn</tt> prints the same thing, except that a colon and the error
string for the current error (obtained by calling
<A HREF=strerror.html>strerror</A> on
<A HREF=../syscall/errno.html>errno</A>) are printed prior to the
newline.
</p>
<p>
<tt>vwarnx</tt> and <tt>vwarn</tt> are the same as <tt>warnx</tt> and
<tt>warn</tt> respectively, except that the additional arguments for
printf are taken to have been already packaged up in a
<tt>va_list</tt> by use of the <A HREF=stdarg.html>stdarg</A> facility.
</p>
<h3>See Also</h3>
<p>
<A HREF=err.html>err</A>
</p>
</body>
</html>