forked from bonsai/harakit
72 lines
1.4 KiB
Groff
72 lines
1.4 KiB
Groff
.\" Copyright (c) 2024 DTB <trinity@trinity.moe>
|
|
.\"
|
|
.\" 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/>.
|
|
|
|
.TH swab 1
|
|
|
|
.SH NAME
|
|
|
|
swab \(en swap bytes
|
|
|
|
.SH SYNOPSIS
|
|
|
|
swab
|
|
.RB ( -f )
|
|
.RB ( -w
|
|
.R [
|
|
.B word size
|
|
.R ])
|
|
|
|
.SH USAGE
|
|
|
|
Swab swaps the latter and former halves of a block of bytes.
|
|
|
|
.SH EXAMPLES
|
|
|
|
The following sh(1p) line:
|
|
|
|
.R printf 'hello world!\n' | swab
|
|
|
|
Produces the following output:
|
|
|
|
.R ehll oowlr!d
|
|
|
|
.SH OPTIONS
|
|
|
|
The
|
|
.B -f
|
|
option ignores system call interruptions.
|
|
.PP
|
|
The
|
|
.B -w
|
|
option 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.
|
|
|
|
.SH DIAGNOSTICS
|
|
|
|
If an error is encountered in input, output, or invocation, a diagnostic
|
|
message will be written to standard error and swab will exit with the
|
|
appropriate status from sysexits.h(3).
|
|
|
|
.SH RATIONALE
|
|
|
|
Swab was modeled after the
|
|
.R conv=swab
|
|
functionality specified in the POSIX dd utility but additionally allows the
|
|
word size to be configured.
|
|
.PP
|
|
Swab is useful for fixing the endianness of binary files produced on other
|
|
machines.
|
|
|
|
.SH COPYRIGHT
|
|
|
|
Copyright (c) 2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
|
<https://gnu.org/licenses/agpl.html>.
|
|
|
|
.SH SEE ALSO
|
|
|
|
dd(1p)
|