Debian Codegraph @

upstream/debian-trixie/man3/swab.3

raw
1 '\" t
2 .\" Copyright 1993 David Metcalfe ([email protected])
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" 386BSD man pages
10 .\" Modified Sat Jul 24 17:52:15 1993 by Rik Faith ([email protected])
11 .\" Modified 2001-12-15, aeb
12 .TH swab 3 2024-05-02 "Linux man-pages 6.9.1"
13 .SH NAME
14 swab \- swap adjacent bytes
15 .SH LIBRARY
16 Standard C library
17 .RI ( libc ", " \-lc )
18 .SH SYNOPSIS
19 .nf
20 .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
21 .B #include <unistd.h>
22 .P
23 .BI "void swab(const void " from "[restrict ." n "], void " to "[restrict ." n ],
24 .BI " ssize_t " n );
25 .fi
26 .SH DESCRIPTION
27 The
28 .BR swab ()
29 function copies
30 .I n
31 bytes from the array pointed
32 to by
33 .I from
34 to the array pointed to by
35 .IR to ,
36 exchanging
37 adjacent even and odd bytes.
38 This function is used to exchange data
39 between machines that have different low/high byte ordering.
40 .P
41 This function does nothing when
42 .I n
43 is negative.
44 When
45 .I n
46 is positive and odd, it handles
47 .I n\-1
48 bytes
49 as above, and does something unspecified with the last byte.
50 (In other words,
51 .I n
52 should be even.)
53 .SH RETURN VALUE
54 The
55 .BR swab ()
56 function returns no value.
57 .SH ATTRIBUTES
58 For an explanation of the terms used in this section, see
59 .BR attributes (7).
60 .TS
61 allbox;
62 lbx lb lb
63 l l l.
64 Interface Attribute Value
65 T{
66 .na
67 .nh
68 .BR swab ()
69 T} Thread safety MT-Safe
70 .TE
71 .SH STANDARDS
72 POSIX.1-2008.
73 .SH HISTORY
74 POSIX.1-2001, SVr4, 4.3BSD.
75 .SH SEE ALSO
76 .BR bstring (3)