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