wofi-utils - Man Page

Utility functions and documentation

Description

The functions documented here are general utility functions. They are defined in utils.h.

Utility Functions

The following functions are general convenience functions.

time_t utils_get_time_millis(void)

Returns the current unix time in milliseconds.

void utils_sleep_millis(time_t millis)

Sleeps for the specified amount of time.

time_t millis - The time to sleep for in milliseconds.

char* utils_concat(size_t arg_count, ...)

Concatenates strings together. The returned result is newly allocated and must be freed by the caller when finished using it.

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.

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.

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.

const char* haystack - The string to search in.

const char* needle - The string to search for.