+ s = strdup(arg);
+ if (!s)
+ out_of_memory("glob_expand");
+ clean_fname(s, CFN_KEEP_DOT_DIRS
+ | CFN_KEEP_TRAILING_SLASH
+ | CFN_COLLAPSE_DOT_DOT_DIRS);
+ }
+
+ if (glob.absize < MAXPATHLEN
+ && !(glob.arg_buf = realloc_array(glob.arg_buf, char, glob.absize = MAXPATHLEN)))
+ out_of_memory("glob_expand");
+ *glob.arg_buf = '\0';
+
+ glob.argc = save_argc = *argc_p;
+ glob.argv = *argv_p;
+ glob.maxargs = *maxargs_p;
+
+ if (glob.maxargs < 100
+ && !(glob.argv = realloc_array(glob.argv, char *, glob.maxargs = 100)))
+ out_of_memory("glob_expand");
+
+ glob_match(s, 0, -1);
+
+ /* The arg didn't match anything, so add the failed arg to the list. */
+ if (glob.argc == save_argc) {
+ ENSURE_MEMSPACE(glob.argv, char *, glob.maxargs, glob.argc + 1);
+ glob.argv[glob.argc++] = s;
+ ret = 0;
+ } else {