Replace str(1) with stris(1) #102
148
docs/stris.1
148
docs/stris.1
@ -1,118 +1,104 @@
|
|||||||
.\" Copyright (c) 2023–2024 DTB <trinity@trinity.moe>
|
.\" Copyright (c) 2023–2024 DTB <trinity@trinity.moe>
|
||||||
.\" Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
|
.\" Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
||||||
.\"
|
.\"
|
||||||
.\" This work is licensed under CC BY-SA 4.0. To see a copy of this license,
|
.\" 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/>.
|
.\" visit <http://creativecommons.org/licenses/by-sa/4.0/>.
|
||||||
|
.\"
|
||||||
.TH STRIS 1
|
.TH STRIS 1 2024-10-22 "Harakit X.X.X"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
|
|
||||||
stris \(en test the character types of string arguments
|
stris \(en test the character types of string arguments
|
||||||
|
.\"
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
||||||
stris
|
stris
|
||||||
.RB ( -7bcdlu )
|
.RB [ -7bcdlu ]
|
||||||
.RB ( -i [ inclusions ])
|
.RB [ -i\ inclusions ]
|
||||||
.RB [ strings... ]
|
.RB strings...
|
||||||
|
.\"
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|
||||||
Stris tests each rune in an arbitrary quantity of string arguments, ensuring
|
Test each character in any number of string arguments, ensuring each meets any
|
||||||
each meets any of the parameters specified in the program options.
|
of the parameters specified by program options.
|
||||||
|
.\"
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
|
||||||
.B -7
|
.IP \fB-7\fP
|
||||||
.RS
|
Tests if the character encoding is ASCII.
|
||||||
Tests to see if runes are fit within seven bits; that is, that they are encoded
|
.IP \fB-b\fP
|
||||||
with ASCII.
|
Tests if characters are whitespace.
|
||||||
.RE
|
.IP \fB-c\fP
|
||||||
|
Tests if characters are control characters.
|
||||||
.B -b
|
.IP \fB-d\fP
|
||||||
.RS
|
Tests if characters are numeric.
|
||||||
Tests to see if runes are blank or "whitespace"; characters that do not print
|
.IP \fB-i\fP \fIinclusions...\fP
|
||||||
but fill a predictable amount of space.
|
In addition to specified options, also permits characters in
|
||||||
.RE
|
.IR inclusions .
|
||||||
|
.IP \fB-l\fP
|
||||||
.B -c
|
Tests if characters are in lower case.
|
||||||
.RS
|
.IP \fB-u\fP
|
||||||
Tests to see if runes are control characters; characters that are not printing
|
Tests if characters are in upper case.
|
||||||
or graphical.
|
.\"
|
||||||
.RE
|
|
||||||
|
|
||||||
.B -d
|
|
||||||
.RS
|
|
||||||
Tests to see if runes are numeric. This test does not only allow the ASCII
|
|
||||||
digits but any numeric symbol.
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.B -i
|
|
||||||
.RS
|
|
||||||
Permits, in addition to the given specified parameters, all of the runes
|
|
||||||
supplied in its option argument.
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.B -l
|
|
||||||
.RS
|
|
||||||
Tests to see if runes are in their lower case.
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.B -u
|
|
||||||
.RS
|
|
||||||
Tests to see if runes are in their upper case, or capitalized.
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.SH DIAGNOSTICS
|
.SH DIAGNOSTICS
|
||||||
|
|
||||||
Stris exits successfully if all runes in all given strings meet any of the
|
If no test cases pass for a character in
|
||||||
specified parameters, or if no parameters were specified but all given strings
|
.IR strings ,
|
||||||
were legibly encoded. It exits unsuccessfully if the previous is untrue, and if
|
the program will exit unsuccessfully.
|
||||||
invalid options were given, or if no strings were given, a usage synopsis will
|
|
||||||
be printed to the standard error.
|
|
||||||
|
|
||||||
.SH BUGS
|
.SH CAVEATS
|
||||||
|
|
||||||
There's no way of knowing which argument failed the test without re-testing
|
If no options are specified, the program will exit successfully as long as the
|
||||||
arguments individually.
|
input
|
||||||
|
.I strings
|
||||||
|
are legibly encoded.
|
||||||
|
|
||||||
Some runes that can losslessly be encoded into ASCII from UTF-8 but in an
|
Neither which test failed nor which of the
|
||||||
"overlong encoding", where the rune was encoded with unnecessary leading
|
.I strings
|
||||||
zeroes causing it to span multiple bytes, won't be detected as ASCII.
|
failed a test cannot be known without further invocations of the program.
|
||||||
|
|
||||||
|
Characters that can be encoded losslessly into ASCII from UTF-8 but which
|
||||||
|
are in an \(lqoverlong encoding\(rq, where the character was encoded with
|
||||||
|
unnecessary leading zeroes causing it to span multiple bytes, won\(cqt be
|
||||||
|
detected as ASCII.
|
||||||
|
.\"
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
|
|
||||||
This is an sh(1p) snippet that checks to see if an environment variable is an
|
This is an
|
||||||
ASCII digit.
|
.BR sh (1p)
|
||||||
|
snippet which tests if an environment variable is an ASCII digit.
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.R stris -7 "$v" && stris -d "$v" && echo ASCII digit.
|
stris -7 "$v" && stris -d "$v" && echo ASCII digit.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
This is an sh(1p) snippet that checks to see if an environment variable is a
|
This is an
|
||||||
hexadecimal number.
|
.BR sh (1p)
|
||||||
|
snippet that tests if an environment variable is a hexadecimal number.
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.R stris -7 "$v" && stris -di ABCDEFabcdef "$v" && echo Hexadecimal number.
|
stris -7 "$v" && stris -di ABCDEFabcdef "$v" && echo Hexadecimal number.
|
||||||
.RE
|
.RE
|
||||||
|
.\"
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
|
|
||||||
Written by DTB <trinity@trinity.moe>.
|
Written by DTB
|
||||||
|
.MT trinity@trinity.moe
|
||||||
|
.ME .
|
||||||
|
.\"
|
||||||
.SH HISTORY
|
.SH HISTORY
|
||||||
|
|
||||||
Stris replaces the former str(1) which took the name of a function from
|
This program replaces the former str(1) which took the name of a function from
|
||||||
ctype(3) as its first argument and checked the following strings against it;
|
.BR ctype (3p)
|
||||||
str(1) exited unsuccessfully when it encountered any non-ASCII runes and could
|
as its first argument and checked the following strings against it;
|
||||||
|
.BR str (1)
|
||||||
|
exited unsuccessfully when it encountered any non-ASCII characters and could
|
||||||
only have one parameter specified.
|
only have one parameter specified.
|
||||||
|
.\"
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
|
|
||||||
Copyright © 2023–2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
Copyright \(co 2023\(en2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
||||||
<https://gnu.org/licenses/gpl.html>.
|
<https://gnu.org/licenses/gpl.html>.
|
||||||
|
.\"
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
.BR ascii (7),
|
||||||
ascii(7), ctype(3p), strcmp(1)
|
.BR ctype (3p),
|
||||||
|
.BR strcmp (1)
|
||||||
|
Loading…
Reference in New Issue
Block a user