summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorniklas <niklas@openbsd.org>1996-11-25 13:11:12 +0000
committerniklas <niklas@openbsd.org>1996-11-25 13:11:12 +0000
commitd04f3685899cf5bd08efb0b577e54322f58dcbe3 (patch)
tree16fd88ae3f234fb336aa6aae3e2fc86afe05cfa1 /lib
parentipx sysctl. (diff)
downloadwireguard-openbsd-d04f3685899cf5bd08efb0b577e54322f58dcbe3.tar.xz
wireguard-openbsd-d04f3685899cf5bd08efb0b577e54322f58dcbe3.zip
htons et al. works on explicit 16- and 32-bit quantities and not the
machine dependent "short" and "long" integer. Correct and enhance manpage. Change all short and longs to u_int16_t and u_int32_t, respectively. OpenBSD RCSIds
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/byteorder.326
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/libc/net/byteorder.3 b/lib/libc/net/byteorder.3
index 723690cb16b..b880869b055 100644
--- a/lib/libc/net/byteorder.3
+++ b/lib/libc/net/byteorder.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: byteorder.3,v 1.2 1996/08/19 08:28:34 tholo Exp $
+.\" $OpenBSD: byteorder.3,v 1.3 1996/11/25 13:11:12 niklas Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -41,18 +41,22 @@
.Nm ntohs
.Nd convert values between host and network byte order
.Sh SYNOPSIS
-.Fd #include <sys/param.h>
-.Ft u_long
-.Fn htonl "u_long hostlong"
-.Ft u_short
-.Fn htons "u_short hostshort"
-.Ft u_long
-.Fn ntohl "u_long netlong"
-.Ft u_short
-.Fn ntohs "u_short netshort"
+.Fd #include <sys/types.h>
+.Fd #include <machine/endian.h>
+.Ft u_int32_t
+.Fn htonl "u_int32_t host32"
+.Ft u_int16_t
+.Fn htons "u_int16_t host16"
+.Ft u_int32_t
+.Fn ntohl "u_int32_t net32"
+.Ft u_int16_t
+.Fn ntohs "u_int16_t net16"
.Sh DESCRIPTION
These routines convert 16 and 32 bit quantities between network
-byte order and host byte order.
+byte order and host byte order. The last letter (s/l) is a mnemonic
+for the traditional names for such quantities, short and long,
+respectively. Today, the C concept of "short"/"long" integers
+need not coincide with this traditional misunderstanding.
On machines which have a byte order which is the same as the network
order, routines are defined as null macros.
.Pp