2024-02-24 03:21:20 -07:00
|
|
|
.\" Copyright (c) 2024 DTB <trinity@trinity.moe>
|
2024-03-26 19:22:30 -06:00
|
|
|
.\" Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
2024-02-24 03:21:20 -07:00
|
|
|
.\"
|
|
|
|
.\" This work is licensed under CC BY-SA 4.0. To see a copy of this license,
|
|
|
|
.\" visit <http://creativecommons.org/licenses/by-sa/4.0/>.
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
|
|
|
.TH SWAB 1
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH NAME
|
|
|
|
swab \(en swap bytes
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH SYNOPSIS
|
2024-06-03 23:07:19 -06:00
|
|
|
|
2024-02-24 03:21:20 -07:00
|
|
|
swab
|
|
|
|
.RB ( -f )
|
|
|
|
.RB ( -w
|
|
|
|
.R [
|
|
|
|
.B word size
|
|
|
|
.R ])
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH USAGE
|
2024-06-03 23:07:19 -06:00
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
Swap the latter and former halves of a block of bytes.
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-03-26 19:22:30 -06:00
|
|
|
.SH OPTIONS
|
2024-06-03 23:07:19 -06:00
|
|
|
|
2024-06-02 18:47:14 -06:00
|
|
|
.IP -f
|
2024-03-26 19:22:30 -06:00
|
|
|
Ignore system call interruptions.
|
2024-06-02 18:47:14 -06:00
|
|
|
.IP -w
|
2024-03-26 19:22:30 -06:00
|
|
|
Configures the word size; that is, the size in bytes of the block size
|
|
|
|
on which to operate. By default the word size is 2. The word size must be
|
|
|
|
cleanly divisible by 2, otherwise the block of bytes being processed can't be
|
|
|
|
halved.
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH EXAMPLES
|
2024-06-03 23:07:19 -06:00
|
|
|
|
2024-02-24 03:21:20 -07:00
|
|
|
The following sh(1p) line:
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
.RS
|
2024-02-24 03:21:20 -07:00
|
|
|
.R printf 'hello world!\n' | swab
|
2024-03-26 19:22:30 -06:00
|
|
|
.RE
|
2024-02-24 03:21:20 -07:00
|
|
|
|
|
|
|
Produces the following output:
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
.RS
|
2024-02-24 03:21:20 -07:00
|
|
|
.R ehll oowlr!d
|
2024-03-26 19:22:30 -06:00
|
|
|
.RE
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH DIAGNOSTICS
|
2024-06-03 23:07:19 -06:00
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
In the event of an error, a debug message will be printed and the program will
|
|
|
|
exit with the appropriate sysexits.h(3) error code.
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH RATIONALE
|
2024-06-03 23:07:19 -06:00
|
|
|
|
2024-06-02 18:47:14 -06:00
|
|
|
This program was modeled and named after the conv=swab functionality specified
|
|
|
|
in the dd(1p) utility. It additionally allows the word size to be configured.
|
2024-03-26 19:22:30 -06:00
|
|
|
|
|
|
|
This functionality is useful for fixing the endianness of binary files produced
|
|
|
|
on other machines.
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH COPYRIGHT
|
2024-06-03 23:07:19 -06:00
|
|
|
|
2024-02-24 03:21:20 -07:00
|
|
|
Copyright (c) 2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
|
|
|
<https://gnu.org/licenses/agpl.html>.
|
2024-06-02 18:47:14 -06:00
|
|
|
.\"
|
2024-02-24 03:21:20 -07:00
|
|
|
.SH SEE ALSO
|
2024-06-02 18:47:14 -06:00
|
|
|
.BR dd (1p)
|