harakit/docs/swab.1

76 lines
1.6 KiB
Groff
Raw Permalink Normal View History

2024-02-24 03:21:20 -07:00
.\" Copyright (c) 2024 DTB <trinity@trinity.moe>
.\" 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/>.
.\"
.TH SWAB 1 2024-06-17 "Harakit X.X.X"
2024-02-24 03:21:20 -07:00
.SH NAME
swab \(en swap bytes
.\"
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 [ -w\ word_size ]
.\"
2024-06-04 16:11:33 -06:00
.SH DESCRIPTION
2024-06-03 23:07:19 -06:00
Swap the latter and former halves of a block of bytes.
.\"
.SH OPTIONS
2024-06-03 23:07:19 -06:00
.IP \fB-w\fP\ \fIword_size\fP
Configures the word size; that is, the size in bytes of the block size on which
to operate. The default word size is 2. The word size must be cleanly divisible
by 2, otherwise the block of bytes being processed can\(cqt be halved.
.\"
2024-02-24 03:21:20 -07:00
.SH EXAMPLES
2024-06-03 23:07:19 -06:00
2024-06-03 23:47:14 -06:00
The following
2024-06-05 22:35:50 -06:00
.BR sh (1p)
2024-06-03 23:47:14 -06:00
line:
2024-02-24 03:21:20 -07:00
.RS
printf 'hello world!\(rsn' | swab
.RE
.\" If you change this, make sure to change it in tests/bonsai/swab.mk too.
2024-02-24 03:21:20 -07:00
Produces the following output:
.RS
ehll oowlr!d
.RE
.\"
2024-02-24 03:21:20 -07:00
.SH DIAGNOSTICS
2024-06-03 23:07:19 -06:00
In the event of an error, a debug message will be printed and the program will
2024-06-03 23:47:14 -06:00
exit with the appropriate
.BR sysexits.h (3)
error code.
.\"
2024-02-24 03:21:20 -07:00
.SH RATIONALE
2024-06-03 23:07:19 -06:00
2024-06-17 23:20:29 -06:00
This program was modeled and named after the
.B conv=swab
functionality specified
2024-06-03 23:47:14 -06:00
in the
.BR dd (1p)
utility. It additionally allows the word size to be configured.
This functionality is useful for fixing the endianness of binary files produced
on other machines.
.\"
2024-06-17 23:20:29 -06:00
.SH AUTHOR
Written by DTB
.MT trinity@trinity.moe
.ME .
.\"
2024-02-24 03:21:20 -07:00
.SH COPYRIGHT
2024-06-03 23:07:19 -06:00
2024-06-04 16:11:33 -06:00
Copyright \(co 2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
2024-02-24 03:21:20 -07:00
<https://gnu.org/licenses/agpl.html>.
.\"
2024-02-24 03:21:20 -07:00
.SH SEE ALSO
.BR dd (1p)