src/common/string.c
/**
 * Search a string for the first non whitespace character and set the index
 * of the character into the provided pointer
 *
 * If no non-whitespace characters are found in the supplied string return
 * NOT_FOUND_ERROR otherwise NO_ERROR
 */
Search a string for the first non whitespace character and set the index
of the character into the provided pointer

If no non-whitespace characters are found in the supplied string return
NOT_FOUND_ERROR otherwise NO_ERROR
Search a string for the first non whitespace character and set the index of the character into the provided pointer If no non - whitespace characters are found in the supplied string return NOT_FOUND_ERROR otherwise NO_ERROR
enum natwm_error string_find_first_nonspace(const char *string, size_t *index_result)
{
        if (string == NULL) {
                return INVALID_INPUT_ERROR;
        }
        char ch = '\0';
        size_t index = 0;
        while ((ch = string[index]) != '\0' && isspace(ch)) {
                ++index;
        }
        if (ch == '\0') {
                return NOT_FOUND_ERROR;
        }
        *index_result = index;
        return NO_ERROR;
}
enum natwm_error string_find_first_nonspace ( const char * string , size_t * index_result ) { if ( string == NULL ) { return INVALID_INPUT_ERROR ; } char ch = ' \0 ' ; size_t index = 0 ; while ( ( ch = string [ index ] ) != ' \0 ' && isspace ( ch ) ) { ++ index ; } if ( ch == ' \0 ' ) { return NOT_FOUND_ERROR ; } * index_result = index ; return NO_ERROR ; }
Search a string for the first non whitespace character and set the index
 of the character into the provided pointer
Search a string for the first non whitespace character and set the index of the character into the provided pointer
// Reached the end of the line without finding a nonspace char