Source-Changes-HG archive

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

[src/netbsd-1-5]: src/bin/ksh Pull up revision 1.11 (requested by sjg):



details:   https://anonhg.NetBSD.org/src/rev/8ff9efc3ffb8
branches:  netbsd-1-5
changeset: 492657:8ff9efc3ffb8
user:      he <he%NetBSD.org@localhost>
date:      Wed Feb 06 13:56:11 2002 +0000

description:
Pull up revision 1.11 (requested by sjg):
  Fix some aspects of globbing, particularly in emacs mode.

diffstat:

 bin/ksh/emacs.c |  24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r b6e860db15f1 -r 8ff9efc3ffb8 bin/ksh/emacs.c
--- a/bin/ksh/emacs.c   Wed Feb 06 13:55:57 2002 +0000
+++ b/bin/ksh/emacs.c   Wed Feb 06 13:56:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emacs.c,v 1.10 1999/11/09 00:01:49 jdolecek Exp $      */
+/*     $NetBSD: emacs.c,v 1.10.4.1 2002/02/06 13:56:11 he Exp $        */
 
 /*
  *  Emacs-like command line editing and history
@@ -1768,6 +1768,17 @@
        return KSTD;
 }
 
+
+static int
+is_dir(const char *path)
+{
+       struct stat st;
+
+       if (stat(path, &st) == 0)
+               return S_ISDIR(st.st_mode);
+       return 0;
+}
+
 /* type == 0 for list, 1 for complete and 2 for complete-list */
 static void
 do_complete(flags, type)
@@ -1854,8 +1865,15 @@
                                 * space to the end...
                                 */
                                if (nwords == 1
-                                   && !ISDIRSEP(words[0][nlen - 1]))
-                                       x_ins(space);
+                                   && !ISDIRSEP(words[0][nlen - 1])) {
+                                       /*
+                                        * we may be here because we
+                                        * just expanded $HOME in
+                                        * which case adding '/' is
+                                        * correct.
+                                        */
+                                       x_ins(is_dir(words[0]) ? slash : space);
+                               }
                        } else
                                x_e_putc(BEL);
                }



Home | Main Index | Thread Index | Old Index