| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: histedit.c,v 1.60 2022/02/02 01:21:34 kre Exp $ */ | | 1 | /* $NetBSD: histedit.c,v 1.61 2022/02/08 20:39:59 rillig Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1993 | | 4 | * Copyright (c) 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Kenneth Almquist. | | 8 | * Kenneth Almquist. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | #ifndef lint | | 36 | #ifndef lint |
37 | #if 0 | | 37 | #if 0 |
38 | static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; | | 38 | static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; |
39 | #else | | 39 | #else |
40 | __RCSID("$NetBSD: histedit.c,v 1.60 2022/02/02 01:21:34 kre Exp $"); | | 40 | __RCSID("$NetBSD: histedit.c,v 1.61 2022/02/08 20:39:59 rillig Exp $"); |
41 | #endif | | 41 | #endif |
42 | #endif /* not lint */ | | 42 | #endif /* not lint */ |
43 | | | 43 | |
44 | #include <sys/param.h> | | 44 | #include <sys/param.h> |
45 | #include <sys/stat.h> | | 45 | #include <sys/stat.h> |
46 | #include <dirent.h> | | 46 | #include <dirent.h> |
47 | #include <paths.h> | | 47 | #include <paths.h> |
48 | #include <stdio.h> | | 48 | #include <stdio.h> |
49 | #include <stdlib.h> | | 49 | #include <stdlib.h> |
50 | #include <unistd.h> | | 50 | #include <unistd.h> |
51 | /* | | 51 | /* |
52 | * Editline and history functions (and glue). | | 52 | * Editline and history functions (and glue). |
53 | */ | | 53 | */ |
| @@ -123,27 +123,27 @@ histedit(void) | | | @@ -123,27 +123,27 @@ histedit(void) |
123 | if (el_out == NULL) | | 123 | if (el_out == NULL) |
124 | el_out = fdopen(2, "w"); | | 124 | el_out = fdopen(2, "w"); |
125 | if (el_in == NULL || el_out == NULL) | | 125 | if (el_in == NULL || el_out == NULL) |
126 | goto bad; | | 126 | goto bad; |
127 | el_err = el_out; | | 127 | el_err = el_out; |
128 | #if DEBUG | | 128 | #if DEBUG |
129 | if (tracefile) | | 129 | if (tracefile) |
130 | el_err = tracefile; | | 130 | el_err = tracefile; |
131 | #endif | | 131 | #endif |
132 | /* | | 132 | /* |
133 | * This odd piece of code doesn't affect the shell | | 133 | * This odd piece of code doesn't affect the shell |
134 | * at all, the environment modified here is the | | 134 | * at all, the environment modified here is the |
135 | * stuff accessed via "environ" (the incoming | | 135 | * stuff accessed via "environ" (the incoming |
136 | * envoironment to the shell) which is only ever | | 136 | * environment to the shell) which is only ever |
137 | * touched at sh startup time (long before we get | | 137 | * touched at sh startup time (long before we get |
138 | * here) and ignored thereafter. | | 138 | * here) and ignored thereafter. |
139 | * | | 139 | * |
140 | * But libedit calls getenv() to discover TERM | | 140 | * But libedit calls getenv() to discover TERM |
141 | * and that searches the "environ" environment, | | 141 | * and that searches the "environ" environment, |
142 | * not the shell's internal variable data struct, | | 142 | * not the shell's internal variable data struct, |
143 | * so we need to make sure that TERM in there is | | 143 | * so we need to make sure that TERM in there is |
144 | * correct. | | 144 | * correct. |
145 | * | | 145 | * |
146 | * This sequence copies TERM from the shell into | | 146 | * This sequence copies TERM from the shell into |
147 | * the old "environ" environment. | | 147 | * the old "environ" environment. |
148 | */ | | 148 | */ |
149 | term = lookupvar("TERM"); | | 149 | term = lookupvar("TERM"); |