diff options
| author | lukem <lukem@NetBSD.org> | 2000-01-20 13:19:46 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2000-01-20 13:19:46 +0000 |
| commit | b5a4e862d8bfa0d81aba8013eec00ee761734e22 (patch) | |
| tree | fd8069ecb311ef2b22540d10cb2e678eddd4885c /usr.bin | |
| parent | b7868a436d5b8475059736a3eecfbe1cf0859cb8 (diff) | |
complete_ambiguous(): be consistent about completing unambiguous matches; if
the word is already complete then return CC_REFRESH so that the higher layer
may append a suffix if necessary. Fix from Launey Thomas <ljt@alum.mit.edu>.
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/ftp/complete.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ftp/complete.c b/usr.bin/ftp/complete.c index 0172084b2eb..cd9d0ad26c8 100644 --- a/usr.bin/ftp/complete.c +++ b/usr.bin/ftp/complete.c @@ -1,4 +1,4 @@ -/* $NetBSD: complete.c,v 1.36 1999/11/28 06:32:04 lukem Exp $ */ +/* $NetBSD: complete.c,v 1.37 2000/01/20 13:19:46 lukem Exp $ */ /*- * Copyright (c) 1997-1999 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: complete.c,v 1.36 1999/11/28 06:32:04 lukem Exp $"); +__RCSID("$NetBSD: complete.c,v 1.37 2000/01/20 13:19:46 lukem Exp $"); #endif /* not lint */ /* @@ -90,7 +90,7 @@ complete_ambiguous(word, list, words) StringList *words; { char insertstr[MAXPATHLEN]; - char *lastmatch; + char *lastmatch, *p; int i, j; size_t matchlen, wordlen; @@ -99,7 +99,9 @@ complete_ambiguous(word, list, words) return (CC_ERROR); /* no choices available */ if (words->sl_cur == 1) { /* only once choice available */ - char *p = words->sl_str[0] + wordlen; + p = words->sl_str[0] + wordlen; + if (*p == '\0') /* at end of word? */ + return (CC_REFRESH); ftpvis(insertstr, sizeof(insertstr), p, strlen(p)); if (el_insertstr(el, insertstr) == -1) return (CC_ERROR); |
