explain_strcoll_or_die(3)

πŸ“¦
version 1.4.D001 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– explain_strcoll_or_die β€” like, the manual page, bestie πŸ’–

okay so you're in explain_strcoll_or_die(3), which lives in the Library Functions Manual section, and honestly? it's giving "I compare strings in your current locale and I will tell you when it goes wrong." no cap. let's get into it πŸ¦‹


✨ NAME ✨

explain_strcoll_or_die β€” compare strings using current locale and report errors

like yes, that's literally the whole job. compare two strings. locale-aware. and if it breaks? it tells you. loudly. πŸ’…


🌸 SYNOPSIS 🌸

#include <libexplain/strcoll.h>
int explain_strcoll_or_die(const char *s1, const char *s2);
int explain_strcoll_on_error(const char *s1, const char *s2);

two functions. two whole vibes. one of them ends you (the process, not you personally, bestie 🫢) and the other one is the chill one. keep reading.


πŸŽ€ DESCRIPTION πŸŽ€

so the explain_strcoll_or_die function is what you use to call the strcoll(3) system call. and when it fails? an explanation gets printed to stderr, which it grabs from the explain_strcoll(3) function, and then the process terminates by calling exit(EXIT_FAILURE). so like… it really said "we're done here." πŸ’€

the explain_strcoll_on_error function is also used to call the strcoll(3) system call. when it fails, an explanation gets printed to stderr too β€” also obtained from the explain_strcoll(3) function β€” but it still returns to the caller. so it's the "tell me what went wrong but don't kill me" option. main character energy but with mercy. ✨

  • s1 β€” the s1, exactly as to be passed to the strcoll(3) system call. no edits, no glow-ups, just hand it over as-is.
  • s2 β€” the s2, exactly as to be passed to the strcoll(3) system call. same deal. πŸ’–

⭐ RETURN VALUE ⭐

the explain_strcoll_or_die function only returns on success β€” see strcoll(3) for more information. on failure it prints an explanation and exits, so it does not return. like, at all. it's gone. it left the chat. πŸ™ˆ

the explain_strcoll_on_error function always returns the value returned by the wrapped strcoll(3) system call. every time. that's the whole point of it, bestie.


🌈 EXAMPLE 🌈

the explain_strcoll_or_die function is intended to be used in a fashion similar to the following example:

int result = explain_strcoll_or_die(s1, s2);

that's it. that's the example. iconic, honestly. one line. ate. πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

go read those if you want the full lore. iykyk. πŸ¦‹


libexplain version 1.4 Copyright (C) 2013 Peter Miller


okay so that's the whole page!! libexplain version 1.4, copyright 2013 Peter Miller, and yeah the date on this one is just… 2013 energy, periodt. go forth and compare strings responsibly bestie, and remember: if you pick the _or_die one, it means the die part. πŸ’…πŸŽ€βœ¨

πŸ“¦ where this page comes from