Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/mail PR/54764: elo: Incorrect '+file' filename compl...



details:   https://anonhg.NetBSD.org/src/rev/b9e261cf724a
branches:  trunk
changeset: 967575:b9e261cf724a
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Dec 14 20:28:02 2019 +0000

description:
PR/54764: elo: Incorrect '+file' filename completion in mail(1)
Add propel completion stem so that file completion works.
pullup-9

diffstat:

 usr.bin/mail/complete.c |  23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r d929753b004a -r b9e261cf724a usr.bin/mail/complete.c
--- a/usr.bin/mail/complete.c   Sat Dec 14 20:23:38 2019 +0000
+++ b/usr.bin/mail/complete.c   Sat Dec 14 20:28:02 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $   */
+/*     $NetBSD: complete.c,v 1.21 2019/12/14 20:28:02 christos Exp $   */
 
 /*-
  * Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $");
+__RCSID("$NetBSD: complete.c,v 1.21 2019/12/14 20:28:02 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -332,16 +332,27 @@
 {
        StringList *words;
        char dir[MAXPATHLEN];
-       char *fname;
+       char *fname, *mf;
        DIR *dd;
        struct dirent *dp;
        unsigned char rv;
        size_t len;
 
        if ((fname = strrchr(word, '/')) == NULL) {
-               dir[0] = '.';
-               dir[1] = '\0';
-               fname = word;
+               if (word[0] == '+' && (mf = value(ENAME_FOLDER)) != NULL) {
+                       if (mf[0] == '/') {
+                               (void)estrlcpy(dir, mf, sizeof(dir));
+                       } else {
+                               dir[0] = '~';
+                               dir[1] = '/';
+                               (void)estrlcpy(dir + 2, mf, sizeof(dir) - 2);
+                       }
+                       fname = word + 1;
+               } else {
+                       dir[0] = '.';
+                       dir[1] = '\0';
+                       fname = word;
+               }
        } else {
                if (fname == word) {
                        dir[0] = '/';



Home | Main Index | Thread Index | Old Index