1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8
* Copyright 1992,1993 Simmule Turner and Rich Salz. All rights reserved.
10
* This software is not subject to any license of the American Telephone
11
* and Telegraph Company or of the Regents of the University of California.
13
* Permission is granted to anyone to use this software for any purpose on
14
* any computer system, and to alter it and redistribute it freely, subject
15
* to the following restrictions:
16
* 1. The authors are not responsible for the consequences of use of this
17
* software, no matter how awful, even if they arise from flaws in it.
18
* 2. The origin of this software must not be misrepresented, either by
19
* explicit claim or by omission. Since few users ever read sources,
20
* credits must appear in the documentation.
21
* 3. Altered versions must be plainly marked as such, and must not be
22
* misrepresented as being the original software. Since few users
23
* ever read sources, credits must appear in the documentation.
24
* 4. This notice may not be removed or altered.
29
** Unix system-dependant routines for editline library.
33
#if defined(HAVE_TCGETATTR)
40
static struct termios old;
44
(void)tcgetattr(0, &old);
45
rl_erase = old.c_cc[VERASE];
46
rl_kill = old.c_cc[VKILL];
47
rl_eof = old.c_cc[VEOF];
48
rl_intr = old.c_cc[VINTR];
49
rl_quit = old.c_cc[VQUIT];
54
new.c_lflag &= ~(ECHO | ICANON);
55
new.c_iflag &= ~(ISTRIP | INPCK);
58
(void)tcsetattr(0, TCSADRAIN, &new);
61
(void)tcsetattr(0, TCSADRAIN, &old);
65
#if defined(HAVE_TERMIO)
72
static struct termio old;
76
(void)ioctl(0, TCGETA, &old);
77
rl_erase = old.c_cc[VERASE];
78
rl_kill = old.c_cc[VKILL];
79
rl_eof = old.c_cc[VEOF];
80
rl_intr = old.c_cc[VINTR];
81
rl_quit = old.c_cc[VQUIT];
86
new.c_lflag &= ~(ECHO | ICANON);
87
new.c_iflag &= ~(ISTRIP | INPCK);
90
(void)ioctl(0, TCSETAW, &new);
93
(void)ioctl(0, TCSETAW, &old);
103
static struct sgttyb old_sgttyb;
104
static struct tchars old_tchars;
105
struct sgttyb new_sgttyb;
106
struct tchars new_tchars;
109
(void)ioctl(0, TIOCGETP, &old_sgttyb);
110
rl_erase = old_sgttyb.sg_erase;
111
rl_kill = old_sgttyb.sg_kill;
113
(void)ioctl(0, TIOCGETC, &old_tchars);
114
rl_eof = old_tchars.t_eofc;
115
rl_intr = old_tchars.t_intrc;
116
rl_quit = old_tchars.t_quitc;
118
new_sgttyb = old_sgttyb;
119
new_sgttyb.sg_flags &= ~ECHO;
120
new_sgttyb.sg_flags |= RAW;
122
new_sgttyb.sg_flags |= PASS8;
123
#endif /* defined(PASS8) */
124
(void)ioctl(0, TIOCSETP, &new_sgttyb);
126
new_tchars = old_tchars;
127
new_tchars.t_intrc = -1;
128
new_tchars.t_quitc = -1;
129
(void)ioctl(0, TIOCSETC, &new_tchars);
132
(void)ioctl(0, TIOCSETP, &old_sgttyb);
133
(void)ioctl(0, TIOCSETC, &old_tchars);
136
#endif /* defined(HAVE_TERMIO) */
137
#endif /* defined(HAVE_TCGETATTR) */
140
rl_add_slash(path, p)
146
if (stat(path, &Sb) >= 0)
147
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");