Release 950727
[wine/multimedia.git] / debugger / readline / sysunix.c
blobe2b72e1a01caa6bde057d2ce23be0232f27266fa
1 /* $Revision: 1.1 $
2 **
3 ** Unix system-dependant routines for editline library.
4 */
5 #include "editline.h"
6 #include "config.h"
8 #if defined(HAVE_TCGETATTR)
9 #include <termios.h>
11 void
12 rl_ttyset(Reset)
13 int Reset;
15 static struct termios old;
16 struct termios new;
18 if (Reset == 0) {
19 (void)tcgetattr(0, &old);
20 rl_erase = old.c_cc[VERASE];
21 rl_kill = old.c_cc[VKILL];
22 rl_eof = old.c_cc[VEOF];
23 rl_intr = old.c_cc[VINTR];
24 rl_quit = old.c_cc[VQUIT];
26 new = old;
27 new.c_cc[VINTR] = -1;
28 new.c_cc[VQUIT] = -1;
29 new.c_lflag &= ~(ECHO | ICANON);
30 new.c_iflag &= ~(ISTRIP | INPCK);
31 new.c_cc[VMIN] = 1;
32 new.c_cc[VTIME] = 0;
33 (void)tcsetattr(0, TCSANOW, &new);
35 else
36 (void)tcsetattr(0, TCSANOW, &old);
39 #else
40 #include <sgtty.h>
42 void
43 rl_ttyset(Reset)
44 int Reset;
46 static struct sgttyb old_sgttyb;
47 static struct tchars old_tchars;
48 struct sgttyb new_sgttyb;
49 struct tchars new_tchars;
51 if (Reset == 0) {
52 (void)ioctl(0, TIOCGETP, &old_sgttyb);
53 rl_erase = old_sgttyb.sg_erase;
54 rl_kill = old_sgttyb.sg_kill;
56 (void)ioctl(0, TIOCGETC, &old_tchars);
57 rl_eof = old_tchars.t_eofc;
58 rl_intr = old_tchars.t_intrc;
59 rl_quit = old_tchars.t_quitc;
61 new_sgttyb = old_sgttyb;
62 new_sgttyb.sg_flags &= ~ECHO;
63 new_sgttyb.sg_flags |= RAW;
64 #if defined(PASS8)
65 new_sgttyb.sg_flags |= PASS8;
66 #endif /* defined(PASS8) */
67 (void)ioctl(0, TIOCSETP, &new_sgttyb);
69 new_tchars = old_tchars;
70 new_tchars.t_intrc = -1;
71 new_tchars.t_quitc = -1;
72 (void)ioctl(0, TIOCSETC, &new_tchars);
74 else {
75 (void)ioctl(0, TIOCSETP, &old_sgttyb);
76 (void)ioctl(0, TIOCSETC, &old_tchars);
79 #endif /* defined(HAVE_TCGETATTR) */
81 void
82 rl_add_slash(path, p)
83 char *path;
84 char *p;
86 struct stat Sb;
88 if (stat(path, &Sb) >= 0)
89 (void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");