int do_test (void) { size_t size = 0; char *str = malloc (100); if (str == NULL) { puts ("out of memory"); return 1; } char **argz = &str; for (int i = 0; i < nstrs; ++i) argz_add_sep (argz, &size, strs[i].s, '\0'); printf ("calling envz_strip with size=%zu\n", size); envz_strip (argz, &size); int result = 0; printf ("new size=%zu\n", size); for (int i = 0; i < nstrs; ++i) if (strs[i].in_result) { char name[2]; name[0] = strs[i].s[0]; name[1] = '\0'; char *e = envz_entry (*argz, size, name); if (e == NULL) { printf ("entry '%s' not found\n", name); result = 1; } else if (strcmp (e, strs[i].s) != 0) { printf ("entry '%s' does not match: is '%s', expected '%s'\n", name, e, strs[i].s); result = 1; } } free (*argz); return result; }
const struct locale_data* _Category_create(const char * name, int category) { /* JGS, where should this path come from? */ char* locpath_var; char* locale_path = NULL; size_t locale_path_len = 0; locpath_var = __secure_getenv("LOCPATH"); if (locpath_var != NULL && locpath_var[0] != '\0') if (argz_create_sep (locpath_var, ':', &locale_path, &locale_path_len) != 0) return NULL; if (argz_add_sep (&locale_path, &locale_path_len, __LOCALE_PATH, ':') != 0) return NULL; return _Find_locale(locale_path, locale_path_len, category, (char**)&name); }