all: formatting; mm(1): fixes speed, simplicity; docs/dj.1: grammar, typos, etc.
This commit is contained in:
77
docs/dj.1
77
docs/dj.1
@@ -1,5 +1,5 @@
|
||||
.\" Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
.\" Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
.\" Copyright (c) 2024–2025 Emma Tebibyte <emma@tebibyte.media>
|
||||
.\"
|
||||
.\" 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/>.
|
||||
@@ -28,45 +28,44 @@ dj
|
||||
Perform precise read and write operations on files. This utility is useful for
|
||||
reading and writing binary data to and from disks.
|
||||
|
||||
This manual page uses the terms \(lqskip\(rq and \(lqseek\(rq to refer to moving
|
||||
to a specified byte by index in the input and output of the program
|
||||
This manual page uses the terms \(lqskip\(rq and \(lqseek\(rq to refer to
|
||||
moving to a specified byte by index in the input and output of the program
|
||||
respectively. This language is inherited from the
|
||||
.BR dd (1p)
|
||||
utility and used here to decrease ambiguity.
|
||||
specification in \*(Px and used here to decrease ambiguity.
|
||||
|
||||
The offset used when skipping or seeking refers to how many bytes are skipped
|
||||
or sought. Running
|
||||
.BR dj (1)
|
||||
with a skip offset of 1 skips one byte into the input and reads from the second
|
||||
byte onwards. A programmer may think of a file as a zero-indexed array of
|
||||
bytes; in this analogy, the offset given is the index of the byte at which to
|
||||
start reading or writing.
|
||||
with a skip offset of 1 reads from the second byte onwards. A programmer may
|
||||
think of a file as a zero-indexed array of bytes; in this analogy, the offset
|
||||
given is the index of the byte at which to start reading or writing.
|
||||
.\"
|
||||
.SH OPTIONS
|
||||
|
||||
.IP \fB-i\fP\ \fIfile\fP
|
||||
Takes a file path as an argument and opens it for use as an input.
|
||||
.IP \fB-b\fP\ \fIblock_size\fP
|
||||
Takes a numeric argument as the size in bytes of the input buffer, the default
|
||||
being 1024.
|
||||
.IP \fB-s\fP
|
||||
Takes a numeric argument as the size in bytes of the input buffer. If this
|
||||
option is not specified, the size is 1024 bytes.
|
||||
.IP \fB-s\fP \fIoffset\fP
|
||||
Takes a numeric argument as the index of the byte at which reading will
|
||||
commence; \(lqskips\(rq that number of bytes. If the standard input is used,
|
||||
bytes read to this point are discarded.
|
||||
.IP \fB-o\fP
|
||||
commence; the program \(lqskips\(rq that number of \fIbytes\fP. If the standard
|
||||
input is used, bytes read to this point are discarded.
|
||||
.IP \fB-o\fP \fIfile\fP
|
||||
Takes a file path as an argument and opens it for use as an output.
|
||||
.IP \fB-B\fP\ \fIblock_size\fP
|
||||
Takes a numeric argument as the size in bytes of the output buffer, the default
|
||||
being 1024. Note that this option only affects the size of output writes and not
|
||||
the amount of output data itself. See the CAVEATS section.
|
||||
.IP \fB-S\fP
|
||||
Takes a numeric argument as the size in bytes of the output buffer. The default
|
||||
size is 1024. Note that this option only affects the size of output writes and
|
||||
not the amount of output data itself. See the CAVEATS section.
|
||||
.IP \fB-S\fP \fIoffset\fP
|
||||
Takes a numeric argument as the index of the byte at which writing will
|
||||
commence; \(lqseeks\(rq that number of bytes. If the standard output is used,
|
||||
null characters are printed.
|
||||
commence; the program \(lqseeks\(rq that number of bytes. If the standard
|
||||
output is used, null characters are first printed this many times.
|
||||
.IP \fB-a\fP
|
||||
Accepts a single literal byte with which the input buffer is padded in the event
|
||||
of an incomplete read from the input file. If the option argument is empty, the
|
||||
null byte is used.
|
||||
Accepts a single literal byte with which the input buffer is padded in the
|
||||
event of an incomplete read from the input file. If the option argument is
|
||||
empty, the null byte is used.
|
||||
.IP \fB-c\fP
|
||||
Specifies a number of blocks to read. The default is 0, in which case the input
|
||||
is read until a partial or empty read is made.
|
||||
@@ -78,12 +77,12 @@ Retries failed reads once before exiting.
|
||||
.\"
|
||||
.SH STANDARD INPUT
|
||||
|
||||
The standard input shall be used as an input if no inputs are specified or if
|
||||
The standard input shall be used as an input if none are specified or if the
|
||||
input file is \(lq-\(rq.
|
||||
.\"
|
||||
.SH STANDARD OUTPUT
|
||||
The standard output shall be used as an output if no inputs are specified or if
|
||||
the output file is \(lq-\(rq.
|
||||
The standard output shall be used as an output if none are specified or if the
|
||||
output file is \(lq-\(rq.
|
||||
.\"
|
||||
.SH EXAMPLES
|
||||
|
||||
@@ -135,13 +134,12 @@ invocation.
|
||||
.\"
|
||||
.SH DIAGNOSTICS
|
||||
|
||||
On a partial or empty read, a diagnostic message is printed. Then, the program
|
||||
exits unless the
|
||||
On a partial or empty read, a diagnostic message is printed. Then, unless the
|
||||
.B -n
|
||||
option is specified.
|
||||
option is specified, the program exits.
|
||||
|
||||
By default, statistics are printed for input and output to the standard error in
|
||||
the following format:
|
||||
By default, statistics are printed for input and output to the standard error
|
||||
in the following format:
|
||||
|
||||
.RS
|
||||
{records read} {ASCII unit separator} {partial records read}
|
||||
@@ -172,8 +170,8 @@ If
|
||||
.B -n
|
||||
is specified along with the
|
||||
.B -c
|
||||
option and a count, actual byte output is the product of the count and the input
|
||||
block size and therefore may be lower than expected. If the
|
||||
option and a count, actual byte output is the product of the count and the
|
||||
input block size and therefore may be lower than expected. If the
|
||||
.B -a
|
||||
option is specified, this could make written data nonsensical.
|
||||
.\"
|
||||
@@ -202,12 +200,15 @@ The skipped or sought bytes while processing irregular files, such as streams,
|
||||
are reported in the diagnostic output, because they were actually read or
|
||||
written. This is as opposed to bytes skipped while processing regular files,
|
||||
which are not reported.
|
||||
|
||||
Much of this program shares its functionality with
|
||||
.BR mm (1).
|
||||
.\"
|
||||
.SH RATIONALE
|
||||
|
||||
This program was based on the
|
||||
.BR dd (1p)
|
||||
utility as specified in POSIX. While character conversion may have been the
|
||||
utility as specified in \*(Px. While character conversion may have been the
|
||||
original intent of
|
||||
.BR dd (1p),
|
||||
it is irrelevant to its modern use. Because of this, this program eschews
|
||||
@@ -215,12 +216,18 @@ character conversion and adds typical option formatting, allowing seeks to be
|
||||
specified in bytes rather than in blocks, allowing arbitrary bytes as padding,
|
||||
and printing in a format that\(cqs easy for machines to parse.
|
||||
.\"
|
||||
.SH AUTHOR
|
||||
|
||||
Written by DTB
|
||||
.MT trinity@trinity.moe
|
||||
.ME .
|
||||
.\"
|
||||
.SH COPYRIGHT
|
||||
|
||||
Copyright \(co 2023 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
||||
<https://gnu.org/licenses/agpl.html>.
|
||||
.\"
|
||||
.SH SEE ALSO
|
||||
.BR mm (1)
|
||||
.BR dd (1p)
|
||||
.BR lseek (3p)
|
||||
.BR mm (1)
|
||||
|
||||
@@ -61,8 +61,8 @@ error code.
|
||||
|
||||
The
|
||||
.BR test (1p)
|
||||
utility contains functionality that was broken out into separate programs. Thus,
|
||||
the scope of this program is narrower than it. Notably, the
|
||||
utility contains functionality that was broken out into separate programs. \
|
||||
Thus, the scope of this program is narrower than it. Notably, the
|
||||
.B -h
|
||||
option is now invalid and therefore shows usage information instead of being an
|
||||
alias to the modern
|
||||
|
||||
@@ -28,13 +28,14 @@ is an ASCII record separator.
|
||||
.\"
|
||||
.SH CAVEATS
|
||||
|
||||
Field indices are zero-indexed, which may be unexpected behavior for some users.
|
||||
Field indices are zero-indexed, which may be unexpected behavior for some
|
||||
users.
|
||||
.\"
|
||||
.SH RATIONALE
|
||||
|
||||
With the assumption that tools will output data separated with ASCII field
|
||||
separators, there is a need for the ability to modify select fields in this data
|
||||
easily and quickly.
|
||||
separators, there is a need for the ability to modify select fields in this
|
||||
data easily and quickly.
|
||||
|
||||
The idea for this utility originated in the fact that the GNU
|
||||
.BR ls (1)
|
||||
|
||||
13
docs/hru.1
13
docs/hru.1
@@ -16,8 +16,8 @@ hru
|
||||
Convert counts to higher units.
|
||||
|
||||
Byte counts will be read in the form of whole numbers from the standard input
|
||||
and be written to the standard output the same number converted to a higher unit
|
||||
of data as defined by the \fIInternational System of Units\fP.
|
||||
and be written to the standard output the same number converted to a higher
|
||||
unit of data as defined by the \fIInternational System of Units\fP.
|
||||
|
||||
The program will convert the byte count to the highest unit possible where the
|
||||
value is greater than one.
|
||||
@@ -33,10 +33,11 @@ and print an error message.
|
||||
|
||||
The GNU project\(cqs
|
||||
.BR ls (1)
|
||||
implementation contains a human-readable option (\fB-h\fP) that, when specified,
|
||||
makes the tool print size information in a format more immediately
|
||||
readable. This functionality is useful not only in this context, so the decision
|
||||
was made to split it into a new tool. The original functionality from GNU\(cqs
|
||||
implementation contains a human-readable option (\fB-h\fP) that, when
|
||||
specified, makes the tool print size information in a format more immediately
|
||||
readable. This functionality is useful not only in this context, so the
|
||||
decision was made to split it into a new tool. The original functionality from
|
||||
GNU\(cqs
|
||||
.BR ls (1)
|
||||
can be emulated with
|
||||
.BR fop (1)
|
||||
|
||||
@@ -31,9 +31,10 @@ It may help to think of the
|
||||
.BR -g ,
|
||||
and
|
||||
.B -l
|
||||
options as equivalent to the infix algebraic \(lq=\(rq, \(lq>\(rq, and \(lq<\(rq
|
||||
operators respectively, with each option putting its symbol between every given
|
||||
integer. The following example is equivalent to evaluating \(lq1 < 2 < 3\(rq:
|
||||
options as equivalent to the infix algebraic \(lq=\(rq, \(lq>\(rq, and
|
||||
\(lq<\(rq operators respectively, with each option putting its symbol between
|
||||
every given integer. The following example is equivalent to evaluating
|
||||
\(lq1 < 2 < 3\(rq:
|
||||
\"
|
||||
.RS
|
||||
intcmp -l 1 2 3
|
||||
|
||||
33
docs/mm.1
33
docs/mm.1
@@ -1,4 +1,5 @@
|
||||
.\" Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
.\" Copyright (c) 2024–2025 Emma Tebibyte <emma@tebibyte.media>
|
||||
.\"
|
||||
.\" 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/>.
|
||||
@@ -10,7 +11,7 @@ mm \(en middleman
|
||||
.SH SYNOPSIS
|
||||
|
||||
mm
|
||||
.RB [ -aetu ]
|
||||
.RB [ -aet ]
|
||||
.RB [ -i\ input ]
|
||||
.RB [ -o\ output ]
|
||||
.\"
|
||||
@@ -26,16 +27,14 @@ Opens outputs for appending rather than updating.
|
||||
Use the standard error as an output.
|
||||
.IP \fB-t\fP
|
||||
Causes outputs to be overwritten instead of being truncated.
|
||||
.IP \fB-u\fP
|
||||
Ensures neither input or output will be buffered.
|
||||
.IP \fB-i\fP\ \fIinput\fP
|
||||
Opens a path as an input. If one or more of the input files is \(lq-\(rq or if
|
||||
no inputs are specified, the standard input shall be used. If specified as the
|
||||
last option and if there are trailing arguments to the program, they shall be
|
||||
appended to the list of files to use as inputs.
|
||||
.IP \fB-o\fP\ \fIoutput\fP
|
||||
Opens a path as an output. If one or more of the output files is \(lq-\(rq or if
|
||||
no outputs are specified and the
|
||||
Opens a path as an output. If one or more of the output files is \(lq-\(rq or
|
||||
if no outputs are specified and the
|
||||
.B -e
|
||||
option is not specified, the standard output shall be used. If specified as the
|
||||
last option and if there are trailing arguments to the program, they shall be
|
||||
@@ -43,7 +42,7 @@ appended to the list of files to use as outputs.
|
||||
.\"
|
||||
.SH DIAGNOSTICS
|
||||
|
||||
If an output cannot be written to, an error occurs; however, exiting will be
|
||||
If an output cannot be written to, an error occurs; however, exiting will be
|
||||
deferred until writing to any other specified outputs completes.
|
||||
|
||||
When an error is encountered, a diagnostic message is printed and the program
|
||||
@@ -57,10 +56,30 @@ The
|
||||
.BR cat (1p)
|
||||
and
|
||||
.BR tee (1p)
|
||||
programs specified in POSIX together provide similar functionality. The
|
||||
programs specified in \*(Px together provide similar functionality. The
|
||||
separation of the two sets of functionality into separate APIs seemed
|
||||
unncessary.
|
||||
.\"
|
||||
.SH HISTORY
|
||||
|
||||
This utility originally had a \fB-u\fP option for compatibility with cat(1p),
|
||||
but this option is almost always default behavior in practice; therefore, it
|
||||
was dropped both for simplicity and to expand the
|
||||
.BR dj (1)
|
||||
utility\(cqs niche.
|
||||
.\"
|
||||
.SH AUTHOR
|
||||
|
||||
Written by DTB
|
||||
.MT trinity@trinity.moe
|
||||
.ME .
|
||||
.\"
|
||||
.SH COPYRIGHT
|
||||
|
||||
Copyright © 2023 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
||||
<https://gnu.org/licenses/agpl.html>.
|
||||
.\"
|
||||
.\"
|
||||
.SH COPYRIGHT
|
||||
|
||||
Copyright \(co 2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
||||
|
||||
@@ -52,8 +52,8 @@ the
|
||||
.B -v
|
||||
option, is the bandage solution GNU and other software suites use.
|
||||
|
||||
This functionality is included in a separate tool because its usefulness extends
|
||||
beyond that of
|
||||
This functionality is included in a separate tool because its usefulness
|
||||
extends beyond that of
|
||||
.BR cat (1p).
|
||||
.\"
|
||||
.SH AUTHOR
|
||||
|
||||
14
docs/peek.1
14
docs/peek.1
@@ -47,9 +47,9 @@ installed.
|
||||
.\"
|
||||
.SH CAVEATS
|
||||
|
||||
This program does nothing to prevent others from seeing the key presses input to
|
||||
a keyboard. It also does not protect against the sound of typing being analyzed
|
||||
to determine what was input without needing to see screen or keyboard.
|
||||
This program does nothing to prevent others from seeing the key presses input
|
||||
to a keyboard. It also does not protect against the sound of typing being
|
||||
analyzed to determine what was input without needing to see screen or keyboard.
|
||||
|
||||
Accepting secrets in shell scripts is probably not advisable.
|
||||
|
||||
@@ -80,10 +80,10 @@ $ peek | head -n 1 | xargs printf '%s' | htpasswd -nBi _ | cut -d : -f 2
|
||||
|
||||
This is an
|
||||
.BR sh (1p)
|
||||
command line that allows a user to write blindly into a text file but displaying
|
||||
only written lines. Some writers have the habit of prematurely revising their
|
||||
work and use tools with functionality similar to this to prevent it.
|
||||
It uses
|
||||
command line that allows a user to write blindly into a text file but
|
||||
displaying only written lines. Some writers have the habit of prematurely
|
||||
revising their work and use tools with functionality similar to this to prevent
|
||||
it. It uses
|
||||
.BR mm (1)
|
||||
to pipe the output of the program to both the standard error and the regular
|
||||
file writing.txt:
|
||||
|
||||
14
docs/rpn.1
14
docs/rpn.1
@@ -50,17 +50,17 @@ with the
|
||||
.I IEEE Standard for Floating Point Arithmetic
|
||||
(\fIIEEE 754\fP), floating-point arithmetic has rounding errors. This is
|
||||
somewhat curbed by using the machine epsilon as provided by the Rust standard
|
||||
library to which numbers are rounded. Because of this, variation is expected in
|
||||
the number of decimal places the program can handle based on the platform and
|
||||
hardware of any given machine.
|
||||
library, to which numbers are rounded. Because of this, variation is expected
|
||||
in the number of decimal places the program can handle based on the platform
|
||||
and hardware of any given machine.
|
||||
.\"
|
||||
.SH RATIONALE
|
||||
|
||||
An infix notation calculation utility,
|
||||
.BR bc (1p),
|
||||
is included in the POSIX standard, but does not accept expressions as arguments;
|
||||
in scripts, any predefined, non-interactive input must be piped into the
|
||||
program. A
|
||||
is included in the \*(Px standard, but does not accept expressions as
|
||||
arguments; in scripts, any predefined, non-interactive input must be piped into
|
||||
the program. A
|
||||
.BR dc (1)
|
||||
pre-dates the standardized
|
||||
.BR bc (1p),
|
||||
@@ -76,7 +76,7 @@ Written by Emma Tebibyte
|
||||
.\"
|
||||
.SH COPYRIGHT
|
||||
|
||||
Copyright (c) 2024 Emma Tebibyte. License AGPLv3+: GNU AGPL version 3 or later
|
||||
Copyright \(co 2024 Emma Tebibyte. License AGPLv3+: GNU AGPL version 3 or later
|
||||
<https://gnu.org/licenses/agpl.html>.
|
||||
.\"
|
||||
.SH SEE ALSO
|
||||
|
||||
11
docs/str.1
11
docs/str.1
@@ -17,14 +17,15 @@ str
|
||||
|
||||
Test the character types of string arguments.
|
||||
|
||||
The tests in this program are equivalent to the functions with the same names in
|
||||
The tests in this program are equivalent to the functions with the same names
|
||||
in
|
||||
.BR ctype.h (0p)
|
||||
and are the methods by which string arguments are tested.
|
||||
.\"
|
||||
.SH DIAGNOSTICS
|
||||
|
||||
If all tests pass, the program will exit successfully. If any of the tests fail,
|
||||
the program will exit unsuccessfully with an error code of 1.
|
||||
If all tests pass, the program will exit successfully. If any of the tests
|
||||
fail, the program will exit unsuccessfully with an error code of 1.
|
||||
|
||||
When invoked incorrectly, a debug message will be printed and the program will
|
||||
exit with the appropriate
|
||||
@@ -33,8 +34,8 @@ error code.
|
||||
.\"
|
||||
.SH CAVEATS
|
||||
|
||||
None of an empty string\(cqs contents pass any of the tests, so the program will
|
||||
exit unsuccessfully if one is specified.
|
||||
None of an empty string\(cqs contents pass any of the tests, so the program
|
||||
will exit unsuccessfully if one is specified.
|
||||
|
||||
There\(cqs no way of knowing which argument failed the test without re-testing
|
||||
arguments individually.
|
||||
|
||||
@@ -50,8 +50,8 @@ visual similarity and not byte similarity.
|
||||
The traditional tool for string comparisons in POSIX and other Unix shells has
|
||||
been
|
||||
.BR test (1).
|
||||
This tool also handles integer comparisons and file scrutiny. These parts of its
|
||||
functionality have been broken out into multiple utilities.
|
||||
This tool also handles integer comparisons and file scrutiny. These parts of
|
||||
its functionality have been broken out into multiple utilities.
|
||||
|
||||
This program\(cqs functionality may be performed on a POSIX-compliant system
|
||||
with
|
||||
|
||||
Reference in New Issue
Block a user