(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:
@@ -139,18 +139,22 @@ rl_complete_filename(char *pathname, int *unique)
|
|||||||
size_t i;
|
size_t i;
|
||||||
size_t j;
|
size_t j;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
char *s;
|
||||||
|
|
||||||
ac = rl_list_possib(pathname, &av);
|
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;
|
p = NULL;
|
||||||
if (ac == 1) {
|
if (ac == 1) {
|
||||||
char *s = strrchr(pathname, '/');
|
|
||||||
/* Exactly one match -- finish it off. */
|
/* Exactly one match -- finish it off. */
|
||||||
*unique = 1;
|
*unique = 1;
|
||||||
if(s == NULL)
|
|
||||||
len = strlen(pathname);
|
|
||||||
else
|
|
||||||
len = strlen(s + 1);
|
|
||||||
j = strlen(av[0]) - len + 2;
|
j = strlen(av[0]) - len + 2;
|
||||||
if ((p = malloc(j + 1)) != NULL) {
|
if ((p = malloc(j + 1)) != NULL) {
|
||||||
memcpy(p, av[0] + len, j);
|
memcpy(p, av[0] + len, j);
|
||||||
|
Reference in New Issue
Block a user