at_wini: remove unnecessary quirks debug message
[minix.git] / lib / libedit / sysunix.c
blob89bfa8dba35bf18ad318c7ecd9dfafda23ad8d9e
1 /* $Revision$
2 **
3 ** Unix system-dependant routines for editline library.
4 */
5 #include "editline.h"
7 #if defined(HAVE_TCGETATTR)
8 #include <termios.h>
10 void
11 rl_ttyset(Reset)
12 int Reset;
14 static struct termios old;
15 struct termios new;
17 if (Reset == 0) {
18 (void)tcgetattr(0, &old);
19 rl_erase = old.c_cc[VERASE];
20 rl_kill = old.c_cc[VKILL];
21 rl_eof = old.c_cc[VEOF];
22 rl_intr = old.c_cc[VINTR];
23 rl_quit = old.c_cc[VQUIT];
25 new = old;
26 new.c_lflag &= ~(ECHO | ICANON | ISIG | IEXTEN);
27 new.c_iflag &= ~(ICRNL);
28 new.c_cc[VMIN] = 1;
29 new.c_cc[VTIME] = 0;
30 (void)tcsetattr(0, TCSADRAIN, &new);
32 else
33 (void)tcsetattr(0, TCSADRAIN, &old);
36 #else
37 #if defined(HAVE_TERMIO)
38 #include <termio.h>
40 void
41 rl_ttyset(Reset)
42 int Reset;
44 static struct termio old;
45 struct termio new;
47 if (Reset == 0) {
48 (void)ioctl(0, TCGETA, &old);
49 rl_erase = old.c_cc[VERASE];
50 rl_kill = old.c_cc[VKILL];
51 rl_eof = old.c_cc[VEOF];
52 rl_intr = old.c_cc[VINTR];
53 rl_quit = old.c_cc[VQUIT];
55 new = old;
56 new.c_cc[VINTR] = -1;
57 new.c_cc[VQUIT] = -1;
58 new.c_lflag &= ~(ECHO | ICANON);
59 new.c_cc[VMIN] = 1;
60 new.c_cc[VTIME] = 0;
61 (void)ioctl(0, TCSETAW, &new);
63 else
64 (void)ioctl(0, TCSETAW, &old);
67 #else
68 #include <sgtty.h>
70 void
71 rl_ttyset(Reset)
72 int Reset;
74 static struct sgttyb old_sgttyb;
75 static struct tchars old_tchars;
76 struct sgttyb new_sgttyb;
77 struct tchars new_tchars;
79 if (Reset == 0) {
80 (void)ioctl(0, TIOCGETP, &old_sgttyb);
81 rl_erase = old_sgttyb.sg_erase;
82 rl_kill = old_sgttyb.sg_kill;
84 (void)ioctl(0, TIOCGETC, &old_tchars);
85 rl_eof = old_tchars.t_eofc;
86 rl_intr = old_tchars.t_intrc;
87 rl_quit = old_tchars.t_quitc;
89 new_sgttyb = old_sgttyb;
90 new_sgttyb.sg_flags &= ~ECHO;
91 new_sgttyb.sg_flags |= RAW;
92 (void)ioctl(0, TIOCSETP, &new_sgttyb);
94 new_tchars = old_tchars;
95 new_tchars.t_intrc = -1;
96 new_tchars.t_quitc = -1;
97 (void)ioctl(0, TIOCSETC, &new_tchars);
99 else {
100 (void)ioctl(0, TIOCSETP, &old_sgttyb);
101 (void)ioctl(0, TIOCSETC, &old_tchars);
104 #endif /* defined(HAVE_TERMIO) */
105 #endif /* defined(HAVE_TCGETATTR) */
107 void
108 rl_add_slash(path, p)
109 char *path;
110 char *p;
112 struct stat Sb;
114 if (stat(path, &Sb) >= 0)
115 (void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
119 * $PchId: sysunix.c,v 1.4 1996/02/22 21:16:56 philip Exp $