summaryrefslogtreecommitdiffstats
path: root/lib/libcompat/4.1
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcompat/4.1')
-rw-r--r--lib/libcompat/4.1/ascftime.c52
-rw-r--r--lib/libcompat/4.1/cftime.399
-rw-r--r--lib/libcompat/4.1/cftime.c53
-rw-r--r--lib/libcompat/4.1/getpw.38
-rw-r--r--lib/libcompat/4.1/getpw.c58
-rw-r--r--lib/libcompat/4.1/gtty.c5
-rw-r--r--lib/libcompat/4.1/stty.c5
-rw-r--r--lib/libcompat/4.1/vlimit.32
-rw-r--r--lib/libcompat/4.1/vtimes.32
9 files changed, 282 insertions, 2 deletions
diff --git a/lib/libcompat/4.1/ascftime.c b/lib/libcompat/4.1/ascftime.c
new file mode 100644
index 0000000..e842b6e
--- /dev/null
+++ b/lib/libcompat/4.1/ascftime.c
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <time.h>
+
+#define MAXLEN 1000 /* just a guess, only the user knows... */
+
+int
+#if __STDC__
+ascftime(char *s, const char *format, const struct tm *tmptr)
+#else
+ascftime(s, format, tmptr)
+ char *s;
+ char *format;
+ struct tm *tmptr;
+#endif
+{
+ 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..5c760a9
--- /dev/null
+++ b/lib/libcompat/4.1/cftime.3
@@ -0,0 +1,99 @@
+.\"
+.\" 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.
+.\"
+.\"
+.\" $Id$
+.\"
+.Dd June 15, 1993
+.Os
+.Dt CFTIME 3
+.Sh NAME
+.Nm cftime
+.Nm ascftime
+.Nd convert date and time to string
+.Sh SYNOPSIS
+.Fd #include <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 cftime and ascftime functions are made obsolete by strftime(3).
+.br
+They are available from the compatibility library, libcompat.
+.Ef
+.Pp
+Use of the functions
+.Nm cftime
+and
+.Nm ascftime
+is strongly deprecated, since there is no way to check for a buffer
+overflow condition. Use
+.Xr strftime 3
+instead.
+
+.Nm 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.
+
+.Nm 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
+.Nm cftime
+and
+.Nm 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..2e3a34b
--- /dev/null
+++ b/lib/libcompat/4.1/cftime.c
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <time.h>
+
+#define MAXLEN 1000 /* just a guess, only the user knows... */
+
+int
+#if __STDC__
+cftime(char *s, char *format, const time_t *clock)
+#else
+cftime(s, format, clock)
+ char *s;
+ char *format;
+ time_t *clock;
+#endif
+{
+ return strftime(s, MAXLEN, format? format: "%C", localtime(clock));
+}
+
diff --git a/lib/libcompat/4.1/getpw.3 b/lib/libcompat/4.1/getpw.3
index 1568e74..4cf160c 100644
--- a/lib/libcompat/4.1/getpw.3
+++ b/lib/libcompat/4.1/getpw.3
@@ -76,3 +76,11 @@ 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/getpw.c b/lib/libcompat/4.1/getpw.c
new file mode 100644
index 0000000..9fc7eb1
--- /dev/null
+++ b/lib/libcompat/4.1/getpw.c
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <sys/types.h>
+#include <pwd.h>
+#include <string.h>
+#include <stdio.h>
+
+int
+#if __STDC__
+getpw(uid_t uid, char *buf)
+#else
+getpw(uid, buf)
+ uid_t uid;
+ char *buf;
+#endif
+{
+ 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
index a6a9c64..7875399 100644
--- a/lib/libcompat/4.1/gtty.c
+++ b/lib/libcompat/4.1/gtty.c
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: gtty.c,v 1.1 1994/05/21 05:20:34 cgd Exp $";
+static char rcsid[] = "$Id: gtty.c,v 1.1.1.1 1994/05/27 10:33:22 rgrimes Exp $";
#endif /* not lint */
#include <sgtty.h>
@@ -39,6 +39,9 @@ static char rcsid[] = "$Id: gtty.c,v 1.1 1994/05/21 05:20:34 cgd Exp $";
* This was defined in ioctl_compat.h as:
* #define gtty(fd, tty) ioctl(fd, TIOCGETP, tty)
*/
+
+#undef gtty
+
int
gtty(fd, tty)
int fd;
diff --git a/lib/libcompat/4.1/stty.c b/lib/libcompat/4.1/stty.c
index 3e89506..91d241b 100644
--- a/lib/libcompat/4.1/stty.c
+++ b/lib/libcompat/4.1/stty.c
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: stty.c,v 1.1 1994/05/21 05:20:41 cgd Exp $";
+static char rcsid[] = "$Id: stty.c,v 1.1.1.1 1994/05/27 10:33:22 rgrimes Exp $";
#endif /* not lint */
#include <sgtty.h>
@@ -39,6 +39,9 @@ static char rcsid[] = "$Id: stty.c,v 1.1 1994/05/21 05:20:41 cgd Exp $";
* This was defined in ioctl_compat.h as:
* #define stty(fd, tty) ioctl(fd, TIOCSETP, tty)
*/
+
+#undef stty
+
int
stty(fd, tty)
int fd;
diff --git a/lib/libcompat/4.1/vlimit.3 b/lib/libcompat/4.1/vlimit.3
index 062f557..d4ed5f3 100644
--- a/lib/libcompat/4.1/vlimit.3
+++ b/lib/libcompat/4.1/vlimit.3
@@ -121,3 +121,5 @@ function appeared in
.Sh BUGS
.Dv LIM_NORAISE
no longer exists.
+
+This function has not yet been reimplemented.
diff --git a/lib/libcompat/4.1/vtimes.3 b/lib/libcompat/4.1/vtimes.3
index dc4ff4a..e02bb72 100644
--- a/lib/libcompat/4.1/vtimes.3
+++ b/lib/libcompat/4.1/vtimes.3
@@ -139,3 +139,5 @@ The
.Fn vlimit
function appeared in
.Bx 4.2 .
+.Sh BUGS
+This function has not yet been re-implemented.
OpenPOWER on IntegriCloud