Module Name: src Committed By: christos Date: Sun Jan 12 03:50:30 UTC 2020
Modified Files: src/bin/csh: set.c Log Message: PR/54853: Greg Oster: unable to 'unset filec' or 'unset edit' in csh While here allow set edit=vi To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/bin/csh/set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/csh/set.c diff -u src/bin/csh/set.c:1.35 src/bin/csh/set.c:1.36 --- src/bin/csh/set.c:1.35 Sat Jan 5 11:54:00 2019 +++ src/bin/csh/set.c Sat Jan 11 22:50:30 2020 @@ -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 @@ update_vars(Char *vp) #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 @@ unset(Char **v, struct command *t) 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;