diff options
Diffstat (limited to 'lib/libcompat/4.1')
-rw-r--r-- | lib/libcompat/4.1/ascftime.c | 45 | ||||
-rw-r--r-- | lib/libcompat/4.1/cftime.3 | 103 | ||||
-rw-r--r-- | lib/libcompat/4.1/cftime.c | 46 | ||||
-rw-r--r-- | lib/libcompat/4.1/ftime.3 | 86 | ||||
-rw-r--r-- | lib/libcompat/4.1/ftime.c | 54 | ||||
-rw-r--r-- | lib/libcompat/4.1/getpw.3 | 92 | ||||
-rw-r--r-- | lib/libcompat/4.1/getpw.c | 52 | ||||
-rw-r--r-- | lib/libcompat/4.1/gtty.c | 52 | ||||
-rw-r--r-- | lib/libcompat/4.1/stty.3 | 98 | ||||
-rw-r--r-- | lib/libcompat/4.1/stty.c | 52 |
10 files changed, 680 insertions, 0 deletions
diff --git a/lib/libcompat/4.1/ascftime.c b/lib/libcompat/4.1/ascftime.c new file mode 100644 index 0000000..b3c15e4 --- /dev/null +++ b/lib/libcompat/4.1/ascftime.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1994 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$ + */ + +#include <time.h> + +#define MAXLEN 1000 /* just a guess, only the user knows... */ + +int +ascftime(char *s, const char *format, const struct tm *tmptr) +{ + return strftime(s, MAXLEN, format? format: "%C", tmptr); +} diff --git a/lib/libcompat/4.1/cftime.3 b/lib/libcompat/4.1/cftime.3 new file mode 100644 index 0000000..d346734 --- /dev/null +++ b/lib/libcompat/4.1/cftime.3 @@ -0,0 +1,103 @@ +.\" +.\" 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 +.In time.h +.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 . +.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. +.Pp +.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. +.Pp +.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/cftime.c b/lib/libcompat/4.1/cftime.c new file mode 100644 index 0000000..8033e44 --- /dev/null +++ b/lib/libcompat/4.1/cftime.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1994 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$ + */ + +#include <time.h> + +#define MAXLEN 1000 /* just a guess, only the user knows... */ + +int +cftime(char *s, char *format, const time_t *clock) +{ + return strftime(s, MAXLEN, format? format: "%C", localtime(clock)); +} + diff --git a/lib/libcompat/4.1/ftime.3 b/lib/libcompat/4.1/ftime.3 new file mode 100644 index 0000000..4a80a8f --- /dev/null +++ b/lib/libcompat/4.1/ftime.3 @@ -0,0 +1,86 @@ +.\" 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 +.Sh NAME +.Nm ftime +.Nd get date and time +.Sh LIBRARY +.Lb libcompat +.Sh SYNOPSIS +.In sys/types.h +.In sys/timeb.h +.Ft int +.Fn ftime "struct timeb *tp" +.Sh DESCRIPTION +.Bf -symbolic +This interface is obsoleted by +.Xr gettimeofday 2 . +.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/ftime.c b/lib/libcompat/4.1/ftime.c new file mode 100644 index 0000000..cc4a7f9 --- /dev/null +++ b/lib/libcompat/4.1/ftime.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1994 Christopher G. Demetriou + * 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 Christopher G. Demetriou. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +#ifndef lint +static char rcsid[] = "$FreeBSD$"; +#endif /* not lint */ + +#include <sys/types.h> +#include <sys/time.h> +#include <sys/timeb.h> + +int +ftime(tbp) + struct timeb *tbp; +{ + struct timezone tz; + struct timeval t; + + if (gettimeofday(&t, &tz) < 0) + return (-1); + tbp->millitm = t.tv_usec / 1000; + tbp->time = t.tv_sec; + tbp->timezone = tz.tz_minuteswest; + tbp->dstflag = tz.tz_dsttime; + + return (0); +} diff --git a/lib/libcompat/4.1/getpw.3 b/lib/libcompat/4.1/getpw.3 new file mode 100644 index 0000000..3897136 --- /dev/null +++ b/lib/libcompat/4.1/getpw.3 @@ -0,0 +1,92 @@ +.\" 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 +.In sys/types.h +.Ft int +.Fn getpw "uid_t uid" "char *buf" +.Sh DESCRIPTION +.Bf -symbolic +The +.Fn getpw +function is made obsolete by +.Xr getpwuid 3 . +.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. +.Pp +All of the bugs from +.Xr getpwent 3 +hold valid as well. diff --git a/lib/libcompat/4.1/getpw.c b/lib/libcompat/4.1/getpw.c new file mode 100644 index 0000000..d6f4f8b --- /dev/null +++ b/lib/libcompat/4.1/getpw.c @@ -0,0 +1,52 @@ +/* + * 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$ + */ + +#include <sys/types.h> +#include <pwd.h> +#include <string.h> +#include <stdio.h> + +int +getpw(uid_t uid, char *buf) +{ + struct passwd *pw; + + pw = getpwuid(uid); + endpwent(); + + if(pw == 0) return -1; + + strncpy(buf, pw->pw_name, L_cuserid); + return 0; +} diff --git a/lib/libcompat/4.1/gtty.c b/lib/libcompat/4.1/gtty.c new file mode 100644 index 0000000..524f1a6 --- /dev/null +++ b/lib/libcompat/4.1/gtty.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1994 Christopher G. Demetriou + * 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 Christopher G. Demetriou. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +#ifndef lint +static char rcsid[] = "$FreeBSD$"; +#endif /* not lint */ + +#include <sgtty.h> + +/* + * Get tty modes. + * This was defined in ioctl_compat.h as: + * #define gtty(fd, tty) ioctl(fd, TIOCGETP, tty) + */ + +#undef gtty + +int +gtty(fd, tty) + int fd; + struct sgttyb *tty; +{ + + return (ioctl(fd, TIOCGETP, tty)); +} diff --git a/lib/libcompat/4.1/stty.3 b/lib/libcompat/4.1/stty.3 new file mode 100644 index 0000000..71b4614 --- /dev/null +++ b/lib/libcompat/4.1/stty.3 @@ -0,0 +1,98 @@ +.\" 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 +.Sh NAME +.Nm stty , +.Nm gtty +.Nd set and get terminal state (defunct) +.Sh LIBRARY +.Lb libcompat +.Sh SYNOPSIS +.In sgtty.h +.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 +.Xr ioctl 2 . +.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.1/stty.c b/lib/libcompat/4.1/stty.c new file mode 100644 index 0000000..cf0137f --- /dev/null +++ b/lib/libcompat/4.1/stty.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1994 Christopher G. Demetriou + * 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 Christopher G. Demetriou. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +#ifndef lint +static char rcsid[] = "$FreeBSD$"; +#endif /* not lint */ + +#include <sgtty.h> + +/* + * Set tty modes. + * This was defined in ioctl_compat.h as: + * #define stty(fd, tty) ioctl(fd, TIOCSETP, tty) + */ + +#undef stty + +int +stty(fd, tty) + int fd; + struct sgttyb *tty; +{ + + return (ioctl(fd, TIOCSETP, tty)); +} |