wofi-utils(3)

✨ NAME ✨

okay so bestie, this is wofi β€” the utility functions page, aka the little grab-bag of helper functions that the rest of wofi leans on. Consider this your documentation era. πŸ’–


🌸 DESCRIPTION 🌸

The functions documented here are general utility functions. They're all defined in utils.h, so if you're out here trying to use them, that's the header you're gonna want to include. No cap. 🫢


πŸ’… UTILITY FUNCTIONS πŸ’…

These are the general convenience functions, and they are literally so convenient. Every single one, listed below, no skips. ✨

time_t utils_get_time_millis(void)

Returns the current unix time in milliseconds. That's it, that's the whole function, and honestly? Iconic. ⏱️

void utils_sleep_millis(time_t millis)

Sleeps for the specified amount of time. Like a lil nap for your program. 😴

  • time_t millis β€” The time to sleep for in milliseconds.

char* utils_concat(size_t arg_count, ...)

Concatenates strings together. Glues 'em. πŸ’«

⚠️ The returned result is newly allocated and must be freed by the caller when finished using it. Not me letting you leak memory... free it bestie, I'm begging. πŸ™ˆ
  • size_t arg_count β€” The number of arguments provided.
  • varargs β€” The list of strings to be concatenated.

size_t utils_min(size_t n1, size_t n2)

Returns the smaller of the two inputs. Two numbers walk in, the smol one walks out. 🐜

  • size_t n1 β€” The first number.
  • size_t n2 β€” The second number.

size_t utils_min3(size_t n1, size_t n2, size_t n3)

Returns the smallest of the three inputs. It's giving the min function but with a third wheel. πŸ‘‘

  • size_t n1 β€” The first number.
  • size_t n2 β€” The second number.
  • size_t n3 β€” The third number.

size_t utils_distance(const char* haystack, const char* needle)

Computes the Levenshtein distance between the two inputs. Yes queen, fuzzy matching energy β€” how far apart are these two strings really. πŸ”₯

  • const char* haystack β€” The string to search in.
  • const char* needle β€” The string to search for.

and that's the whole page, bestie, you made it to the end πŸŽ€ this lil slice of the Library Functions Manual lives at wofi-utils(3) β€” go forth and call these functions, and don't forget to free your strings. mwah. πŸ’–πŸ¦‹βœ¨