From be4f46aff4df2ea5db9159abcc01ad51be7f903a Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Sat, 10 Apr 1999 21:01:16 +0000 Subject: [PATCH] (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 --- lib/editline/complete.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/editline/complete.c b/lib/editline/complete.c index aca33aaeb..9dfa582cc 100644 --- a/lib/editline/complete.c +++ b/lib/editline/complete.c @@ -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);