Module Name: src
Committed By: christos
Date: Sat Dec 14 20:28:03 UTC 2019
Modified Files:
src/usr.bin/mail: complete.c
Log Message:
PR/54764: elo: Incorrect '+file' filename completion in mail(1)
Add propel completion stem so that file completion works.
pullup-9
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/mail/complete.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/mail/complete.c
diff -u src/usr.bin/mail/complete.c:1.20 src/usr.bin/mail/complete.c:1.21
--- src/usr.bin/mail/complete.c:1.20 Tue Jan 12 09:44:24 2010
+++ src/usr.bin/mail/complete.c Sat Dec 14 15:28:02 2019
@@ -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 @@ complete_filename(EditLine *el, char *wo
{
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] = '/';