summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-09 02:43:02 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-09 02:43:02 +0000
commitc3996ffb0dc7db615b0d7bb4a7bc9fc0c187177b (patch)
tree8e4fc4b3efec6da143824896decaa98171777b34 /lib/libc
parent81fdb1c9d870ea7675764665befe8112a17eaa0a (diff)
From NetBSD: 960217 merge
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/rpc/xdr_mem.c88
-rw-r--r--lib/libc/string/bcmp.c5
-rw-r--r--lib/libc/string/bm.c10
-rw-r--r--lib/libc/string/strcat.c6
-rw-r--r--lib/libc/string/strcpy.c6
-rw-r--r--lib/libc/string/strftime.c10
-rw-r--r--lib/libc/sys/mount.25
-rw-r--r--lib/libc/yp/xdryp.c7
-rw-r--r--lib/libc/yp/yplib.c7
9 files changed, 107 insertions, 37 deletions
diff --git a/lib/libc/rpc/xdr_mem.c b/lib/libc/rpc/xdr_mem.c
index 5927e8b330d..a1bbb866a4d 100644
--- a/lib/libc/rpc/xdr_mem.c
+++ b/lib/libc/rpc/xdr_mem.c
@@ -1,4 +1,5 @@
-/* $NetBSD: xdr_mem.c,v 1.3 1995/02/25 03:02:07 cgd Exp $ */
+/* $OpenBSD: xdr_mem.c,v 1.2 1996/03/09 02:42:53 niklas Exp $ */
+/* $NetBSD: xdr_mem.c,v 1.4 1996/02/08 08:06:05 mycroft Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -32,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$NetBSD: xdr_mem.c,v 1.3 1995/02/25 03:02:07 cgd Exp $";
+static char *rcsid = "$NetBSD: xdr_mem.c,v 1.4 1996/02/08 08:06:05 mycroft Exp $";
#endif
/*
@@ -51,23 +52,37 @@ static char *rcsid = "$NetBSD: xdr_mem.c,v 1.3 1995/02/25 03:02:07 cgd Exp $";
#include <rpc/xdr.h>
#include <netinet/in.h>
-static bool_t xdrmem_getlong();
-static bool_t xdrmem_putlong();
+static bool_t xdrmem_getlong_aligned();
+static bool_t xdrmem_putlong_aligned();
+static bool_t xdrmem_getlong_unaligned();
+static bool_t xdrmem_putlong_unaligned();
static bool_t xdrmem_getbytes();
static bool_t xdrmem_putbytes();
static u_int xdrmem_getpos(); /* XXX w/64-bit pointers, u_int not enough! */
static bool_t xdrmem_setpos();
-static int32_t *xdrmem_inline();
+static int32_t *xdrmem_inline_aligned();
+static int32_t *xdrmem_inline_unaligned();
static void xdrmem_destroy();
-static struct xdr_ops xdrmem_ops = {
- xdrmem_getlong,
- xdrmem_putlong,
+static struct xdr_ops xdrmem_ops_aligned = {
+ xdrmem_getlong_aligned,
+ xdrmem_putlong_aligned,
xdrmem_getbytes,
xdrmem_putbytes,
xdrmem_getpos,
xdrmem_setpos,
- xdrmem_inline,
+ xdrmem_inline_aligned,
+ xdrmem_destroy
+};
+
+static struct xdr_ops xdrmem_ops_unaligned = {
+ xdrmem_getlong_unaligned,
+ xdrmem_putlong_unaligned,
+ xdrmem_getbytes,
+ xdrmem_putbytes,
+ xdrmem_getpos,
+ xdrmem_setpos,
+ xdrmem_inline_unaligned,
xdrmem_destroy
};
@@ -84,7 +99,8 @@ xdrmem_create(xdrs, addr, size, op)
{
xdrs->x_op = op;
- xdrs->x_ops = &xdrmem_ops;
+ xdrs->x_ops = ((size_t)addr & (sizeof(int32_t) - 1))
+ ? &xdrmem_ops_unaligned : &xdrmem_ops_aligned;
xdrs->x_private = xdrs->x_base = addr;
xdrs->x_handy = size;
}
@@ -93,30 +109,61 @@ static void
xdrmem_destroy(/*xdrs*/)
/*XDR *xdrs;*/
{
+
+}
+
+static bool_t
+xdrmem_getlong_aligned(xdrs, lp)
+ register XDR *xdrs;
+ long *lp;
+{
+
+ if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ return (FALSE);
+ *lp = ntohl(*(int32_t *)xdrs->x_private);
+ xdrs->x_private += sizeof(int32_t);
+ return (TRUE);
}
static bool_t
-xdrmem_getlong(xdrs, lp)
+xdrmem_putlong_aligned(xdrs, lp)
register XDR *xdrs;
long *lp;
{
if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
return (FALSE);
- *lp = (long)ntohl((u_int32_t)(*((int32_t *)(xdrs->x_private))));
+ *(int32_t *)xdrs->x_private = htonl(*lp);
xdrs->x_private += sizeof(int32_t);
return (TRUE);
}
static bool_t
-xdrmem_putlong(xdrs, lp)
+xdrmem_getlong_unaligned(xdrs, lp)
register XDR *xdrs;
long *lp;
{
+ int32_t l;
if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
return (FALSE);
- *(int32_t *)xdrs->x_private = (int32_t)htonl((int32_t)(*lp));
+ bcopy(xdrs->x_private, &l, sizeof(int32_t));
+ *lp = ntohl(l);
+ xdrs->x_private += sizeof(int32_t);
+ return (TRUE);
+}
+
+static bool_t
+xdrmem_putlong_unaligned(xdrs, lp)
+ register XDR *xdrs;
+ long *lp;
+{
+ int32_t l;
+
+ if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ return (FALSE);
+ l = htonl(*lp);
+ bcopy(&l, xdrs->x_private, sizeof(int32_t));
xdrs->x_private += sizeof(int32_t);
return (TRUE);
}
@@ -174,7 +221,7 @@ xdrmem_setpos(xdrs, pos)
}
static int32_t *
-xdrmem_inline(xdrs, len)
+xdrmem_inline_aligned(xdrs, len)
register XDR *xdrs;
int len;
{
@@ -182,8 +229,17 @@ xdrmem_inline(xdrs, len)
if (xdrs->x_handy >= len) {
xdrs->x_handy -= len;
- buf = (int32_t *) xdrs->x_private;
+ buf = (int32_t *)xdrs->x_private;
xdrs->x_private += len;
}
return (buf);
}
+
+static int32_t *
+xdrmem_inline_unaligned(xdrs, len)
+ register XDR *xdrs;
+ int len;
+{
+
+ return (0);
+}
diff --git a/lib/libc/string/bcmp.c b/lib/libc/string/bcmp.c
index c30d2cacf61..edd83c2686d 100644
--- a/lib/libc/string/bcmp.c
+++ b/lib/libc/string/bcmp.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bcmp.c,v 1.2 1996/03/09 02:42:54 niklas Exp $ */
+
/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
@@ -33,7 +35,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)bcmp.c 5.6 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: bcmp.c,v 1.1 1995/10/18 08:42:20 deraadt Exp $";
+static char *rcsid = "$Id: bcmp.c,v 1.2 1996/03/09 02:42:54 niklas Exp $";
#endif /* LIBC_SCCS and not lint */
#include <string.h>
@@ -41,6 +43,7 @@ static char *rcsid = "$Id: bcmp.c,v 1.1 1995/10/18 08:42:20 deraadt Exp $";
/*
* bcmp -- vax cmpc3 instruction
*/
+int
bcmp(b1, b2, length)
const void *b1, *b2;
register size_t length;
diff --git a/lib/libc/string/bm.c b/lib/libc/string/bm.c
index 0cfb2894a11..4bc5f178014 100644
--- a/lib/libc/string/bm.c
+++ b/lib/libc/string/bm.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bm.c,v 1.2 1996/03/09 02:42:55 niklas Exp $ */
+
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -34,10 +36,10 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-/* from: static char sccsid[] = "@(#)bm.c 8.7 (Berkeley) 6/21/94"; */
-static char *rcsid = "$Id: bm.c,v 1.1 1995/10/18 08:42:20 deraadt Exp $";
-#endif /* not lint */
+#if defined(LIBC_SCCS) && !defined(lint)
+/* from: static char sccsid[] = "@(#)bm.c 8.7 (Berkeley) 6/21/94"; */
+static char *rcsid = "$Id: bm.c,v 1.2 1996/03/09 02:42:55 niklas Exp $";
+#endif /* LIBC_SCCS && not lint */
#include <sys/types.h>
diff --git a/lib/libc/string/strcat.c b/lib/libc/string/strcat.c
index 6ca13f23219..10e0aefe124 100644
--- a/lib/libc/string/strcat.c
+++ b/lib/libc/string/strcat.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: strcat.c,v 1.2 1996/03/09 02:42:56 niklas Exp $ */
+
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -33,7 +35,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)strcat.c 5.6 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: strcat.c,v 1.1 1995/10/18 08:42:22 deraadt Exp $";
+static char *rcsid = "$Id: strcat.c,v 1.2 1996/03/09 02:42:56 niklas Exp $";
#endif /* LIBC_SCCS and not lint */
#include <string.h>
@@ -46,6 +48,6 @@ strcat(s, append)
char *save = s;
for (; *s; ++s);
- while (*s++ = *append++);
+ while ((*s++ = *append++) != '\0');
return(save);
}
diff --git a/lib/libc/string/strcpy.c b/lib/libc/string/strcpy.c
index 94e88b362a1..86956cdb957 100644
--- a/lib/libc/string/strcpy.c
+++ b/lib/libc/string/strcpy.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: strcpy.c,v 1.2 1996/03/09 02:42:57 niklas Exp $ */
+
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -33,7 +35,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)strcpy.c 5.7 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: strcpy.c,v 1.1 1995/10/18 08:42:22 deraadt Exp $";
+static char *rcsid = "$Id: strcpy.c,v 1.2 1996/03/09 02:42:57 niklas Exp $";
#endif /* LIBC_SCCS and not lint */
#include <string.h>
@@ -45,6 +47,6 @@ strcpy(to, from)
{
char *save = to;
- for (; *to = *from; ++from, ++to);
+ for (; (*to = *from) != '\0'; ++from, ++to);
return(save);
}
diff --git a/lib/libc/string/strftime.c b/lib/libc/string/strftime.c
index b696a60e558..0b69e10ac05 100644
--- a/lib/libc/string/strftime.c
+++ b/lib/libc/string/strftime.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: strftime.c,v 1.3 1996/03/09 02:42:58 niklas Exp $ */
+
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
@@ -33,7 +35,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)strftime.c 5.11 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: strftime.c,v 1.2 1995/12/30 08:16:41 deraadt Exp $";
+static char *rcsid = "$Id: strftime.c,v 1.3 1996/03/09 02:42:58 niklas Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/localedef.h>
@@ -272,7 +274,7 @@ _fmt(format, t)
return(gsize);
}
-static
+static int
_secs(t)
struct tm *t;
{
@@ -289,7 +291,7 @@ _secs(t)
return(_add(++p));
}
-static
+static int
_conv(n, digits, pad)
int n, digits;
char pad;
@@ -304,7 +306,7 @@ _conv(n, digits, pad)
return(_add(++p));
}
-static
+static int
_add(str)
register char *str;
{
diff --git a/lib/libc/sys/mount.2 b/lib/libc/sys/mount.2
index 4c00bff8434..068cbc87042 100644
--- a/lib/libc/sys/mount.2
+++ b/lib/libc/sys/mount.2
@@ -1,4 +1,5 @@
-.\" $NetBSD: mount.2,v 1.10 1995/11/28 06:41:53 jtc Exp $
+.\" $OpenBSD: mount.2,v 1.4 1996/03/09 02:42:59 niklas Exp $
+.\" $NetBSD: mount.2,v 1.11 1996/02/08 18:33:58 mycroft Exp $
.\"
.\" Copyright (c) 1980, 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -44,7 +45,7 @@
.Fd #include <sys/param.h>
.Fd #include <sys/mount.h>
.Ft int
-.Fn mount "char *type" "const char *dir" "int flags" "void *data"
+.Fn mount "const char *type" "const char *dir" "int flags" "void *data"
.Ft int
.Fn unmount "const char *dir" "int flags"
.Sh DESCRIPTION
diff --git a/lib/libc/yp/xdryp.c b/lib/libc/yp/xdryp.c
index 1145b1bb4fd..e8a8b06b568 100644
--- a/lib/libc/yp/xdryp.c
+++ b/lib/libc/yp/xdryp.c
@@ -1,4 +1,5 @@
-/* $NetBSD: xdryp.c,v 1.9 1995/07/14 21:04:17 christos Exp $ */
+/* $OpenBSD: xdryp.c,v 1.3 1996/03/09 02:43:00 niklas Exp $ */
+/* $NetBSD: xdryp.c,v 1.10 1996/02/04 23:26:21 jtc Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com>
@@ -31,8 +32,8 @@
* SUCH DAMAGE.
*/
-#ifndef LINT
-static char *rcsid = "$NetBSD: xdryp.c,v 1.9 1995/07/14 21:04:17 christos Exp $";
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid = "$NetBSD: xdryp.c,v 1.10 1996/02/04 23:26:21 jtc Exp $";
#endif
#include <sys/param.h>
diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c
index 855b6398d93..cca10d3cda9 100644
--- a/lib/libc/yp/yplib.c
+++ b/lib/libc/yp/yplib.c
@@ -1,4 +1,5 @@
-/* $NetBSD: yplib.c,v 1.16 1995/07/14 21:04:24 christos Exp $ */
+/* $OpenBSD: yplib.c,v 1.4 1996/03/09 02:43:01 niklas Exp $ */
+/* $NetBSD: yplib.c,v 1.17 1996/02/04 23:26:26 jtc Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com>
@@ -31,8 +32,8 @@
* SUCH DAMAGE.
*/
-#ifndef LINT
-static char rcsid[] = "$NetBSD: yplib.c,v 1.16 1995/07/14 21:04:24 christos Exp $";
+#if defined(LIBC_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: yplib.c,v 1.17 1996/02/04 23:26:26 jtc Exp $";
#endif
#include <sys/param.h>