Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp complete_ambiguous(): be consistent about comple...



details:   https://anonhg.NetBSD.org/src/rev/5a8b0df0a5b8
branches:  trunk
changeset: 480798:5a8b0df0a5b8
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jan 20 13:19:46 2000 +0000

description:
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@localhost>.

diffstat:

 usr.bin/ftp/complete.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r bafabf467021 -r 5a8b0df0a5b8 usr.bin/ftp/complete.c
--- a/usr.bin/ftp/complete.c    Thu Jan 20 08:47:59 2000 +0000
+++ b/usr.bin/ftp/complete.c    Thu Jan 20 13:19:46 2000 +0000
@@ -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 @@
        StringList *words;
 {
        char insertstr[MAXPATHLEN];
-       char *lastmatch;
+       char *lastmatch, *p;
        int i, j;
        size_t matchlen, wordlen;
 
@@ -99,7 +99,9 @@
                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);



Home | Main Index | Thread Index | Old Index