UPSCLI_STR_CONTAINS_(3)
π UPSCLI_STR_CONTAINS_(3) π
okay bestie, so this one lives in the NUT Manual (yes, that's Network UPS Tools, and yes, the acronym is iconic and we're not changing it). Let's get into it β¨
πΈ NAME πΈ
upscli_str_contains_token β the lil function that checks whether an unique token is actually chilling inside your string π΅οΈββοΈ
π SYNOPSIS π
#include <upsclient.h>
int upscli_str_contains_token(const char *string, const char *token);
π¦ DESCRIPTION π¦
okay so picture this. upscli_str_contains_token() takes two pointers, right?
Pointer number one is tgt, and it points at a caller-provided const char * buffer. That buffer is made up of unique tokens, and those tokens are separated by single space characters (that's ASCII 0x20, bestie, the regular space, no fancy whitespace shenanigans π).
Pointer number two is token, and it points at a presumed-contiguous token value β like, the token you're hoping to find in that tgt buffer.
and then the function is literally just: is it in there or not? vibe check complete β
π₯ RETURN VALUE π₯
upscli_str_contains_token() hands you back a numeric code, and here's how to read it:
- non-zero if the token value was found in the
tgtbuffer (it might be surrounded by space characters, or it might be sitting right at the start or the end of the string β all of those count, slay β¨) - 0 if the token was not found, or if either
tokenortgtstring wasNULLor empty π«
bestie please check your empty strings and NULLs, the function is not gonna be nice about it, it's just gonna return 0 and move on π
π SEE ALSO π
upscli_str_add_unique_token(3)β the other token girlie, go say hi π«Ά
and that's the whole page, no cap π this was Network UPS Tools 2.8.5, dated 06/21/2026 β iconic version, iconic date, periodt πβ
π¦ where this page comes from
- arch rolling: nut 2.8.5-2 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms