diff --git a/lib/libcompat/4.1/cftime.3 b/lib/libcompat/4.1/cftime.3 index 35505bf28656..afefee31a47c 100644 --- a/lib/libcompat/4.1/cftime.3 +++ b/lib/libcompat/4.1/cftime.3 @@ -1,104 +1,105 @@ .\" .\" Copyright (c) 1994, 1995 Joerg Wunsch .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Joerg Wunsch .\" 4. The name of the developer may not be used to endorse or promote .\" products derived from this software without specific prior written .\" permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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. .\" .\" .\" $FreeBSD$ .\" .Dd June 15, 1993 .Os .Dt CFTIME 3 .Sh NAME .Nm cftime .Nm ascftime .Nd convert date and time to string +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Ft int .Fn cftime "char *s" "char *format" "const time_t *clock" .Ft int .Fn ascftime "char *s" "const char *format" "const struct tm *tmptr" .Sh DESCRIPTION .Bf -symbolic The .Fn cftime and .Fn ascftime functions are made obsolete by .Xr strftime 3 . -They are available from the compatibility library, libcompat. .Ef .Pp Use of the functions .Fn cftime and .Fn ascftime is strongly deprecated, since there is no way to check for a buffer overflow condition. Use .Xr strftime 3 instead. .Fn Ascftime is almost identical with .Xr strftime 3 , with the only exception there's no parameter to tell about the maximal buffer length, and the .Fa format parameter defaults to .Dq %C if a .Em NULL pointer is given. .Fn Cftime does the same job, but it first invokes .Xr localtime 3 in order to convert the given .Fa clock , then also performs the conversions as requested by the .Fa format argument. .Sh RETURN VALUES The .Fn cftime and .Fn ascftime functions return the number of characters written to the output buffer .Fa s , not counting the trailing null character. .Sh SEE ALSO .Xr localtime 3 , .Xr strftime 3 diff --git a/lib/libcompat/4.1/ftime.3 b/lib/libcompat/4.1/ftime.3 index e676a957c13f..3e573df3199a 100644 --- a/lib/libcompat/4.1/ftime.3 +++ b/lib/libcompat/4.1/ftime.3 @@ -1,85 +1,85 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)ftime.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd June 4, 1993 .Dt FTIME 3 .Os BSD 4 .Sh NAME .Nm ftime .Nd get date and time +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Fd #include .Ft int .Fn ftime "struct timeb *tp" .Sh DESCRIPTION .Bf -symbolic This interface is obsoleted by gettimeofday(2). -.Pp -It is available from the compatibility library, libcompat. .Ef .Pp The .Fn ftime routine fills in a structure pointed to by its argument, as defined by .Aq Pa sys/timeb.h : .Bd -literal -offset indent /* * Structure returned by ftime system call */ struct timeb { time_t time; unsigned short millitm; short timezone; short dstflag; }; .Ed .Pp The structure contains the time since the epoch in seconds, up to 1000 milliseconds of more-precise interval, the local time zone (measured in minutes of time westward from Greenwich), and a flag that, if nonzero, indicates that Daylight Saving time applies locally during the appropriate part of the year. .Sh SEE ALSO .Xr gettimeofday 2 , .Xr settimeofday 2 , .Xr ctime 3 , .Xr time 3 .Sh HISTORY The .Nm function appeared in .Bx 4.2 . diff --git a/lib/libcompat/4.1/getpw.3 b/lib/libcompat/4.1/getpw.3 index 169b9d291253..17c44783812a 100644 --- a/lib/libcompat/4.1/getpw.3 +++ b/lib/libcompat/4.1/getpw.3 @@ -1,88 +1,89 @@ .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)getpw.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd June 4, 1993 .Dt GETPW 3 .Os .Sh NAME .Nm getpw .Nd get name from uid +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Ft int .Fn getpw "uid_t uid" "char *buf" .Sh DESCRIPTION .Bf -symbolic The getpw function is made obsolete by getpwuid(3). -It is available from the compatibility library, libcompat. .Ef .Pp The .Fn getpw function reads the file .Pa /etc/passwd , and if it finds the specified .Fa uid , copies the password entry line into the string pointed to by .Fa buf . the null terminated entry line from the password database, and appends the .Dv NUL character. .Sh RETURN VALUES The .Fn getpw function returns the zero if successful, otherwise a non-zero if the entry does not exist. .Sh FILES .Bl -tag -width /etc/passwd - compact .It Pa /etc/passwd .El .Sh SEE ALSO .Xr getpwent 3 , .Xr passwd 5 .Sh HISTORY A .Fn getpw function appeared in .At v6 . .Sh BUGS The area pointed to by .Fa buf must be large enough to hold the user name. All of the bugs from .Xr getpwent 3 hold valid as well. diff --git a/lib/libcompat/4.1/stty.3 b/lib/libcompat/4.1/stty.3 index 564bf5b68c32..6c6bb882a864 100644 --- a/lib/libcompat/4.1/stty.3 +++ b/lib/libcompat/4.1/stty.3 @@ -1,96 +1,97 @@ .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)stty.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd June 4, 1993 .Dt STTY 3 .Os BSD 4.2 .Sh NAME .Nm stty , .Nm gtty .Nd set and get terminal state (defunct) +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Ft int .Fn stty "int fd" "struct sgttyb *buf" .Ft int .Fn gtty "int fd" "struct sgttyb *buf" .Sh DESCRIPTION .Bf -symbolic These interfaces are obsoleted by ioctl(2). -They are available from the compatibility library, libcompat. .Ef .Pp The .Fn stty function sets the state of the terminal associated with .Fa fd . The .Fn gtty function retrieves the state of the terminal associated with .Fa fd . To set the state of a terminal the call must have write permission. .Pp The .Fn stty call is actually .Ql ioctl(fd, TIOCSETP, buf) , while the .Fn gtty call is .Ql ioctl(fd, TIOCGETP, buf) . See .Xr ioctl 2 and .Xr tty 4 for an explanation. .Sh DIAGNOSTICS If the call is successful 0 is returned, otherwise \-1 is returned and the global variable .Va errno contains the reason for the failure. .Sh SEE ALSO .Xr ioctl 2 , .Xr tty 4 .Sh HISTORY The .Fn stty and .Fn gtty functions appeared in .Bx 4.2 . diff --git a/lib/libcompat/4.3/cfree.3 b/lib/libcompat/4.3/cfree.3 index e499908e0c56..4d380e4a2898 100644 --- a/lib/libcompat/4.3/cfree.3 +++ b/lib/libcompat/4.3/cfree.3 @@ -1,48 +1,49 @@ .\" .\" Copyright (c) 1995 Joerg Wunsch .\" .\" All rights reserved. .\" .\" 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. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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. .\" .\" $FreeBSD$ .\" " <- this is for hilit19 :) .Dd November 23, 1995 .Dt CFREE 3 .Os .Sh NAME .Nm cfree .Nd free up allocated memory +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Ft void .Fn cfree "void *" .Sh DESCRIPTION .Bf -symbolic The cfree function considered obsolete. -It is available from the compatibility library, libcompat. .Ef .Pp The .Nm function is a synonym for .Xr free 3 . .Sh SEE ALSO .Xr free 3 diff --git a/lib/libcompat/4.3/insque.3 b/lib/libcompat/4.3/insque.3 index 40ab8d65b63f..bc8cc5c7826b 100644 --- a/lib/libcompat/4.3/insque.3 +++ b/lib/libcompat/4.3/insque.3 @@ -1,88 +1,89 @@ .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)insque.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" .Dd December 11, 1993 .Dt INSQUE 3 .Os BSD 4.2 .Sh NAME .Nm insque , .Nm remque .Nd insert/remove element from a queue +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Bd -literal struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[]; }; .Ed .Ft void .Fn insque "struct qelem *elem" "struct qelem *pred" .Ft void .Fn remque "struct qelem *elem" .Sh DESCRIPTION .Bf -symbolic The insque and remque functions are considered obsolete. -They are available from the compatibility library, libcompat. .Ef .Pp The .Fn insque and .Fn remque functions manipulate queues built from doubly linked lists. Each element in the queue must be in the form of .Dq Li struct qelem . The function .Fn insque inserts .Fa elem in a queue immediately after .Fa pred ; .Fn remque removes an entry .Fa elem from a queue. .Sh SEE ALSO .%T "VAX Architecture Handbook" , pp. 228-235. .Sh HISTORY The .Fn insque and .Fn remque functions appeared in .Bx 4.2 . diff --git a/lib/libcompat/4.3/lsearch.3 b/lib/libcompat/4.3/lsearch.3 index 3a98ed90d114..fe494f3ac0b7 100644 --- a/lib/libcompat/4.3/lsearch.3 +++ b/lib/libcompat/4.3/lsearch.3 @@ -1,104 +1,105 @@ .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)lsearch.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd June 4, 1993 .Dt LSEARCH 3 .Os .Sh NAME .Nm lsearch , .Nm lfind, .Nd linear searching routines +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Ft char * .Fn lsearch "const void *key" "const void *base" "size_t *nelp" "size_t width" "int (*compar)(void *, void *)" .Ft char * .Fn lfind "const void *key" "const void *base" "size_t *nelp" "size_t width" "int (*compar)(void *, void *)" .Sh DESCRIPTION .Bf -symbolic This interface was obsolete before it was written. -It is available from the compatibility library, libcompat. .Ef .Pp The functions .Fn lsearch , and .Fn lfind provide basic linear searching functionality. .Pp .Fa Base is the pointer to the beginning of an array. The argument .Fa nelp is the current number of elements in the array, where each element is .Fa width bytes long. The .Fa compar function is a comparison routine which is used to compare two elements. It takes two arguments which point to the .Fa key object and to an array member, in that order, and must return an integer less than, equivalent to, or greater than zero if the .Fa key object is considered, respectively, to be less than, equal to, or greater than the array member. .Pp The .Fn lsearch and .Fn lfind functions return a pointer into the array referenced by .Fa base where .Fa key is located. If .Fa key does not exist, .Fn lfind will return a null pointer and .Fn lsearch will add it to the array. When an element is added to the array by .Fn lsearch the location referenced by the argument .Fa nelp is incremented by one. .Sh SEE ALSO .Xr bsearch 3 , .Xr db 3 diff --git a/lib/libcompat/4.3/re_comp.3 b/lib/libcompat/4.3/re_comp.3 index 322413f99599..16f75cf60409 100644 --- a/lib/libcompat/4.3/re_comp.3 +++ b/lib/libcompat/4.3/re_comp.3 @@ -1,126 +1,129 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)re_comp.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd June 4, 1993 .Dt RE_COMP 3 .Os .Sh NAME .Nm re_comp , .Nm re_exec .Nd regular expression handler +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Ft char * .Fn re_comp "const char *s" .Ft int .Fn re_exec "const char *s" .Sh DESCRIPTION +.Bf -symbolic This interface is made obsolete by .Xr regex 3 . -It is available from the compatibility library, libcompat. +.Ef .Pp The .Fn re_comp function compiles a string into an internal form suitable for pattern matching. The .Fn re_exec function checks the argument string against the last string passed to .Fn re_comp . .Pp The .Fn re_comp function returns 0 if the string .Fa s was compiled successfully; otherwise a string containing an error message is returned. If .Fn re_comp is passed 0 or a null string, it returns without changing the currently compiled regular expression. .Pp The .Fn re_exec function returns 1 if the string .Fa s matches the last compiled regular expression, 0 if the string .Fa s failed to match the last compiled regular expression, and \-1 if the compiled regular expression was invalid (indicating an internal error). .Pp The strings passed to both .Fn re_comp and .Fn re_exec may have trailing or embedded newline characters; they are terminated by .Dv NUL Ns s. The regular expressions recognized are described in the manual entry for .Xr ed 1 , given the above difference. .Sh DIAGNOSTICS The .Fn re_exec function returns \-1 for an internal error. .Pp The .Fn re_comp function returns one of the following strings if an error occurs: .Bd -unfilled -offset indent No previous regular expression, Regular expression too long, unmatched \e(, missing ], too many \e(\e) pairs, unmatched \e). .Ed .Sh SEE ALSO .Xr ed 1 , .Xr egrep 1 , .Xr ex 1 , .Xr fgrep 1 , .Xr grep 1 , .Xr regex 3 .Sh HISTORY The .Fn re_comp and .Fn re_exec functions appeared in .Bx 4.0 . diff --git a/lib/libcompat/4.3/rexec.3 b/lib/libcompat/4.3/rexec.3 index 34d53fffd375..6101d1aebc85 100644 --- a/lib/libcompat/4.3/rexec.3 +++ b/lib/libcompat/4.3/rexec.3 @@ -1,133 +1,134 @@ .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)rexec.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd June 4, 1993 .Dt REXEC 3 .Os BSD 4.2 .Sh NAME .Nm rexec .Nd return stream to a remote command +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Ft int .Fn rexec "char **ahost" "int inport" "char *user" "char *passwd" "char *cmd" "int *fd2p" .Sh DESCRIPTION .Bf -symbolic This interface is obsoleted by .Xr rcmd 3 . -It is available from the compatibility library, libcompat. .Ef .Pp The .Fn rexec function looks up the host .Fa *ahost using .Xr gethostbyname 3 , returning \-1 if the host does not exist. Otherwise .Fa *ahost is set to the standard name of the host. If a username and password are both specified, then these are used to authenticate to the foreign host; otherwise the environment and then the user's .Pa .netrc file in his home directory are searched for appropriate information. If all this fails, the user is prompted for the information. .Pp The port .Fa inport specifies which well-known .Tn DARPA Internet port to use for the connection; the call .Ql getservbyname(\\*qexec\\*q, \\*qtcp\\*q) (see .Xr getservent 3 ) will return a pointer to a structure, which contains the necessary port. The protocol for connection is described in detail in .Xr rexecd 8 . .Pp If the connection succeeds, a socket in the Internet domain of type .Dv SOCK_STREAM is returned to the caller, and given to the remote command as .Em stdin and .Em stdout . If .Fa fd2p is non-zero, then an auxiliary channel to a control process will be setup, and a descriptor for it will be placed in .Fa *fd2p . The control process will return diagnostic output from the command (unit 2) on this channel, and will also accept bytes on this channel as being .Tn UNIX signal numbers, to be forwarded to the process group of the command. The diagnostic information returned does not include remote authorization failure, as the secondary connection is set up after authorization has been verified. If .Fa fd2p is 0, then the .Em stderr (unit 2 of the remote command) will be made the same as the .Em stdout and no provision is made for sending arbitrary signals to the remote process, although you may be able to get its attention by using out-of-band data. .Sh SEE ALSO .Xr rcmd 3 , .Xr rexecd 8 .Sh HISTORY The .Fn rexec function appeared in .Bx 4.2 . .Sh BUGS The .Fn rexec function sends the unencrypted password across the network. .Pp The underlying service is considered a big security hole and therefore not enabled on many sites, see .Xr rexecd 8 for explanations. diff --git a/lib/libcompat/4.4/cuserid.3 b/lib/libcompat/4.4/cuserid.3 index db4d760610d3..4f53da77b0f7 100644 --- a/lib/libcompat/4.4/cuserid.3 +++ b/lib/libcompat/4.4/cuserid.3 @@ -1,85 +1,86 @@ .\" .\" Copyright (c) 1995 Joerg Wunsch .\" .\" All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Joerg Wunsch .\" 4. The name of the developer may not be used to endorse or promote .\" products derived from this software without specific prior written .\" permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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. .\" .\" $FreeBSD$ .\" .Dd April 10, 1995 .Os .Dt CUSERID 3 .Sh NAME .Nm cuserid .Nd get user name associated with effective UID +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Ft char * .Fn cuserid "char *s" .Sh DESCRIPTION .Bf -symbolic The .Fn cuserid function is made obsolete by .Xr getpwuid 3 . -It is available from the compatibility library, libcompat. .Ef .Pp The function .Fn cuserid gets the user name associated with the effective UID of the current process. If the argument .Fa s is non-NULL, the name is copied to the buffer it points to, and that address is being returned. This buffer must provide space for at least .Em L_cuserid characters. The L_cuserid constant is defined in .Pa Aq stdio.h . If .Fa s is NULL, an internal array is used and its address will be returned. .Sh RETURN VALUES .Fn cuserid returns the address of an array in which the name has been stored. If the name associated with the effective UID of the current process could not be found, either a null pointer will be returned, or .Po if .Fa s is non-NULL .Pc the buffer .Fa s will be filled with a null string. .Sh SEE ALSO .Xr geteuid 2 , .Xr getpwuid 3 diff --git a/lib/libcompat/regexp/regexp.3 b/lib/libcompat/regexp/regexp.3 index a58fdb166f1b..3ddf30b29a22 100644 --- a/lib/libcompat/regexp/regexp.3 +++ b/lib/libcompat/regexp/regexp.3 @@ -1,322 +1,323 @@ .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. 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 REGENTS 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 REGENTS 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. .\" .\" @(#)regexp.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd June 4, 1993 .Dt REGEXP 3 .Os .Sh NAME .Nm regcomp , .Nm regexec , .Nm regsub , .Nm regerror .Nd regular expression handlers +.Sh LIBRARY +.Lb libcompat .Sh SYNOPSIS .Fd #include .Ft regexp * .Fn regcomp "const char *exp" .Ft int .Fn regexec "const regexp *prog" "const char *string" .Ft void .Fn regsub "const regexp *prog" "const char *source" "char *dest" .Sh DESCRIPTION .Bf Sy This interface is made obsolete by .Xr regex 3 . -It is available from the compatibility library, libcompat. .Ef .Pp The .Fn regcomp , .Fn regexec , .Fn regsub , and .Fn regerror functions implement .Xr egrep 1 Ns -style regular expressions and supporting facilities. .Pp The .Fn regcomp function compiles a regular expression into a structure of type .Xr regexp , and returns a pointer to it. The space has been allocated using .Xr malloc 3 and may be released by .Xr free . .Pp The .Fn regexec function matches a .Dv NUL Ns -terminated .Fa string against the compiled regular expression in .Fa prog . It returns 1 for success and 0 for failure, and adjusts the contents of .Fa prog Ns 's .Em startp and .Em endp (see below) accordingly. .Pp The members of a .Xr regexp structure include at least the following (not necessarily in order): .Bd -literal -offset indent char *startp[NSUBEXP]; char *endp[NSUBEXP]; .Ed .Pp where .Dv NSUBEXP is defined (as 10) in the header file. Once a successful .Fn regexec has been done using the .Fn regexp , each .Em startp Ns - Em endp pair describes one substring within the .Fa string , with the .Em startp pointing to the first character of the substring and the .Em endp pointing to the first character following the substring. The 0th substring is the substring of .Fa string that matched the whole regular expression. The others are those substrings that matched parenthesized expressions within the regular expression, with parenthesized expressions numbered in left-to-right order of their opening parentheses. .Pp The .Fn regsub function copies .Fa source to .Fa dest , making substitutions according to the most recent .Fn regexec performed using .Fa prog . Each instance of `&' in .Fa source is replaced by the substring indicated by .Em startp Ns Bq and .Em endp Ns Bq . Each instance of .Sq \e Ns Em n , where .Em n is a digit, is replaced by the substring indicated by .Em startp Ns Bq Em n and .Em endp Ns Bq Em n . To get a literal `&' or .Sq \e Ns Em n into .Fa dest , prefix it with `\e'; to get a literal `\e' preceding `&' or .Sq \e Ns Em n , prefix it with another `\e'. .Pp The .Fn regerror function is called whenever an error is detected in .Fn regcomp , .Fn regexec , or .Fn regsub . The default .Fn regerror writes the string .Fa msg , with a suitable indicator of origin, on the standard error output and invokes .Xr exit 3 . The .Fn regerror function can be replaced by the user if other actions are desirable. .Sh REGULAR EXPRESSION SYNTAX A regular expression is zero or more .Em branches , separated by `|'. It matches anything that matches one of the branches. .Pp A branch is zero or more .Em pieces , concatenated. It matches a match for the first, followed by a match for the second, etc. .Pp A piece is an .Em atom possibly followed by `*', `+', or `?'. An atom followed by `*' matches a sequence of 0 or more matches of the atom. An atom followed by `+' matches a sequence of 1 or more matches of the atom. An atom followed by `?' matches a match of the atom, or the null string. .Pp An atom is a regular expression in parentheses (matching a match for the regular expression), a .Em range (see below), `.' (matching any single character), `^' (matching the null string at the beginning of the input string), `$' (matching the null string at the end of the input string), a `\e' followed by a single character (matching that character), or a single character with no other significance (matching that character). .Pp A .Em range is a sequence of characters enclosed in `[]'. It normally matches any single character from the sequence. If the sequence begins with `^', it matches any single character .Em not from the rest of the sequence. If two characters in the sequence are separated by `\-', this is shorthand for the full list of .Tn ASCII characters between them (e.g. `[0-9]' matches any decimal digit). To include a literal `]' in the sequence, make it the first character (following a possible `^'). To include a literal `\-', make it the first or last character. .Sh AMBIGUITY If a regular expression could match two different parts of the input string, it will match the one which begins earliest. If both begin in the same place but match different lengths, or match the same length in different ways, life gets messier, as follows. .Pp In general, the possibilities in a list of branches are considered in left-to-right order, the possibilities for `*', `+', and `?' are considered longest-first, nested constructs are considered from the outermost in, and concatenated constructs are considered leftmost-first. The match that will be chosen is the one that uses the earliest possibility in the first choice that has to be made. If there is more than one choice, the next will be made in the same manner (earliest possibility) subject to the decision on the first choice. And so forth. .Pp For example, .Sq Li (ab|a)b*c could match `abc' in one of two ways. The first choice is between `ab' and `a'; since `ab' is earlier, and does lead to a successful overall match, it is chosen. Since the `b' is already spoken for, the `b*' must match its last possibility\(emthe empty string\(emsince it must respect the earlier choice. .Pp In the particular case where no `|'s are present and there is only one `*', `+', or `?', the net effect is that the longest possible match will be chosen. So .Sq Li ab* , presented with `xabbbby', will match `abbbb'. Note that if .Sq Li ab* , is tried against `xabyabbbz', it will match `ab' just after `x', due to the begins-earliest rule. (In effect, the decision on where to start the match is the first choice to be made, hence subsequent choices must respect it even if this leads them to less-preferred alternatives.) .Sh RETURN VALUES The .Fn regcomp function returns .Dv NULL for a failure .Pf ( Fn regerror permitting), where failures are syntax errors, exceeding implementation limits, or applying `+' or `*' to a possibly-null operand. .Sh SEE ALSO .Xr ed 1 , .Xr egrep 1 , .Xr ex 1 , .Xr expr 1 , .Xr fgrep 1 , .Xr grep 1 , .Xr regex 3 .Sh HISTORY Both code and manual page for .Fn regcomp , .Fn regexec , .Fn regsub , and .Fn regerror were written at the University of Toronto and appeared in .Bx 4.3 tahoe . They are intended to be compatible with the Bell V8 .Xr regexp 3 , but are not derived from Bell code. .Sh BUGS Empty branches and empty regular expressions are not portable to V8. .Pp The restriction against applying `*' or `+' to a possibly-null operand is an artifact of the simplistic implementation. .Pp Does not support .Xr egrep Ns 's newline-separated branches; neither does the V8 .Xr regexp 3 , though. .Pp Due to emphasis on compactness and simplicity, it's not strikingly fast. It does give special attention to handling simple cases quickly.