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 tgt buffer (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 token or tgt string was NULL or 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 πŸ‘‘


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