.\" Copyright (c) 2023–2024 DTB .\" Copyright (c) 2023–2024 Emma Tebibyte .\" .\" This work is licensed under CC BY-SA 4.0. To see a copy of this license, .\" visit . .\" .TH STRIS 1 2024-10-22 "Harakit X.X.X" .SH NAME stris \(en test the character types of string arguments .\" .SH SYNOPSIS stris .RB [ -7bcdlu ] .RB [ -i\ inclusions ] .RB strings... .\" .SH DESCRIPTION Test each character in any number of string arguments, ensuring each meets any of the parameters specified by program options. .\" .SH OPTIONS .IP \fB-7\fP Tests if the character encoding is ASCII. .IP \fB-b\fP Tests if characters are whitespace. .IP \fB-c\fP Tests if characters are control characters. .IP \fB-d\fP Tests if characters are numeric. .IP \fB-i\fP \fIinclusions...\fP In addition to specified options, also permits characters in .IR inclusions . .IP \fB-l\fP Tests if characters are in lower case. .IP \fB-u\fP Tests if characters are in upper case. .\" .SH DIAGNOSTICS If no test cases pass for a character in .IR strings , the program will exit unsuccessfully. .SH CAVEATS If no options are specified, the program will exit successfully as long as the input .I strings are legibly encoded. Neither which test failed nor which of the .I strings 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 This is an .BR sh (1p) snippet which tests if an environment variable is an ASCII digit. .RS stris -7 "$v" && stris -d "$v" && echo ASCII digit. .RE This is an .BR sh (1p) snippet that tests if an environment variable is a hexadecimal number. .RS stris -7 "$v" && stris -di ABCDEFabcdef "$v" && echo Hexadecimal number. .RE .\" .SH AUTHOR Written by DTB .MT trinity@trinity.moe .ME . .\" .SH HISTORY This program replaces the former str(1) which took the name of a function from .BR ctype (3p) 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. .\" .SH COPYRIGHT Copyright \(co 2023\(en2024 DTB. License AGPLv3+: GNU AGPL version 3 or later . .\" .SH SEE ALSO .BR ascii (7), .BR ctype (3p), .BR strcmp (1)