2024-02-01 20:42:15 -07:00
|
|
|
|
.\" Copyright (c) 2023–2024 DTB <trinity@trinity.moe>
|
2024-03-26 18:26:51 -06:00
|
|
|
|
.\" Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
2023-12-24 17:13:17 -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/>.
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.\"
|
2024-06-19 15:03:06 -06:00
|
|
|
|
.TH STRCMP 1 2024-06-17 "Bonsai Core Utilites 0.13.9"
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.SH NAME
|
|
|
|
|
strcmp \(en compare strings
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.\"
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.SH SYNOPSIS
|
2024-06-03 23:07:19 -06:00
|
|
|
|
|
2023-12-24 17:13:17 -07:00
|
|
|
|
strcmp
|
|
|
|
|
.RM [ string ]
|
|
|
|
|
.RB [ strings... ]
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.\"
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.SH DESCRIPTION
|
2024-06-03 23:07:19 -06:00
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
Check whether string arguments are the same.
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.\"
|
2024-03-26 19:22:30 -06:00
|
|
|
|
.SH DIAGNOSTICS
|
2024-06-03 23:07:19 -06:00
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
The program will exit successfully if the strings are identical. Otherwise, it
|
2024-06-04 16:11:33 -06:00
|
|
|
|
will exit with an error code of 1 if a string passed has a lesser byte value
|
|
|
|
|
than one of the prior strings:
|
|
|
|
|
|
|
|
|
|
.RS
|
2024-06-06 00:14:55 -06:00
|
|
|
|
strcmp b a
|
2024-06-04 16:11:33 -06:00
|
|
|
|
.RE
|
|
|
|
|
|
2024-06-17 23:21:44 -06:00
|
|
|
|
or with an error code of 255 if it has a greater byte value than one of the
|
2024-06-04 16:11:33 -06:00
|
|
|
|
prior strings:
|
|
|
|
|
|
|
|
|
|
.RS
|
2024-06-06 00:14:55 -06:00
|
|
|
|
strcmp a b
|
2024-06-04 16:11:33 -06:00
|
|
|
|
.RE
|
2023-12-24 17:13:17 -07:00
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
When invoked incorrectly, a debug message will be printed and the program will
|
2024-06-02 18:47:14 -06:00
|
|
|
|
exit with the appropriate
|
|
|
|
|
.BR sysexits.h (3)
|
|
|
|
|
error code.
|
|
|
|
|
.\"
|
|
|
|
|
.SH CAVEATS
|
2024-06-03 23:07:19 -06:00
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
The program will exit unsuccessfully if the given strings are not identical;
|
2024-03-26 23:50:16 -06:00
|
|
|
|
therefore, Unicode strings may need to be normalized if the intent is to check
|
2024-03-26 19:22:30 -06:00
|
|
|
|
visual similarity and not byte similarity.
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.\"
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.SH RATIONALE
|
2024-06-03 23:07:19 -06:00
|
|
|
|
|
2023-12-24 17:13:17 -07:00
|
|
|
|
The traditional tool for string comparisons in POSIX and other Unix shells has
|
2024-06-02 18:47:14 -06:00
|
|
|
|
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.
|
2023-12-24 17:13:17 -07:00
|
|
|
|
|
2024-06-17 23:21:44 -06:00
|
|
|
|
This program\(cqs functionality may be performed on a POSIX-compliant system
|
|
|
|
|
with
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.BR test (1p).
|
|
|
|
|
.\"
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.SH AUTHOR
|
2024-06-03 23:07:19 -06:00
|
|
|
|
|
2024-06-02 18:47:14 -06:00
|
|
|
|
Written by DTB
|
|
|
|
|
.MT trinity@trinity.moe
|
|
|
|
|
.ME .
|
|
|
|
|
.\"
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.SH COPYRIGHT
|
2024-06-03 23:07:19 -06:00
|
|
|
|
|
2024-06-04 16:11:33 -06:00
|
|
|
|
Copyright \(co 2023 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
2023-12-24 17:13:17 -07:00
|
|
|
|
<https://gnu.org/licenses/gpl.html>.
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.\"
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.SH SEE ALSO
|
2024-06-02 18:47:14 -06:00
|
|
|
|
.BR strcmp (3),
|
|
|
|
|
.BR intcmp (1),
|
|
|
|
|
.BR scrut (1),
|
|
|
|
|
.BR test (1p)
|