Source-Changes-HG archive

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

[src/trunk]: src/bin/csh PR/54853: Greg Oster: unable to 'unset filec' or 'un...



details:   https://anonhg.NetBSD.org/src/rev/dc037fdf00e5
branches:  trunk
changeset: 968306:dc037fdf00e5
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 12 03:50:30 2020 +0000

description:
PR/54853: Greg Oster: unable to 'unset filec' or 'unset edit' in csh
While here allow set edit=vi

diffstat:

 bin/csh/set.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r 7d59d6ec0dfc -r dc037fdf00e5 bin/csh/set.c
--- a/bin/csh/set.c     Sun Jan 12 03:37:10 2020 +0000
+++ b/bin/csh/set.c     Sun Jan 12 03:50:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.35 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)set.c      8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: set.c,v 1.35 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -117,10 +117,12 @@
 #ifdef EDIT
     else if (eq(vp, STRedit)) {
        HistEvent ev;
+       Char *vn = value(STRhistchars);
+
        editing = 1;
        el = el_init_fd(getprogname(), cshin, cshout, csherr,
            SHIN, SHOUT, SHERR);
-       el_set(el, EL_EDITOR, "emacs");
+       el_set(el, EL_EDITOR, *vn ? short2str(vn) : "emacs");
        el_set(el, EL_PROMPT, printpromptstr);
        hi = history_init();
        history(hi, &ev, H_SETSIZE, getn(value(STRhistory)));
@@ -518,16 +520,18 @@
        HIST = '!';
        HISTSUB = '^';
     }
-    else if (adrof(STRwordchars) == 0)
+    if (adrof(STRwordchars) == 0)
        word_chars = STR_WORD_CHARS;
 #ifdef FILEC
-    else if (adrof(STRfilec) == 0)
+    if (adrof(STRfilec) == 0)
        filec = 0;
 #endif
 #ifdef EDIT
-    else if (adrof(STRedit) == 0) {
-       el_end(el);
-       history_end(hi);
+    if (adrof(STRedit) == 0) {
+       if (el)
+           el_end(el);
+       if (hi)
+           history_end(hi);
        el = NULL;
        hi = NULL;
        editing = 0;



Home | Main Index | Thread Index | Old Index