swab.3.patch   [plain text]


--- swab.3.orig	2010-02-24 20:50:11.000000000 -0800
+++ swab.3	2010-02-24 21:17:49.000000000 -0800
@@ -28,7 +28,7 @@
 .\"     @(#)swab.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD: src/lib/libc/string/swab.3,v 1.10 2007/01/09 00:28:12 imp Exp $
 .\"
-.Dd December 10, 2004
+.Dd February 24, 2010
 .Dt SWAB 3
 .Os
 .Sh NAME
@@ -39,24 +39,41 @@
 .Sh SYNOPSIS
 .In unistd.h
 .Ft void
-.Fn swab "const void * restrict src" "void * restrict dst" "ssize_t len"
+.Fo swab
+.Fa "const void *restrict src"
+.Fa "void *restrict dest"
+.Fa "ssize_t nbytes"
+.Fc
 .Sh DESCRIPTION
 The function
 .Fn swab
 copies
-.Fa len
+.Fa nbytes
 bytes from the location referenced by
 .Fa src
 to the location referenced by
-.Fa dst ,
+.Fa dest ,
 swapping adjacent bytes.
 .Pp
 The argument
-.Fa len
-must be an even number.
+.Fa nbytes
+should be an even number.  If
+.Fa nbytes
+is odd,
+.Fn swab
+copies and exchanges
+.Fa nbytes
+-1 bytes and the disposition of the last byte is unspecified.
+If copying takes place between objects that overlap,
+the behavior is undefined. If
+.Fa nbytes
+is negative,
+.Fn swab
+does nothing.
 .Sh SEE ALSO
 .Xr bzero 3 ,
-.Xr memset 3
+.Xr memset 3 ,
+.Xr compat 5
 .Sh HISTORY
 A
 .Fn swab