static atf_error_t append_config_var(const char *var, atf_list_t *argv) { atf_error_t err; atf_list_t words; err = atf_text_split(atf_config_get(var), " ", &words); if (atf_is_error(err)) goto out; atf_list_append_list(argv, &words); out: return err; }
static void check_split(const char *str, const char *delim, const char *words[]) { atf_list_t list; const char **word; size_t i; printf("Splitting '%s' with delimiter '%s'\n", str, delim); CE(atf_text_split(str, delim, &list)); printf("Expecting %zd words\n", array_size(words)); ATF_CHECK_EQ(atf_list_size(&list), array_size(words)); for (word = words, i = 0; *word != NULL; word++, i++) { printf("Word at position %zd should be '%s'\n", i, words[i]); ATF_CHECK_STREQ((const char *)atf_list_index_c(&list, i), words[i]); } atf_list_fini(&list); }