aboutsummaryrefslogtreecommitdiff
path: root/filecomplete.c
diff options
context:
space:
mode:
Diffstat (limited to 'filecomplete.c')
-rw-r--r--filecomplete.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/filecomplete.c b/filecomplete.c
index 5e98cf56442da..576414d3ba695 100644
--- a/filecomplete.c
+++ b/filecomplete.c
@@ -1,4 +1,4 @@
-/* $NetBSD: filecomplete.c,v 1.31 2011/09/16 16:13:16 plunky Exp $ */
+/* $NetBSD: filecomplete.c,v 1.34 2014/10/18 15:07:02 riz Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.31 2011/09/16 16:13:16 plunky Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.34 2014/10/18 15:07:02 riz Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -64,7 +64,7 @@ static const Char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@',
* if ``user'' isn't valid user name or ``txt'' doesn't start
* w/ '~', returns pointer to strdup()ed copy of ``txt''
*
- * it's callers's responsibility to free() returned string
+ * it's the caller's responsibility to free() the returned string
*/
char *
fn_tilde_expand(const char *txt)
@@ -137,7 +137,7 @@ fn_tilde_expand(const char *txt)
* such file can be found
* value of ``state'' is ignored
*
- * it's caller's responsibility to free returned string
+ * it's the caller's responsibility to free the returned string
*/
char *
fn_filename_completion_function(const char *text, int state)
@@ -490,7 +490,8 @@ fn_complete(EditLine *el,
if (what_to_do == '?')
goto display_matches;
- if (matches[2] == NULL && strcmp(matches[0], matches[1]) == 0) {
+ if (matches[2] == NULL &&
+ (matches[1] == NULL || strcmp(matches[0], matches[1]) == 0)) {
/*
* We found exact match. Add a space after
* it, unless we do filename completion and the