(rl_complete_filename): return if there were no matches

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5915 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1999-04-10 21:01:16 +00:00
parent 43d763bdda
commit be4f46aff4

View File

@@ -139,18 +139,22 @@ rl_complete_filename(char *pathname, int *unique)
size_t i;
size_t j;
size_t len;
char *s;
ac = rl_list_possib(pathname, &av);
if(ac == 0)
return NULL;
s = strrchr(pathname, '/');
if(s == NULL)
len = strlen(pathname);
else
len = strlen(s + 1);
p = NULL;
if (ac == 1) {
char *s = strrchr(pathname, '/');
/* Exactly one match -- finish it off. */
*unique = 1;
if(s == NULL)
len = strlen(pathname);
else
len = strlen(s + 1);
j = strlen(av[0]) - len + 2;
if ((p = malloc(j + 1)) != NULL) {
memcpy(p, av[0] + len, j);