END_TEST START_TEST(str_join_len) { char dst[9]; size_t ret; size_t ds = (sizeof(dst) / sizeof(char)); eina_init(); dst[0] = '\0'; ret = eina_str_join_len(dst, ds, '#', "ab", 2, "cde", 3); fail_if(ret != 6); fail_if(strcmp(dst, "ab#cde") != 0); ret = eina_str_join_len(dst, ds, '#', "abcdefghi", 9, "cde", 3); fail_if(ret != 13); fail_if(strcmp(dst, "abcdefgh") != 0); ret = eina_str_join_len(dst, ds, '#', "abcdefgh", 8, "cde", 3); fail_if(ret != 12); fail_if(strcmp(dst, "abcdefgh") != 0); ret = eina_str_join_len(dst, ds, '#', "abcd", 4, "efgh", 4); fail_if(ret != 9); fail_if(strcmp(dst, "abcd#efg") != 0); eina_shutdown(); }
/** * Concatenate '~/' and @a path. * * @return similar to snprintf(), this returns the number of bytes written or * that would be required to write if greater or equal than size. */ EAPI size_t e_user_homedir_concat_len(char *dst, size_t size, const char *path, size_t path_len) { if (!_e_user_homedir) e_user_homedir_get(); return eina_str_join_len(dst, size, '/', _e_user_homedir, _e_user_homedir_len, path, path_len); }