47 #include <sys/types.h>
50 extern CONST ECHAR el_NIL[];
55 CONST ECHAR *el_Input = el_NIL;
57 extern void TTYflush();
59 #if defined(HAVE_TCGETATTR)
62 void rl_ttyset(
int Reset)
64 static struct termios old;
68 (void)tcgetattr(0, &old);
69 rl_erase = old.c_cc[VERASE];
70 rl_kill = old.c_cc[VKILL];
71 rl_eof = old.c_cc[VEOF];
72 rl_intr = old.c_cc[VINTR];
73 rl_quit = old.c_cc[VQUIT];
78 new.c_lflag &= ~(ECHO | ICANON);
79 new.c_iflag &= ~(ISTRIP | INPCK);
84 new.c_cc[VDSUSP] = -1;
87 (void)tcsetattr(0, TCSANOW, &
new);
90 (
void)tcsetattr(0, TCSANOW, &old);
96 void rl_ttyset(
int Reset)
98 static struct sgttyb old_sgttyb;
99 static struct tchars old_tchars;
100 struct sgttyb new_sgttyb;
101 struct tchars new_tchars;
104 (void)ioctl(0, TIOCGETP, &old_sgttyb);
105 rl_erase = old_sgttyb.sg_erase;
106 rl_kill = old_sgttyb.sg_kill;
108 (void)ioctl(0, TIOCGETC, &old_tchars);
109 rl_eof = old_tchars.t_eofc;
110 rl_intr = old_tchars.t_intrc;
111 rl_quit = old_tchars.t_quitc;
113 new_sgttyb = old_sgttyb;
114 new_sgttyb.sg_flags &= ~ECHO;
115 new_sgttyb.sg_flags |= RAW;
117 new_sgttyb.sg_flags |= PASS8;
119 (void)ioctl(0, TIOCSETP, &new_sgttyb);
121 new_tchars = old_tchars;
122 new_tchars.t_intrc = -1;
123 new_tchars.t_quitc = -1;
124 (void)ioctl(0, TIOCSETC, &new_tchars);
127 (void)ioctl(0, TIOCSETP, &old_sgttyb);
128 (void)ioctl(0, TIOCSETC, &old_tchars);
133 unsigned int TTYget()
145 s = read(0, &c, (ESIZE_T)1) == 1 ? c : EOF;
149 void rl_add_slash(
char *path,
char *p)
153 if (stat(path, &Sb) >= 0)
154 (void)strcat(p, S_ISDIR(Sb.st_mode) ?
"/" :
" ");
157 int el_is_directory(
char *path)
161 if ((stat(path, &Sb) >= 0) && S_ISDIR(Sb.st_mode))
170 kill(getpid(),SIGINT);