Changeset c72254 in git
- Timestamp:
- Sep 15, 2010, 6:27:24 PM (13 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- c16aa06112c9be7ae12a574a08b2d1bb42709ccc
- Parents:
- 7504ddfe25cbc97ca03089b2d7dd8c1a3ff1d050
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/febase.cc
r7504dd rc72254 44 44 int si_echo = 0; 45 45 int printlevel = 0; 46 int pagelength = 24;47 46 int colmax = 80; 48 47 char prompt_char = '>'; /*1 either '>' or '.'*/ -
kernel/fereadl.c
r7504dd rc72254 46 46 #endif 47 47 48 #ifdef atarist49 #include <ioctl.h>50 #else51 #ifdef NeXT52 #include <sgtty.h>53 #include <sys/ioctl.h>54 #endif55 #endif56 48 #endif 57 49 … … 66 58 #define feCTRL(C) ((C) & 0x1F) /* <ctrl> character */ 67 59 68 /* Use this variable to remember original terminal attributes. */ 69 #if defined( atarist ) || defined( NeXT ) 70 struct sgttyb fe_saved_attributes; 71 #else 72 struct termios fe_saved_attributes; 73 #endif 60 struct termios fe_saved_attributes; 74 61 75 62 static BOOLEAN fe_stdout_is_tty; … … 77 64 BOOLEAN fe_use_fgets=FALSE; 78 65 static BOOLEAN fe_is_initialized=FALSE; 66 static int pagelength = 24; 67 79 68 FILE * fe_echo; /*the output file for echoed characters*/ 80 69 … … 102 91 if (fe_is_raw_tty) 103 92 { 104 #ifdef atarist 105 stty(0, &fe_saved_attributes); 106 #else 107 #ifdef NeXT 108 ioctl(STDIN_FILENO, TIOCSETP, &fe_saved_attributes); 109 #else 110 tcsetattr (STDIN_FILENO, TCSANOW, &fe_saved_attributes); 111 #endif 112 #endif 93 tcsetattr (STDIN_FILENO, TCSANOW, &fe_saved_attributes); 113 94 fe_is_raw_tty=0; 114 95 } … … 132 113 if (fe_is_raw_tty) 133 114 { 134 #ifdef atarist 135 stty(0, &fe_saved_attributes); 136 #else 137 #ifdef NeXT 138 ioctl(STDIN_FILENO, TIOCSETP, &fe_saved_attributes); 139 #else 140 tcsetattr (STDIN_FILENO, TCSANOW, &fe_saved_attributes); 141 #endif 142 #endif 115 tcsetattr (STDIN_FILENO, TCSANOW, &fe_saved_attributes); 143 116 fe_is_raw_tty=0; 144 117 } … … 148 121 if(fe_is_raw_tty==0) 149 122 { 150 #ifdef atarist 151 /*set line wrap mode*/ 152 if(fe_stdout_is_tty) 153 { 154 printf("\033v"); 155 } 156 #endif 157 #if defined( atarist ) || defined( NeXT ) 158 struct sgttyb tattr; 159 #else 160 struct termios tattr; 161 #endif 123 struct termios tattr; 162 124 163 125 /* Set the funny terminal modes. */ 164 #ifdef atarist 165 gtty(0, &tattr); 166 tattr.sg_flags |= RAW; 167 tattr.sg_flags |= CBREAK; 168 tattr.sg_flags &= ~ECHO; 169 stty(0, &tattr); 170 #else 171 #ifdef NeXT 172 ioctl(STDIN_FILENO, TIOCGETP, &tattr); 173 //tattr.sg_flags |= RAW; 174 tattr.sg_flags |= CBREAK; 175 tattr.sg_flags &= ~ECHO; 176 ioctl(STDIN_FILENO, TIOCSETP, &tattr); 177 ioctl(STDOUT_FILENO, TIOCGETP, &tattr); 178 tattr.sg_flags |= CRMOD; 179 ioctl(STDOUT_FILENO, TIOCSETP, &tattr); 180 #else 181 tcgetattr (STDIN_FILENO, &tattr); 182 tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ 183 tattr.c_cc[VMIN] = 1; 184 tattr.c_cc[VTIME] = 0; 185 tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr); 186 #endif 187 #endif 126 tcgetattr (STDIN_FILENO, &tattr); 127 tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ 128 tattr.c_cc[VMIN] = 1; 129 tattr.c_cc[VTIME] = 0; 130 tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr); 188 131 fe_is_raw_tty=1; 189 132 } … … 213 156 { 214 157 fe_stdout_is_tty=0; 215 #ifdef atarist 216 fe_echo = fopen( "/dev/tty", "w" ); 217 #else 218 fe_echo = fopen( ttyname(fileno(stdin)), "w" ); 219 #endif 158 fe_echo = fopen( ttyname(fileno(stdin)), "w" ); 220 159 } 221 160 /* Save the terminal attributes so we can restore them later. */ 222 161 { 223 #if defined( atarist ) || defined( NeXT ) 224 struct sgttyb tattr; 225 #ifdef atarist 226 gtty(0, &fe_saved_attributes); 227 #else 228 ioctl(STDIN_FILENO, TIOCGETP, &fe_saved_attributes); 229 #endif 230 #else 231 struct termios tattr; 232 tcgetattr (STDIN_FILENO, &fe_saved_attributes); 233 #endif 162 struct termios tattr; 163 tcgetattr (STDIN_FILENO, &fe_saved_attributes); 234 164 #ifdef HAVE_FEREAD 235 165 #ifdef HAVE_ATEXIT … … 241 171 242 172 /* Set the funny terminal modes. */ 243 #ifdef atarist 244 gtty(0, &tattr); 245 tattr.sg_flags |= RAW; 246 tattr.sg_flags |= CBREAK; 247 tattr.sg_flags &= ~ECHO; 248 stty(0, &tattr); 249 #else 250 #ifdef NeXT 251 ioctl(STDIN_FILENO, TIOCGETP, &tattr); 252 //tattr.sg_flags |= RAW; 253 tattr.sg_flags |= CBREAK; 254 tattr.sg_flags &= ~ECHO; 255 ioctl(STDIN_FILENO, TIOCSETP, &tattr); 256 ioctl(STDOUT_FILENO, TIOCGETP, &tattr); 257 tattr.sg_flags |= CRMOD; 258 ioctl(STDOUT_FILENO, TIOCSETP, &tattr); 259 #else 260 tcgetattr (STDIN_FILENO, &tattr); 261 tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ 262 tattr.c_cc[VMIN] = 1; 263 tattr.c_cc[VTIME] = 0; 264 tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr); 265 #endif 266 /*ospeed=cfgetospeed(&tattr);*/ 267 #endif 173 tcgetattr (STDIN_FILENO, &tattr); 174 tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ 175 tattr.c_cc[VMIN] = 1; 176 tattr.c_cc[VTIME] = 0; 177 tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr); 178 /*ospeed=cfgetospeed(&tattr);*/ 268 179 } 269 180 if(term==NULL)
Note: See TracChangeset
for help on using the changeset viewer.