char **cwd_tab_completion(char *buf, int *num_matches)
{
- char *dirName, *tmp = NULL;
+ char *dirName, *tmp = NULL, *tmp2 = NULL;
char **matches = (char **) NULL;
DIR *dir;
struct dirent *next;
- matches = malloc(sizeof(char *) * 50);
+ matches = nmalloc(1024);
/* Stick a wildcard onto the buf, for later use */
strcat(buf, "*");
#endif
/* See if this matches */
if (check_wildcard_match(next->d_name, tmp) == TRUE) {
- /* Cool, found a match. Add it to the list */
- matches[*num_matches] = malloc(strlen(next->d_name) + 1);
- strcpy(matches[*num_matches], next->d_name);
+
+ /* Cool, found a match. Add it to the list
+ * This makes a lot more sense to me (Chris) this way...
+ */
+ tmp2 = NULL;
+ tmp2 = nmalloc(strlen(next->d_name) + 1);
+ strcpy(tmp2, next->d_name);
+ matches[*num_matches] = tmp2;
++*num_matches;
- //matches = realloc( matches, sizeof(char*)*(*num_matches));
}
}
if (matches != NULL) {
free(matches);
matches = (char **) NULL;
+ num_matches = 0;
}
/* If the word starts with `~' and there is no slash in the word,
}
free(foo);
wrefresh(edit);
- num_matches = 0;
- } else
- beep();
+ }
+ beep();
}
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-11-05 21:59-0500\n"
+"POT-Creation-Date: 2000-11-05 23:04-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "File exists, OVERWRITE ?"
msgstr ""
-#: files.c:730
+#: files.c:735
msgid "(more)"
msgstr ""