aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1992-03-14 20:43:29 +0000
committerJim Blandy1992-03-14 20:43:29 +0000
commit91bac16a94692d060f8e9e76b877eb0b1451e1b6 (patch)
tree4830a21298726dcdebf6dc42e563d8f7abda434f /src
parentd0d6b7c506eb0f93e80db38d6c2affe0a2b49b4c (diff)
downloademacs-91bac16a94692d060f8e9e76b877eb0b1451e1b6.tar.gz
emacs-91bac16a94692d060f8e9e76b877eb0b1451e1b6.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/callproc.c8
-rw-r--r--src/m/pfa50.h3
-rw-r--r--src/sysdep.c559
-rw-r--r--src/unexec.c4
4 files changed, 247 insertions, 327 deletions
diff --git a/src/callproc.c b/src/callproc.c
index cc2c2d7b576..fff728a328a 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1,5 +1,5 @@
1/* Synchronous subprocess invocation for GNU Emacs. 1/* Synchronous subprocess invocation for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -382,7 +382,6 @@ child_setup (in, out, err, new_argv, env, set_pgrp, current_dir)
382 If using vfork and C_ALLOCA it is safe because that changes 382 If using vfork and C_ALLOCA it is safe because that changes
383 the superior's static variables as if the superior had done alloca 383 the superior's static variables as if the superior had done alloca
384 and will be cleaned up in the usual way. */ 384 and will be cleaned up in the usual way. */
385
386 { 385 {
387 register unsigned char *temp; 386 register unsigned char *temp;
388 register int i; 387 register int i;
@@ -438,6 +437,11 @@ child_setup (in, out, err, new_argv, env, set_pgrp, current_dir)
438 close (out); 437 close (out);
439 close (err); 438 close (err);
440 439
440#ifdef USG
441 setpgrp (); /* No arguments but equivalent in this case */
442#else
443 setpgrp (pid, pid);
444#endif /* USG */
441 setpgrp_of_tty (pid); 445 setpgrp_of_tty (pid);
442 446
443#ifdef vipc 447#ifdef vipc
diff --git a/src/m/pfa50.h b/src/m/pfa50.h
index b9464904817..2368a533707 100644
--- a/src/m/pfa50.h
+++ b/src/m/pfa50.h
@@ -1,4 +1,4 @@
1/* machine description file for PFU A-series. 1/* Machine description file for PFU A-series.
2 Copyright (C) 1988 Free Software Foundation, Inc. 2 Copyright (C) 1988 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -112,4 +112,3 @@ and this notice must be preserved on all copies. */
112#define NO_SIOCTL_H 112#define NO_SIOCTL_H
113 113
114#undef SIGIO 114#undef SIGIO
115
diff --git a/src/sysdep.c b/src/sysdep.c
index fd526e33f9c..1483898478d 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1,5 +1,5 @@
1/* Interfaces to system-dependent kernel and library entries. 1/* Interfaces to system-dependent kernel and library entries.
2 Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -100,10 +100,7 @@ extern char *sys_errlist[];
100#endif /* DGUX */ 100#endif /* DGUX */
101 101
102#include <sys/ioctl.h> 102#include <sys/ioctl.h>
103 103#include "systerm.h"
104#ifdef APOLLO
105#undef TIOCSTART
106#endif
107 104
108#ifdef BSD 105#ifdef BSD
109#ifdef BSD4_1 106#ifdef BSD4_1
@@ -126,63 +123,10 @@ extern char *sys_errlist[];
126#define LLITOUT 0 123#define LLITOUT 0
127#endif /* 4.1 */ 124#endif /* 4.1 */
128 125
129#ifdef HAVE_TERMIOS
130#include <termio.h>
131#include <termios.h>
132#ifdef TIOCGETP
133#undef TIOCGETP
134#endif
135#define TIOCGETP TCGETS
136#undef TIOCSETN
137#define TIOCSETN TCSETSW
138#undef TIOCSETP
139#define TIOCSETP TCSETSF
140#undef TCSETAW
141#define TCSETAW TCSETS
142#define TERMINAL struct termios
143#define OSPEED(str) (str.c_cflag & CBAUD)
144#define SETOSPEED(str,new) (str.c_cflag = (str.c_cflag & ~CBAUD) | (new))
145#define TABS_OK(str) ((str.c_oflag & TABDLY) != TAB3)
146#else
147#define tcgetattr(fd, addr) ioctl (fd, TIOCGETP, addr)
148#endif /* HAVE_TERMIOS */
149
150#ifdef HAVE_TERMIO
151#include <termio.h>
152#undef TIOCGETP
153#define TIOCGETP TCGETA
154#undef TIOCSETN
155/* Wait for output to finish before switching modes.
156 Otherwise screen can be garbaged. */
157#define TIOCSETN TCSETAW
158#undef TIOCSETP
159#define TIOCSETP TCSETAF
160#define TERMINAL struct termio
161#define OSPEED(str) (str.c_cflag & CBAUD)
162#define SETOSPEED(str,new) (str.c_cflag = (str.c_cflag & ~CBAUD) | (new))
163#define TABS_OK(str) ((str.c_oflag & TABDLY) != TAB3)
164#endif /* HAVE_TERMIO */
165
166#ifdef BROKEN_TIOCGETC
167#undef TIOCGETC /* Avoid confusing some conditionals that test this. */
168#endif
169
170#ifdef BROKEN_TIOCGWINSZ 126#ifdef BROKEN_TIOCGWINSZ
171#undef TIOCGWINSZ 127#undef TIOCGWINSZ
172#endif 128#endif
173 129
174#ifndef HAVE_TERMIO
175#ifndef VMS
176#include <sgtty.h>
177#define TERMINAL struct sgttyb
178#define OSPEED(str) str.sg_ospeed
179#define SETOSPEED(str,new) (str.sg_ospeed = (new))
180#define TABS_OK(str) ((str.sg_flags & XTABS) != XTABS)
181#undef TCSETAW
182#define TCSETAW TIOCSETN
183#endif /* not VMS */
184#endif /* not HAVE_TERMIO */
185
186#ifdef USG 130#ifdef USG
187#include <sys/utsname.h> 131#include <sys/utsname.h>
188#include <string.h> 132#include <string.h>
@@ -198,13 +142,6 @@ extern char *sys_errlist[];
198#include <sys/ptem.h> 142#include <sys/ptem.h>
199#endif 143#endif
200#endif /* TIOCGWINSZ */ 144#endif /* TIOCGWINSZ */
201#ifdef NEED_TIME_H
202#include <time.h>
203#else /* not NEED_TIME_H */
204#ifdef HAVE_TIMEVAL
205#include <sys/time.h>
206#endif /* HAVE_TIMEVAL */
207#endif /* not NEED_TIME_H */
208#endif /* USG */ 145#endif /* USG */
209 146
210#ifdef NEED_BSDTTY 147#ifdef NEED_BSDTTY
@@ -225,9 +162,11 @@ extern char *sys_errlist[];
225#include <sys/pty.h> 162#include <sys/pty.h>
226#endif 163#endif
227 164
228#ifdef BROKEN_FIONREAD 165/* saka@pfu.fujitsu.co.JP writes:
229#undef FIONREAD 166 FASYNC defined in this file. But, FASYNC don't working.
230#undef FASYNC 167 so no problem, because unrequest_sigio only need. */
168#if defined (pfa)
169#include <sys/file.h>
231#endif 170#endif
232 171
233extern int quit_char; 172extern int quit_char;
@@ -244,23 +183,8 @@ extern int quit_char;
244#include "ndir.h" 183#include "ndir.h"
245#endif /* NONSYSTEM_DIR_LIBRARY */ 184#endif /* NONSYSTEM_DIR_LIBRARY */
246 185
247#include "emacssignal.h" 186#include "syssignal.h"
248 187#include "systime.h"
249#ifndef sigunblock
250#define sigunblock(SIG) \
251{ SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
252#endif
253
254/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
255 testing SIGCHLD. */
256
257#ifndef VMS
258#ifdef SIGCLD
259#ifndef SIGCHLD
260#define SIGCHLD SIGCLD
261#endif /* not SIGCHLD */
262#endif /* SIGCLD */
263#endif /* not VMS */
264 188
265static int baud_convert[] = 189static int baud_convert[] =
266#ifdef BAUD_CONVERT 190#ifdef BAUD_CONVERT
@@ -274,6 +198,12 @@ static int baud_convert[] =
274 198
275extern short ospeed; 199extern short ospeed;
276 200
201/* The file descriptor for Emacs's input terminal.
202 Under Unix, this is always left zero;
203 under VMS, we place the input channel number here.
204 This allows us to write more code that works for both VMS and Unix. */
205static int input_fd;
206
277#ifdef VMS 207#ifdef VMS
278static struct iosb 208static struct iosb
279{ 209{
@@ -293,7 +223,6 @@ int process_ef = 0;
293int input_eflist; 223int input_eflist;
294int timer_eflist; 224int timer_eflist;
295 225
296static int input_chan;
297static $DESCRIPTOR (input_dsc, "TT"); 226static $DESCRIPTOR (input_dsc, "TT");
298static int terminator_mask[2] = { 0, 0 }; 227static int terminator_mask[2] = { 0, 0 };
299 228
@@ -311,14 +240,11 @@ static struct sensemode {
311 unsigned long tt_char : 24, scr_len : 8; 240 unsigned long tt_char : 24, scr_len : 8;
312 unsigned long tt2_char; 241 unsigned long tt2_char;
313} sensemode_iosb; 242} sensemode_iosb;
314#define TERMINAL struct sensemode
315#define OSPEED(str) (str.xmit_baud)
316#define TABS_OK(str) ((str.tt_char & TT$M_MECHTAB) != 0)
317#endif /* VMS */ 243#endif /* VMS */
318 244
319discard_tty_input () 245discard_tty_input ()
320{ 246{
321 TERMINAL buf; 247 struct emacs_tty buf;
322 248
323 if (noninteractive) 249 if (noninteractive)
324 return; 250 return;
@@ -330,8 +256,8 @@ discard_tty_input ()
330 256
331#ifdef VMS 257#ifdef VMS
332 end_kbd_input (); 258 end_kbd_input ();
333 SYS$QIOW (0, input_chan, IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0, 259 SYS$QIOW (0, input_fd, IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0,
334 &buf, 0, 0, terminator_mask, 0, 0); 260 &buf.main, 0, 0, terminator_mask, 0, 0);
335 queue_kbd_input (); 261 queue_kbd_input ();
336#else /* not VMS */ 262#else /* not VMS */
337#ifdef APOLLO 263#ifdef APOLLO
@@ -340,12 +266,8 @@ discard_tty_input ()
340 ioctl (0, TIOCFLUSH, &zero); 266 ioctl (0, TIOCFLUSH, &zero);
341 } 267 }
342#else /* not Apollo */ 268#else /* not Apollo */
343 tcgetattr (0, &buf); 269 EMACS_GET_TTY (input_fd, &buf);
344#ifndef HAVE_TCATTR 270 EMACS_SET_TTY (input_fd, &buf, 0);
345 ioctl (0, TIOCSETP, &buf);
346#else
347 tcsetattr (0, TCSAFLUSH, &buf);
348#endif
349#endif /* not Apollo */ 271#endif /* not Apollo */
350#endif /* not VMS */ 272#endif /* not VMS */
351} 273}
@@ -367,20 +289,39 @@ stuff_char (c)
367 289
368init_baud_rate () 290init_baud_rate ()
369{ 291{
370 TERMINAL sg;
371
372 if (noninteractive) 292 if (noninteractive)
373 ospeed = 0; 293 ospeed = 0;
374 else 294 else
375 { 295 {
376#ifdef VMS 296#ifdef VMS
377 SYS$QIOW (0, input_chan, IO$_SENSEMODE, &sg, 0, 0, 297 struct sensemode sg;
298
299 SYS$QIOW (0, input_fd, IO$_SENSEMODE, &sg, 0, 0,
378 &sg.class, 12, 0, 0, 0, 0 ); 300 &sg.class, 12, 0, 0, 0, 0 );
379#else 301 ospeed = sg.xmit_baud;
380 SETOSPEED (sg, B9600); 302#else /* not VMS */
303#ifdef HAVE_TERMIO
304 struct termio sg;
305
306 sg.c_cflag = (sg.c_cflag & ~CBAUD) | B9600;
307 tcgetattr (0, &sg);
308 ospeed = sg.c_cflag & CBAUD;
309#else /* neither VMS nor TERMIO */
310#ifdef HAVE_TERMIOS
311 struct termios sg;
312
313 sg.c_cflag = (sg.c_cflag & ~CBAUD) | B9600;
381 tcgetattr (0, &sg); 314 tcgetattr (0, &sg);
315 ospeed = sg.c_cflag & CBAUD;
316#else /* neither VMS nor TERMIO nor TERMIOS */
317 struct sgttyb sg;
318
319 sg.sg_ospeed = B9600;
320 ioctl (0, TIOCGETP, &sg);
321 ospeed = sg.sg_ospeed;
322#endif /* not HAVE_TERMIOS */
323#endif /* not HAVE_TERMIO */
382#endif /* not VMS */ 324#endif /* not VMS */
383 ospeed = OSPEED (sg);
384 } 325 }
385 326
386 baud_rate = (ospeed < sizeof baud_convert / sizeof baud_convert[0] 327 baud_rate = (ospeed < sizeof baud_convert / sizeof baud_convert[0]
@@ -498,57 +439,64 @@ flush_pending_output (channel)
498child_setup_tty (out) 439child_setup_tty (out)
499 int out; 440 int out;
500{ 441{
501 TERMINAL s; 442 struct emacs_tty s;
443
444 EMACS_GET_TTY (out, &s);
502 445
503 tcgetattr (out, &s);
504#ifdef HAVE_TERMIO 446#ifdef HAVE_TERMIO
505 s.c_oflag |= OPOST; /* Enable output postprocessing */ 447 s.main.c_oflag |= OPOST; /* Enable output postprocessing */
506 s.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ 448 s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */
507 s.c_oflag &= ~(NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); /* No output delays */ 449 s.main.c_oflag &= ~(NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
508 s.c_lflag &= ~ECHO; /* Disable echo */ 450 /* No output delays */
509 s.c_lflag |= ISIG; /* Enable signals */ 451 s.main.c_lflag &= ~ECHO; /* Disable echo */
510 s.c_iflag &= ~IUCLC; /* Disable map of upper case to lower on input */ 452 s.main.c_lflag |= ISIG; /* Enable signals */
511 s.c_oflag &= ~OLCUC; /* Disable map of lower case to upper on output */ 453 s.main.c_iflag &= ~IUCLC; /* Disable map of upper case to lower on
512/* said to be unnecesary 454 input */
513 s.c_cc[VMIN] = 1; /* minimum number of characters to accept 455 s.main.c_oflag &= ~OLCUC; /* Disable map of lower case to upper on
514 s.c_cc[VTIME] = 0; /* wait forever for at least 1 character 456 output */
515*/ 457#if 0
516 s.c_lflag |= ICANON; /* Enable erase/kill and eof processing */ 458 /* Said to be unnecesary: */
517 s.c_cc[VEOF] = 04; /* insure that EOF is Control-D */ 459 s.main.c_cc[VMIN] = 1; /* minimum number of characters to accept */
518 s.c_cc[VERASE] = 0377; /* disable erase processing */ 460 s.main.c_cc[VTIME] = 0; /* wait forever for at least 1 character */
519 s.c_cc[VKILL] = 0377; /* disable kill processing */ 461#endif
462
463 s.main.c_lflag |= ICANON; /* Enable erase/kill and eof processing */
464 s.main.c_cc[VEOF] = 04; /* insure that EOF is Control-D */
465 s.main.c_cc[VERASE] = 0377; /* disable erase processing */
466 s.main.c_cc[VKILL] = 0377; /* disable kill processing */
467
520#ifdef HPUX 468#ifdef HPUX
521 s.c_cflag = (s.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */ 469 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */
522#endif /* HPUX */ 470#endif /* HPUX */
471
523#ifdef AIX 472#ifdef AIX
524/* AIX enhanced edit loses NULs, so disable it */ 473/* AIX enhanced edit loses NULs, so disable it */
525#ifndef IBMR2AIX 474#ifndef IBMR2AIX
526 s.c_line = 0; 475 s.main.c_line = 0;
527 s.c_iflag &= ~ASCEDIT; 476 s.main.c_iflag &= ~ASCEDIT;
528#endif 477#endif
529 /* Also, PTY overloads NUL and BREAK. 478 /* Also, PTY overloads NUL and BREAK.
530 don't ignore break, but don't signal either, so it looks like NUL. */ 479 don't ignore break, but don't signal either, so it looks like NUL. */
531 s.c_iflag &= ~IGNBRK; 480 s.main.c_iflag &= ~IGNBRK;
532 s.c_iflag &= ~BRKINT; 481 s.main.c_iflag &= ~BRKINT;
533/* QUIT and INTR work better as signals, so disable character forms */ 482 /* QUIT and INTR work better as signals, so disable character forms */
534 s.c_cc[VQUIT] = 0377; 483 s.main.c_cc[VQUIT] = 0377;
535 s.c_cc[VINTR] = 0377; 484 s.main.c_cc[VINTR] = 0377;
536 s.c_cc[VEOL] = 0377; 485 s.main.c_cc[VEOL] = 0377;
537 s.c_lflag &= ~ISIG; 486 s.main.c_lflag &= ~ISIG;
538 s.c_cflag = (s.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */ 487 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */
539#endif /* AIX */ 488#endif /* AIX */
540 489
541#else /* not HAVE_TERMIO */ 490#else /* not HAVE_TERMIO */
542 s.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE | CBREAK | TANDEM); 491
543 s.sg_erase = 0377; 492 s.main.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE
544 s.sg_kill = 0377; 493 | CBREAK | TANDEM);
494 s.main.sg_erase = 0377;
495 s.main.sg_kill = 0377;
496
545#endif /* not HAVE_TERMIO */ 497#endif /* not HAVE_TERMIO */
546 498
547#ifndef HAVE_TCATTR 499 EMACS_SET_TTY (out, &s, 0);
548 ioctl (out, TIOCSETN, &s);
549#else
550 tcsetattr (out, TCSADRAIN, &s);
551#endif
552 500
553#ifdef BSD4_1 501#ifdef BSD4_1
554 if (interrupt_input) 502 if (interrupt_input)
@@ -569,15 +517,7 @@ child_setup_tty (out)
569setpgrp_of_tty (pid) 517setpgrp_of_tty (pid)
570 int pid; 518 int pid;
571{ 519{
572#ifdef IBMR2AIX 520 EMACS_SET_TTY_PGRP (input_fd, pid);
573 tcsetpgrp ( 0, pid);
574#else
575#ifdef TIOCSPGRP
576 ioctl (0, TIOCSPGRP, &pid);
577#else
578 /* Just ignore this for now and hope for the best */
579#endif
580#endif
581} 521}
582 522
583/* Record a signal code and the handler for it. */ 523/* Record a signal code and the handler for it. */
@@ -617,11 +557,7 @@ sys_suspend ()
617#else 557#else
618#ifdef SIGTSTP 558#ifdef SIGTSTP
619 559
620#ifdef BSD 560 EMACS_KILLPG (getpgrp (0), SIGTSTP);
621 killpg (getpgrp (0), SIGTSTP);
622#else
623 kill (-getpgrp (0), SIGTSTP);
624#endif
625 561
626#else /* No SIGTSTP */ 562#else /* No SIGTSTP */
627#ifdef USG_JOBCTRL /* If you don't know what this is don't mess with it */ 563#ifdef USG_JOBCTRL /* If you don't know what this is don't mess with it */
@@ -790,26 +726,21 @@ unrequest_sigio ()
790#endif /* FASYNC */ 726#endif /* FASYNC */
791#endif /* F_SETFL */ 727#endif /* F_SETFL */
792 728
793TERMINAL old_gtty; /* The initial tty mode bits */ 729/* The initial tty mode bits */
730struct emacs_tty old_tty;
794 731
795int term_initted; /* 1 if outer tty status has been recorded */ 732int term_initted; /* 1 if outer tty status has been recorded */
796 733
734#ifdef BSD4_1
735/* BSD 4.1 needs to keep track of the lmode bits in order to start
736 sigio. */
737int lmode;
738#endif
739
797#ifdef F_SETOWN 740#ifdef F_SETOWN
798int old_fcntl_owner; 741int old_fcntl_owner;
799#endif /* F_SETOWN */ 742#endif /* F_SETOWN */
800 743
801#ifdef TIOCGLTC
802struct ltchars old_ltchars;
803#endif /* TIOCGLTC */
804
805#ifdef TIOCGETC
806struct tchars old_tchars;
807int old_lmode;
808
809int lmode; /* Current lmode value. */
810 /* Needed as global for 4.1 */
811#endif /* TIOCGETC */
812
813/* This may also be defined in stdio, 744/* This may also be defined in stdio,
814 but if so, this does no harm, 745 but if so, this does no harm,
815 and using the same name avoids wasting the other one's space. */ 746 and using the same name avoids wasting the other one's space. */
@@ -829,10 +760,8 @@ static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
829 760
830init_sys_modes () 761init_sys_modes ()
831{ 762{
832 TERMINAL tty; 763 struct emacs_tty tty;
833#ifdef TIOCGETC 764
834 struct tchars tchars;
835#endif
836#ifdef VMS 765#ifdef VMS
837#if 0 766#if 0
838 static int oob_chars[2] = {0, 1 << 7}; /* catch C-g's */ 767 static int oob_chars[2] = {0, 1 << 7}; /* catch C-g's */
@@ -866,115 +795,147 @@ init_sys_modes ()
866 ((unsigned) 1 << (process_ef % 32)); 795 ((unsigned) 1 << (process_ef % 32));
867 timer_eflist = ((unsigned) 1 << (input_ef % 32)) | 796 timer_eflist = ((unsigned) 1 << (input_ef % 32)) |
868 ((unsigned) 1 << (timer_ef % 32)); 797 ((unsigned) 1 << (timer_ef % 32));
869 SYS$QIOW (0, input_chan, IO$_SENSEMODE, &old_gtty, 0, 0,
870 &old_gtty.class, 12, 0, 0, 0, 0);
871#ifndef VMS4_4 798#ifndef VMS4_4
872 sys_access_reinit (); 799 sys_access_reinit ();
873#endif 800#endif
874#else /* not VMS */
875 tcgetattr (0, &old_gtty);
876#endif /* not VMS */ 801#endif /* not VMS */
802
803 EMACS_GET_TTY (input_fd, &old_tty);
804
877 if (!read_socket_hook && EQ (Vwindow_system, Qnil)) 805 if (!read_socket_hook && EQ (Vwindow_system, Qnil))
878 { 806 {
879 tty = old_gtty; 807 tty = old_tty;
880 808
881#ifdef HAVE_TERMIO 809#ifdef HAVE_TERMIO
882 tty.c_iflag |= (IGNBRK); /* Ignore break condition */ 810 tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */
883 tty.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */ 811 tty.main.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */
884#ifdef ISTRIP 812#ifdef ISTRIP
885 tty.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */ 813 tty.main.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */
886#endif 814#endif
887 tty.c_lflag &= ~ECHO; /* Disable echo */ 815 tty.main.c_lflag &= ~ECHO; /* Disable echo */
888 tty.c_lflag &= ~ICANON; /* Disable erase/kill processing */ 816 tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */
889 tty.c_lflag |= ISIG; /* Enable signals */ 817 tty.main.c_lflag |= ISIG; /* Enable signals */
890 if (flow_control) 818 if (flow_control)
891 { 819 {
892 tty.c_iflag |= IXON; /* Enable start/stop output control */ 820 tty.main.c_iflag |= IXON; /* Enable start/stop output control */
893#ifdef IXANY 821#ifdef IXANY
894 tty.c_iflag &= ~IXANY; 822 tty.main.c_iflag &= ~IXANY;
895#endif /* IXANY */ 823#endif /* IXANY */
896 } 824 }
897 else 825 else
898 tty.c_iflag &= ~IXON; /* Disable start/stop output control */ 826 tty.main.c_iflag &= ~IXON; /* Disable start/stop output control */
899 tty.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ 827 tty.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL
900 tty.c_oflag &= ~TAB3; /* Disable tab expansion */ 828 on output */
829 tty.main.c_oflag &= ~TAB3; /* Disable tab expansion */
901#ifdef CS8 830#ifdef CS8
902 if (meta_key) 831 if (meta_key)
903 { 832 {
904 tty.c_cflag |= CS8; /* allow 8th bit on input */ 833 tty.main.c_cflag |= CS8; /* allow 8th bit on input */
905 tty.c_cflag &= ~PARENB;/* Don't check parity */ 834 tty.main.c_cflag &= ~PARENB;/* Don't check parity */
906 } 835 }
907#endif 836#endif
908 tty.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */ 837 tty.main.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */
909 /* Set up C-g for both SIGQUIT and SIGINT. 838 /* Set up C-g for both SIGQUIT and SIGINT.
910 We don't know which we will get, but we handle both alike 839 We don't know which we will get, but we handle both alike
911 so which one it really gives us does not matter. */ 840 so which one it really gives us does not matter. */
912 tty.c_cc[VQUIT] = quit_char; 841 tty.main.c_cc[VQUIT] = quit_char;
913 tty.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ 842 tty.main.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */
914 tty.c_cc[VTIME] = 0; /* no matter how long that takes. */ 843 tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */
915#ifdef VSWTCH 844#ifdef VSWTCH
916 tty.c_cc[VSWTCH] = CDEL; /* Turn off shell layering use of C-z */ 845 tty.main.c_cc[VSWTCH] = CDEL; /* Turn off shell layering use
846 of C-z */
917#endif /* VSWTCH */ 847#endif /* VSWTCH */
918#if defined (mips) || defined (HAVE_TCATTR) 848#if defined (mips) || defined (HAVE_TCATTR)
919 /* The following code looks like the right thing in general, 849 /* The following code looks like the right thing in general,
920 but it is said to cause a crash on USG V.4. 850 but it is said to cause a crash on USG V.4.
921 Let's play safe by turning it on only for the MIPS. */ 851 Let's play safe by turning it on only for the MIPS. */
922#ifdef VSUSP 852#ifdef VSUSP
923 tty.c_cc[VSUSP] = CDEL; /* Turn off mips handling of C-z. */ 853 tty.main.c_cc[VSUSP] = CDEL; /* Turn off mips handling of C-z. */
924#endif /* VSUSP */ 854#endif /* VSUSP */
925#ifdef V_DSUSP 855#ifdef V_DSUSP
926 tty.c_cc[V_DSUSP] = CDEL; /* Turn off mips handling of C-y. */ 856 tty.main.c_cc[V_DSUSP] = CDEL; /* Turn off mips handling of C-y. */
927#endif /* V_DSUSP */ 857#endif /* V_DSUSP */
928#endif /* mips or HAVE_TCATTR */ 858#endif /* mips or HAVE_TCATTR */
929#ifdef AIX 859#ifdef AIX
930#ifndef IBMR2AIX 860#ifndef IBMR2AIX
931 /* AIX enhanced edit loses NULs, so disable it */ 861 /* AIX enhanced edit loses NULs, so disable it */
932 tty.c_line = 0; 862 tty.main.c_line = 0;
933 tty.c_iflag &= ~ASCEDIT; 863 tty.main.c_iflag &= ~ASCEDIT;
934#else 864#else
935 tty.c_cc[VSTRT] = 255; 865 tty.main.c_cc[VSTRT] = 255;
936 tty.c_cc[VSTOP] = 255; 866 tty.main.c_cc[VSTOP] = 255;
937 tty.c_cc[VSUSP] = 255; 867 tty.main.c_cc[VSUSP] = 255;
938 tty.c_cc[VDSUSP] = 255; 868 tty.main.c_cc[VDSUSP] = 255;
939#endif /* IBMR2AIX */ 869#endif /* IBMR2AIX */
940 /* Also, PTY overloads NUL and BREAK. 870 /* Also, PTY overloads NUL and BREAK.
941 don't ignore break, but don't signal either, so it looks like NUL. 871 don't ignore break, but don't signal either, so it looks like NUL.
942 This really serves a purpose only if running in an XTERM window 872 This really serves a purpose only if running in an XTERM window
943 or via TELNET or the like, but does no harm elsewhere. */ 873 or via TELNET or the like, but does no harm elsewhere. */
944 tty.c_iflag &= ~IGNBRK; 874 tty.main.c_iflag &= ~IGNBRK;
945 tty.c_iflag &= ~BRKINT; 875 tty.main.c_iflag &= ~BRKINT;
946#endif 876#endif
947#else /* if not HAVE_TERMIO */ 877#else /* if not HAVE_TERMIO */
948#ifdef VMS 878#ifdef VMS
949 tty.tt_char |= TT$M_NOECHO; 879 tty.main.tt_char |= TT$M_NOECHO;
950 if (meta_key) 880 if (meta_key)
951 tty.tt_char |= TT$M_EIGHTBIT 881 tty.main.tt_char |= TT$M_EIGHTBIT
952 if (flow_control) 882 if (flow_control)
953 tty.tt_char |= TT$M_TTSYNC; 883 tty.main.tt_char |= TT$M_TTSYNC;
954 else 884 else
955 tty.tt_char &= ~TT$M_TTSYNC; 885 tty.main.tt_char &= ~TT$M_TTSYNC;
956 tty.tt2_char |= TT2$M_PASTHRU | TT2$M_XON; 886 tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON;
957#else /* not VMS (BSD, that is) */ 887#else /* not VMS (BSD, that is) */
958 tty.sg_flags &= ~(ECHO | CRMOD | XTABS); 888 tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
959 if (meta_key) 889 if (meta_key)
960 tty.sg_flags |= ANYP; 890 tty.main.sg_flags |= ANYP;
961 tty.sg_flags |= interrupt_input ? RAW : CBREAK; 891 tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
962#endif /* not VMS (BSD, that is) */ 892#endif /* not VMS (BSD, that is) */
963#endif /* not HAVE_TERMIO */ 893#endif /* not HAVE_TERMIO */
964 894
965#ifdef VMS 895 /* If going to use CBREAK mode, we must request C-g to interrupt
966 SYS$QIOW (0, input_chan, IO$_SETMODE, &input_iosb, 0, 0, 896 and turn off start and stop chars, etc. If not going to use
967 &tty.class, 12, 0, 0, 0, 0); 897 CBREAK mode, do this anyway so as to turn off local flow
968#else 898 control for user coming over network on 4.2; in this case,
969#ifndef HAVE_TCATTR 899 only t_stopc and t_startc really matter. */
970 ioctl (0, TIOCSETN, &tty); 900#ifndef HAVE_TERMIO
971#else 901#ifdef TIOCGETC
972 tcsetattr (0, TCSADRAIN, &tty); 902 /* Note: if not using CBREAK mode, it makes no difference how we
903 set this */
904 tty.tchars = new_tchars;
905 tty.tchars.t_intrc = quit_char;
906 if (flow_control)
907 {
908 tty.tchars.t_startc = '\021';
909 tty.tchars.t_stopc = '\023';
910 }
911
912/* LPASS8 is new in 4.3, and makes cbreak mode provide all 8 bits. */
913#ifndef LPASS8
914#define LPASS8 0
973#endif 915#endif
974#endif /* not VMS */ 916
917#ifdef BSD4_1
918#define LNOFLSH 0100000
919#endif
920
921 tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | old_tty.lmode;
922
923#ifdef BSD4_1
924 lmode = tty.lmode;
925#endif
926
927#endif /* TIOCGETC */
928#endif /* not HAVE_TERMIO */
929
930#ifdef TIOCGLTC
931 tty.ltchars = new_ltchars;
932#endif /* TIOCGLTC */
933
934 EMACS_SET_TTY (input_fd, &tty, 0);
975 935
976 /* This code added to insure that, if flow-control is not to be used, 936 /* This code added to insure that, if flow-control is not to be used,
977 we have an unlocked screen at the start. */ 937 we have an unlocked screen at the start. */
938
978#ifdef TCXONC 939#ifdef TCXONC
979 if (!flow_control) ioctl (0, TCXONC, 1); 940 if (!flow_control) ioctl (0, TCXONC, 1);
980#endif 941#endif
@@ -998,49 +959,9 @@ init_sys_modes ()
998#endif 959#endif
999#endif 960#endif
1000 961
1001 /* If going to use CBREAK mode, we must request C-g to interrupt
1002 and turn off start and stop chars, etc. If not going to use
1003 CBREAK mode, do this anyway so as to turn off local flow
1004 control for user coming over network on 4.2; in this case,
1005 only t_stopc and t_startc really matter. */
1006#ifdef TIOCGLTC
1007 ioctl (0, TIOCGLTC, &old_ltchars);
1008#endif /* TIOCGLTC */
1009#ifndef HAVE_TERMIO
1010#ifdef TIOCGETC
1011 ioctl (0, TIOCGETC, &old_tchars);
1012 ioctl (0, TIOCLGET, &old_lmode);
1013
1014 /* Note: if not using CBREAK mode, it makes no difference how we set this */
1015 tchars = new_tchars;
1016 tchars.t_intrc = quit_char;
1017 if (flow_control)
1018 {
1019 tchars.t_startc = '\021';
1020 tchars.t_stopc = '\023';
1021 }
1022/* LPASS8 is new in 4.3, and makes cbreak mode provide all 8 bits. */
1023#ifndef LPASS8
1024#define LPASS8 0
1025#endif
1026
1027#ifdef BSD4_1
1028#define LNOFLSH 0100000
1029#endif
1030
1031 lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | old_lmode;
1032
1033 ioctl (0, TIOCSETC, &tchars);
1034 ioctl (0, TIOCLSET, &lmode);
1035#endif /* TIOCGETC */
1036#endif /* not HAVE_TERMIO */
1037#ifdef TIOCGLTC
1038 ioctl (0, TIOCSLTC, &new_ltchars);
1039#endif /* TIOCGLTC */
1040
1041#ifdef VMS 962#ifdef VMS
1042/* Appears to do nothing when in PASTHRU mode. 963/* Appears to do nothing when in PASTHRU mode.
1043 SYS$QIOW (0, input_chan, IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, 964 SYS$QIOW (0, input_fd, IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0,
1044 interrupt_signal, oob_chars, 0, 0, 0, 0); 965 interrupt_signal, oob_chars, 0, 0, 0, 0);
1045*/ 966*/
1046 queue_kbd_input (0); 967 queue_kbd_input (0);
@@ -1088,6 +1009,7 @@ init_sys_modes ()
1088 SCREEN_GARBAGED_P (XSCREEN (Vterminal_screen)) = 1; 1009 SCREEN_GARBAGED_P (XSCREEN (Vterminal_screen)) = 1;
1089#endif 1010#endif
1090 } 1011 }
1012
1091 term_initted = 1; 1013 term_initted = 1;
1092} 1014}
1093 1015
@@ -1096,16 +1018,10 @@ init_sys_modes ()
1096 1018
1097tabs_safe_p () 1019tabs_safe_p ()
1098{ 1020{
1099 TERMINAL tty; 1021 struct emacs_tty tty;
1100 if (noninteractive) 1022
1101 return 1; 1023 EMACS_GET_TTY (input_fd, &tty);
1102#ifdef VMS 1024 return EMACS_TTY_TABS_OK (&tty);
1103 SYS$QIOW (0, input_chan, IO$_SENSEMODE, &tty, 0, 0,
1104 &tty.class, 12, 0, 0, 0, 0);
1105#else
1106 tcgetattr (0, &tty);
1107#endif /* not VMS */
1108 return (TABS_OK (tty));
1109} 1025}
1110 1026
1111/* Get terminal size from system. 1027/* Get terminal size from system.
@@ -1115,40 +1031,57 @@ tabs_safe_p ()
1115get_screen_size (widthp, heightp) 1031get_screen_size (widthp, heightp)
1116 int *widthp, *heightp; 1032 int *widthp, *heightp;
1117{ 1033{
1118/* Define the 4.3 names in terms of the Sun names
1119 if the latter exist and the former do not. */
1120#ifdef TIOCGSIZE
1121#ifndef TIOCGWINSZ
1122#define TIOCGWINSZ TIOCGSIZE
1123#define winsize ttysize
1124#define ws_row ts_lines
1125#define ws_col ts_cols
1126#endif
1127#endif /* Sun */
1128 1034
1129/* Do it using the 4.3 names if possible. */
1130#ifdef TIOCGWINSZ 1035#ifdef TIOCGWINSZ
1036
1037 /* BSD-style. */
1131 struct winsize size; 1038 struct winsize size;
1132 *widthp = 0; 1039
1133 *heightp = 0; 1040 if (ioctl (input_fd, TIOCGWINSZ, &size) == -1)
1134 if (ioctl (0, TIOCGWINSZ, &size) < 0) 1041 *widthp = *heightp = 0;
1135 return; 1042 else
1136 *widthp = size.ws_col; 1043 {
1137 *heightp = size.ws_row; 1044 *widthp = size.ws_col;
1138#else /* not TIOCGWNSIZ */ 1045 *heightp = size.ws_row;
1046 }
1047
1048#else
1049#ifdef TIOCGSIZE
1050
1051 /* SunOS - style. */
1052 struct ttysize size;
1053
1054 if (ioctl (input_fd, TIOCGSIZE, &size) == -1)
1055 *widthp = *heightp = 0;
1056 else
1057 {
1058 *widthp = size.ts_cols;
1059 *heightp = size.ts_lines;
1060 }
1061
1062#else
1139#ifdef VMS 1063#ifdef VMS
1140 TERMINAL tty; 1064
1141 SYS$QIOW (0, input_chan, IO$_SENSEMODE, &tty, 0, 0, 1065 struct sensemode tty;
1066
1067 SYS$QIOW (0, input_fd, IO$_SENSEMODE, &tty, 0, 0,
1142 &tty.class, 12, 0, 0, 0, 0); 1068 &tty.class, 12, 0, 0, 0, 0);
1143 *widthp = tty.scr_wid; 1069 *widthp = tty.scr_wid;
1144 *heightp = tty.scr_len; 1070 *heightp = tty.scr_len;
1071
1145#else /* system doesn't know size */ 1072#else /* system doesn't know size */
1073
1146 *widthp = 0; 1074 *widthp = 0;
1147 *heightp = 0; 1075 *heightp = 0;
1148#endif /* system does not know size */ 1076
1149#endif /* not TIOCGWINSZ */ 1077#endif /* not VMS */
1078#endif /* not SunOS-style */
1079#endif /* not BSD-style */
1150} 1080}
1081
1151 1082
1083/* Prepare the terminal for exiting Emacs; move the cursor to the
1084 bottom of the screen, turn off interrupt-driven I/O, etc. */
1152reset_sys_modes () 1085reset_sys_modes ()
1153{ 1086{
1154 if (noninteractive) 1087 if (noninteractive)
@@ -1183,15 +1116,7 @@ reset_sys_modes ()
1183 fsync (fileno (stdout)); 1116 fsync (fileno (stdout));
1184#endif 1117#endif
1185#endif 1118#endif
1186#ifdef TIOCGLTC 1119
1187 ioctl (0, TIOCSLTC, &old_ltchars);
1188#endif /* TIOCGLTC */
1189#ifndef HAVE_TERMIO
1190#ifdef TIOCGETC
1191 ioctl (0, TIOCSETC, &old_tchars);
1192 ioctl (0, TIOCLSET, &old_lmode);
1193#endif /* TIOCGETC */
1194#endif /* not HAVE_TERMIO */
1195#ifdef F_SETFL 1120#ifdef F_SETFL
1196#ifdef F_SETOWN /* F_SETFL does not imply existance of F_SETOWN */ 1121#ifdef F_SETOWN /* F_SETFL does not imply existance of F_SETOWN */
1197 if (interrupt_input) 1122 if (interrupt_input)
@@ -1205,17 +1130,9 @@ reset_sys_modes ()
1205 if (interrupt_input) 1130 if (interrupt_input)
1206 reset_sigio (); 1131 reset_sigio ();
1207#endif /* BSD4_1 */ 1132#endif /* BSD4_1 */
1208#ifdef VMS 1133
1209 end_kbd_input (); 1134 while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR)
1210 SYS$QIOW (0, input_chan, IO$_SETMODE, &input_iosb, 0, 0, 1135 ;
1211 &old_gtty.class, 12, 0, 0, 0, 0);
1212#else /* not VMS */
1213#ifndef HAVE_TCATTR
1214 while (ioctl (0, TCSETAW, &old_gtty) < 0 && errno == EINTR);
1215#else
1216 while (tcsetattr (0, TCSADRAIN, &old_gtty) < 0 && errno == EINTR);
1217#endif
1218#endif /* not VMS */
1219 1136
1220#ifdef AIX 1137#ifdef AIX
1221 hft_reset (); 1138 hft_reset ();
@@ -1281,9 +1198,9 @@ init_vms_input ()
1281{ 1198{
1282 int status; 1199 int status;
1283 1200
1284 if (input_chan == 0) 1201 if (input_fd == 0)
1285 { 1202 {
1286 status = SYS$ASSIGN (&input_dsc, &input_chan, 0, 0); 1203 status = SYS$ASSIGN (&input_dsc, &input_fd, 0, 0);
1287 if (! (status & 1)) 1204 if (! (status & 1))
1288 LIB$STOP (status); 1205 LIB$STOP (status);
1289 } 1206 }
@@ -1293,7 +1210,7 @@ init_vms_input ()
1293 1210
1294stop_vms_input () 1211stop_vms_input ()
1295{ 1212{
1296 return SYS$DASSGN (input_chan); 1213 return SYS$DASSGN (input_fd);
1297} 1214}
1298 1215
1299short input_buffer; 1216short input_buffer;
@@ -1306,7 +1223,7 @@ queue_kbd_input ()
1306 int status; 1223 int status;
1307 waiting_for_ast = 0; 1224 waiting_for_ast = 0;
1308 stop_input = 0; 1225 stop_input = 0;
1309 status = SYS$QIO (0, input_chan, IO$_READVBLK, 1226 status = SYS$QIO (0, input_fd, IO$_READVBLK,
1310 &input_iosb, kbd_input_ast, 1, 1227 &input_iosb, kbd_input_ast, 1,
1311 &input_buffer, 1, 0, terminator_mask, 0, 0); 1228 &input_buffer, 1, 0, terminator_mask, 0, 0);
1312} 1229}
@@ -1418,7 +1335,7 @@ end_kbd_input ()
1418#endif 1335#endif
1419 if (LIB$AST_IN_PROG ()) /* Don't wait if suspending from kbd_buffer_store_event! */ 1336 if (LIB$AST_IN_PROG ()) /* Don't wait if suspending from kbd_buffer_store_event! */
1420 { 1337 {
1421 SYS$CANCEL (input_chan); 1338 SYS$CANCEL (input_fd);
1422 return; 1339 return;
1423 } 1340 }
1424 1341
@@ -1427,7 +1344,7 @@ end_kbd_input ()
1427 SYS$CLREF (input_ef); 1344 SYS$CLREF (input_ef);
1428 waiting_for_ast = 1; 1345 waiting_for_ast = 1;
1429 stop_input = 1; 1346 stop_input = 1;
1430 SYS$CANCEL (input_chan); 1347 SYS$CANCEL (input_fd);
1431 SYS$SETAST (1); 1348 SYS$SETAST (1);
1432 SYS$WAITFR (input_ef); 1349 SYS$WAITFR (input_ef);
1433 waiting_for_ast = 0; 1350 waiting_for_ast = 0;
@@ -2826,7 +2743,7 @@ readdirver (dirp)
2826 2743
2827/* Functions for VMS */ 2744/* Functions for VMS */
2828#ifdef VMS 2745#ifdef VMS
2829#include "pwd.h" 2746#include "vms-pwd.h"
2830#include <acldef.h> 2747#include <acldef.h>
2831#include <chpdef.h> 2748#include <chpdef.h>
2832#include <jpidef.h> 2749#include <jpidef.h>
diff --git a/src/unexec.c b/src/unexec.c
index 4d4cf20fd55..5417f760467 100644
--- a/src/unexec.c
+++ b/src/unexec.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc. 1/* Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc.
2 2
3This file is part of GNU Emacs. 3This file is part of GNU Emacs.
4 4
@@ -995,7 +995,7 @@ adjust_lnnoptrs (writedesc, readdesc, new_name)
995{ 995{
996 register int nsyms; 996 register int nsyms;
997 register int new; 997 register int new;
998#ifdef amdahl_uts 998#if defined (amdahl_uts) || defined (pfa)
999 SYMENT symentry; 999 SYMENT symentry;
1000 AUXENT auxentry; 1000 AUXENT auxentry;
1001#else 1001#else