From owner-svn-src-all@FreeBSD.ORG Tue Jun 15 22:23:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E715B1065677; Tue, 15 Jun 2010 22:23:21 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D63018FC08; Tue, 15 Jun 2010 22:23:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5FMNLR1011077; Tue, 15 Jun 2010 22:23:21 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5FMNLTf011075; Tue, 15 Jun 2010 22:23:21 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201006152223.o5FMNLTf011075@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 15 Jun 2010 22:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209224 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2010 22:23:22 -0000 Author: jilles Date: Tue Jun 15 22:23:21 2010 New Revision: 209224 URL: http://svn.freebsd.org/changeset/base/209224 Log: libedit: Reduce surprising behaviour with filename completion some more: * Quote '*', '?' and '['. While it may be more useful to expand them to matching pathnames, this at least matches with the completion we do. * '@' is a regular character for filenames. Some other shells do @ completion but we do not. * Prefix names starting with '-' and '+' with './' so they are not seen as options. Modified: head/lib/libedit/filecomplete.c Modified: head/lib/libedit/filecomplete.c ============================================================================== --- head/lib/libedit/filecomplete.c Tue Jun 15 22:16:02 2010 (r209223) +++ head/lib/libedit/filecomplete.c Tue Jun 15 22:23:21 2010 (r209224) @@ -50,10 +50,10 @@ __FBSDID("$FreeBSD$"); #include "histedit.h" #include "filecomplete.h" -static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', - '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; +static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', + '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; /* Tilde is deliberately omitted here, we treat it specially. */ -static char extra_quote_chars[] = { ')', '}', '\0' }; +static char extra_quote_chars[] = { ')', '}', '*', '?', '[', '$', '\0' }; /********************************/ @@ -595,6 +595,8 @@ sh_quote(const char *str) int extra_len = 0; char *quoted_str, *dst; + if (*str == '-' || *str == '+') + extra_len += 2; for (src = str; *src != '\0'; src++) if (strchr(break_chars, *src) || strchr(extra_quote_chars, *src)) @@ -606,6 +608,8 @@ sh_quote(const char *str) return NULL; dst = quoted_str; + if (*str == '-' || *str == '+') + *dst++ = '.', *dst++ = '/'; for (src = str; *src != '\0'; src++) { if (strchr(break_chars, *src) || strchr(extra_quote_chars, *src))