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/>.
|
|
|
|
|
|
|
|
|
|
.TH STRCMP 1
|
|
|
|
|
|
|
|
|
|
.SH NAME
|
|
|
|
|
|
|
|
|
|
strcmp \(en compare strings
|
|
|
|
|
|
|
|
|
|
.SH SYNOPSIS
|
|
|
|
|
|
|
|
|
|
strcmp
|
|
|
|
|
.RM [ string ]
|
|
|
|
|
.RB [ strings... ]
|
|
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
Check whether string arguments are the same.
|
|
|
|
|
|
|
|
|
|
.SH DIAGNOSTICS
|
|
|
|
|
|
|
|
|
|
The program will exit successfully if the strings are identical. Otherwise, it
|
|
|
|
|
exits with the value 1 if an earlier string has a greater byte value than a
|
|
|
|
|
later string (e.g.
|
2023-12-24 17:13:17 -07:00
|
|
|
|
.R strcmp b a
|
|
|
|
|
)
|
|
|
|
|
and 255 if an earlier string has a lesser byte value (e.g.
|
|
|
|
|
.R strcmp a b
|
|
|
|
|
).
|
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
When invoked incorrectly, a debug message will be printed and the program will
|
|
|
|
|
exit with the appropriate sysexits.h(3) error code.
|
2023-12-24 17:13:17 -07:00
|
|
|
|
|
|
|
|
|
.SH UNICODE
|
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
The program will exit unsuccessfully if the given strings are not identical;
|
|
|
|
|
therefore, unicode strings may need to be normalized if the intent is to check
|
|
|
|
|
visual similarity and not byte similarity.
|
2023-12-24 17:13:17 -07:00
|
|
|
|
|
|
|
|
|
.SH RATIONALE
|
|
|
|
|
|
|
|
|
|
The traditional tool for string comparisons in POSIX and other Unix shells has
|
|
|
|
|
been test(1). This tool also handles integer comparisons and file scrutiny.
|
|
|
|
|
These parts of its functionality have been broken out into multiple utilities.
|
|
|
|
|
|
2024-03-26 19:22:30 -06:00
|
|
|
|
This program’s functionality may be performed on a POSIX-compliant system with
|
2023-12-24 17:13:17 -07:00
|
|
|
|
test(1p).
|
|
|
|
|
|
|
|
|
|
.SH AUTHOR
|
|
|
|
|
|
|
|
|
|
Written by DTB <trinity@trinity.moe>.
|
|
|
|
|
|
|
|
|
|
.SH COPYRIGHT
|
|
|
|
|
|
|
|
|
|
Copyright © 2023 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
|
|
|
|
<https://gnu.org/licenses/gpl.html>.
|
|
|
|
|
|
|
|
|
|
.SH SEE ALSO
|
|
|
|
|
|
2024-02-01 20:42:15 -07:00
|
|
|
|
strcmp(3), intcmp(1), scrut(1), test(1p)
|