chip@tct.uucp (Chip Salzenberg) (02/07/91)
Enclosed are patches to Emacs 18.56 for SCO UNIX 3.2v2. Despite this being a port to SCO UNIX, I have made every effort to create patches that are portable to other systems. In particular: * The use of POSIX terminal control is now controlled by the HAVE_TERMIOS macro, instead of the old dependence on IBMR2AIX. * The return type of signal handlers has been factored out into the SIGTYPE macro. With these patches, config.h-dist defines SIGTYPE as "int" if it is not otherwise defined; this hack allows you to use old configuration files that do not define SIGTYPE. SCO UNIX users should (1) apply the enclosed patches, (2) rename the enclosed config.h-sco to config.h, and (3) comment out the inclusion of <sys/sioctl.h> in sysdep.c. I also recommend the use of GCC. By default, the enclosed configuration file config.h-sco enables job control. Note that to use job control you must use the Korn shell or else get a working version of the Bourne Again Shell (bash). If you do not wish to support job control, you will need to undefine the job-control-related signals in config.h (change "#if 0" to "#if 1" in config.h-sco) and comment out the call to tcsetpgrp() in sysdep.c. Other changes may also be required. (I haven't tried it; I love job control). Shar and enjoy. -- Chip Salzenberg <chip@tct.uucp> #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: config.h-sco emacs.pat-sco # Wrapped by chip@tct on Wed Feb 6 13:21:51 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'config.h-sco' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'config.h-sco'\" else echo shar: Extracting \"'config.h-sco'\" \(4556 characters\) sed "s/^X//" >'config.h-sco' <<'END_OF_FILE' X/* GNU Emacs site configuration template file. X Copyright (C) 1988 Free Software Foundation, Inc. X XThis file is part of GNU Emacs. X XGNU Emacs is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License as published by Xthe Free Software Foundation; either version 1, or (at your option) Xany later version. X XGNU Emacs is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X XYou should have received a copy of the GNU General Public License Xalong with GNU Emacs; see the file COPYING. If not, write to Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ X X X X/* Include here a s- file that describes the system type you are using. X See the file ../etc/MACHINES for a list of systems and X the names of the s- files to use for them. X See s-template.h for documentation on writing s- files. */ X#include "s-usg5-3.h" X X/* Include here a m- file that describes the machine and system you use. X See the file ../etc/MACHINES for a list of machines and X the names of the m- files to use for them. X See m-template.h for info on what m- files should define. X */ X#include "m-intel386.h" X X/**** BEGIN TCT CHANGES ****/ X X/* We installed ptys for Emacs as /dev/[pt]tyc? */ X#undef FIRST_PTY_LETTER X#define FIRST_PTY_LETTER 'c' X#define HAVE_PTYS X X/* SCO Unix doesn't have load averages */ X#undef LDAV_SYMBOL X X/* We use termcap */ X#undef TERMINFO X X/* We use gcc, but no debugging */ X#define C_COMPILER gcc X#define C_OPTIMIZE_SWITCH -O X#define C_DEBUG_SWITCH X#undef LIB_STANDARD X#define LIB_STANDARD /u/local/lib/gcc-gnulib -lintl -lc X X/* gcc has alloca() built in */ X#undef alloca X#define alloca __builtin_alloca X X/* Our C library includes rename, but it's BROKEN */ X#undef HAVE_RENAME X X/* We need <sys/ptem.h> for "struct winsize" */ X#define NEED_PTEM_H X X/* We have the POSIX terminal control functions, termios (with an "s") */ X#define HAVE_TERMIOS X X/* The kernel supports job control, and so does the shell, now. */ X#if 0 X# undef SIGTSTP X# undef SIGSTOP X# undef SIGCONT X# undef SIGTTIN X# undef SIGTTOU X# define NOPGRP X#endif X X/**** END TCT CHANGES ****/ X X/* Load in the conversion definitions if this system X needs them and the source file being compiled has not X said to inhibit this. There should be no need for you X to alter these lines. */ X X#ifdef SHORTNAMES X#ifndef NO_SHORTNAMES X#include "../shortnames/remap.h" X#endif /* not NO_SHORTNAMES */ X#endif /* SHORTNAMES */ X X/* Define the return type of signal handlers if the s-xxx file X did not already do so. */ X#ifndef SIGTYPE X#define SIGTYPE int X#endif X X/* Define HAVE_X_WINDOWS if you want to use the X window system. */ X X/* #define HAVE_X_WINDOWS */ X X/* Define X11 if you want to use version 11 of X windows. X Otherwise, Emacs expects to use version 10. */ X X/* #define X11 */ X X/* Define HAVE_X_MENU if you want to use the X window menu system. X This appears to work on some machines that support X X and not on others. */ X X/* #define HAVE_X_MENU */ X X/* Define `subprocesses' should be defined if you want to X have code for asynchronous subprocesses X (as used in M-x compile and M-x shell). X These do not work for some USG systems yet; X for the ones where they work, the s-*.h file defines this flag. */ X X#ifndef VMS X#ifndef USG X#define subprocesses X#endif X#endif X X/* Define USER_FULL_NAME to return a string X that is the user's full name. X It can assume that the variable `pw' X points to the password file entry for this user. X X At some sites, the pw_gecos field contains X the user's full name. If neither this nor any other X field contains the right thing, use pw_name, X giving the user's login name, since that is better than nothing. */ X X#define USER_FULL_NAME pw->pw_gecos X X/* Define AMPERSAND_FULL_NAME if you use the convention X that & in the full name stands for the login id. */ X X#define AMPERSAND_FULL_NAME X X/* # bytes of pure Lisp code to leave space for. X Note that s-vms.h and m-sun2.h may override this default. */ X X#ifndef PURESIZE X#ifdef HAVE_X_WINDOWS X#define PURESIZE 122000 X#else X#define PURESIZE 119000 X#endif X#endif X X/* Define HIGHPRI as a negative number X if you want Emacs to run at a higher than normal priority. X For this to take effect, you must install Emacs with setuid root. X Emacs will change back to the users's own uid after setting X its priority. */ X X/* #define HIGHPRI */ X END_OF_FILE if test 4556 -ne `wc -c <'config.h-sco'`; then echo shar: \"'config.h-sco'\" unpacked with wrong size! fi # end of 'config.h-sco' fi if test -f 'emacs.pat-sco' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'emacs.pat-sco'\" else echo shar: Extracting \"'emacs.pat-sco'\" \(12521 characters\) sed "s/^X//" >'emacs.pat-sco' <<'END_OF_FILE' X*** config.h-d.P Tue Jan 8 13:24:37 1991 X--- config.h-dist Wed Feb 6 11:49:48 1991 X*************** X*** 44,47 **** X--- 44,53 ---- X #endif /* SHORTNAMES */ X X+ /* Define the return type of signal handlers if the s-xxx file X+ did not already do so. */ X+ #ifndef SIGTYPE X+ #define SIGTYPE int X+ #endif X+ X /* Define HAVE_X_WINDOWS if you want to use the X window system. */ X X X*** s-aix3-1.h.P Tue Jan 8 13:02:50 1991 X--- s-aix3-1.h Wed Feb 6 12:01:58 1991 X*************** X*** 78,81 **** X--- 78,88 ---- X X /* X+ * Define HAVE_TERMIOS if the system provides POSIX-style X+ * terminal control. (HAVE_TERMIO is still required.) X+ */ X+ X+ #define HAVE_TERMIOS X+ X+ /* X * Define HAVE_TIMEVAL if the system supports the BSD style clock values. X * Look in <sys/time.h> for a timeval structure. X X*** s-usg5-3.h.P Fri Jan 11 18:23:02 1991 X--- s-usg5-3.h Wed Feb 6 11:50:45 1991 X*************** X*** 180,183 **** X--- 180,187 ---- X #define INTERRUPTABLE_IO X X+ /* On USG systems signal handlers return void */ X+ X+ #define SIGTYPE void X+ X /* On USG systems these have different names */ X X X*** dispnew.c.P Tue Jan 8 12:25:28 1991 X--- dispnew.c Wed Feb 6 11:26:46 1991 X*************** X*** 1186,1189 **** X--- 1186,1190 ---- X X #ifdef SIGWINCH X+ SIGTYPE X window_change_signal () X { X X*** emacs.c.P Fri Jan 11 22:16:31 1991 X--- emacs.c Wed Feb 6 11:27:04 1991 X*************** X*** 105,108 **** X--- 105,109 ---- X X /* Handle bus errors, illegal instruction, etc. */ X+ SIGTYPE X fatal_error_signal (sig) X int sig; X X*** data.c.P Fri Jan 4 19:15:14 1991 X--- data.c Wed Feb 6 11:45:03 1991 X*************** X*** 1550,1553 **** X--- 1550,1554 ---- X } X X+ SIGTYPE X arith_error (signo) X int signo; X X*** keyboard.c.P Tue Jan 8 20:40:31 1991 X--- keyboard.c Wed Feb 6 11:30:44 1991 X*************** X*** 793,796 **** X--- 793,797 ---- X X /* Alarm interrupt calls this and requests echoing at earliest safe time. */ X+ SIGTYPE X request_echo () X { X*************** X*** 900,904 **** X Lisp_Object tem; X jmp_buf save_jump; X- extern request_echo (); X X if (unread_command_char >= 0) X--- 901,904 ---- X*************** X*** 1073,1076 **** X--- 1073,1077 ---- X || ((c == (0200 | quit_char)) && !meta_key)) X { X+ extern SIGTYPE interrupt_signal (); X interrupt_signal (); X return; X*************** X*** 1945,1948 **** X--- 1946,1950 ---- X If quit-flag is already non-nil, it stops the job right away. */ X X+ SIGTYPE X interrupt_signal () X { X X*** process.c.P Tue Jan 15 20:28:48 1991 X--- process.c Wed Feb 6 11:46:28 1991 X*************** X*** 977,980 **** X--- 977,981 ---- X } X X+ SIGTYPE X create_process_1 (signo) X int signo; X*************** X*** 1012,1016 **** X int sv[2]; X #ifdef SIGCHLD X! int (*sigchld)(); X #endif X char **env; X--- 1013,1017 ---- X int sv[2]; X #ifdef SIGCHLD X! SIGTYPE (*sigchld)(); X #endif X char **env; X*************** X*** 1109,1113 **** X #if 0 X sigchld_deferred = 0; X! sigchld = (int (*)()) signal (SIGCHLD, create_process_sigchld); X #endif X #endif /* ordinary USG */ X--- 1110,1114 ---- X #if 0 X sigchld_deferred = 0; X! sigchld = signal (SIGCHLD, create_process_sigchld); X #endif X #endif /* ordinary USG */ X*************** X*** 1877,1880 **** X--- 1878,1882 ---- X jmp_buf send_process_frame; X X+ SIGTYPE X send_process_trap () X { X*************** X*** 2187,2190 **** X--- 2189,2193 ---- X the SIGCLD queue. Fred Fish, UniSoft Systems Inc. */ X X+ SIGTYPE X sigchld_handler (signo) X int signo; X X*** sysdep.c.P Tue Jan 15 21:43:59 1991 X--- sysdep.c Wed Feb 6 11:34:32 1991 X*************** X*** 118,148 **** X X #ifdef HAVE_TERMIO X! #ifdef IBMR2AIX X! #include <termio.h> X #include <termios.h> X! #ifdef TIOCGETP X! #undef TIOCGETP X! #endif X! #define TIOCGETP TCGETS X! #undef TIOCSETN X! #define TIOCSETN TCSETSW X! #undef TIOCSETP X! #define TIOCSETP TCSETSF X! #undef TCSETAW X! #define TCSETAW TCSETS X #else X #include <termio.h> X- #undef TIOCGETP X- #define TIOCGETP TCGETA X- #undef TIOCSETN X- #define TIOCSETN TCSETAW X- #undef TIOCSETP X- #define TIOCSETP TCSETAF X- #endif X- X- #ifndef IBMR2AIX X #define TERMINAL struct termio X! #else X! #define TERMINAL struct termios X #endif X X--- 118,134 ---- X X #ifdef HAVE_TERMIO X! X! #ifdef HAVE_TERMIOS X #include <termios.h> X! #define TERMINAL struct termios X! #define term_get(fd,t) tcgetattr(fd,t) X! #define term_set(fd,t) tcsetattr(fd,TCSANOW,t) X! #define term_setw(fd,t) tcsetattr(fd,TCSADRAIN,t) X #else X #include <termio.h> X #define TERMINAL struct termio X! #define term_get(fd,t) ioctl(fd,TCGETA,t) X! #define term_set(fd,t) ioctl(fd,TCSETA,t) X! #define term_setw(fd,t) ioctl(fd,TCSETAW,t) X #endif X X*************** X*** 164,172 **** X #include <sgtty.h> X #define TERMINAL struct sgttyb X #define OSPEED(str) str.sg_ospeed X #define SETOSPEED(str,new) (str.sg_ospeed = (new)) X #define TABS_OK(str) ((str.sg_flags & XTABS) != XTABS) X- #undef TCSETAW X- #define TCSETAW TIOCSETN X #endif /* not VMS */ X #endif /* not HAVE_TERMIO */ X--- 150,159 ---- X #include <sgtty.h> X #define TERMINAL struct sgttyb X+ #define term_get(fd,t) ioctl(fd,TIOCGETP,t) X+ #define term_set(fd,t) ioctl(fd,TIOCSETP,t) X+ #define term_setw(fd,t) ioctl(fd,TIOCSETN,t) X #define OSPEED(str) str.sg_ospeed X #define SETOSPEED(str,new) (str.sg_ospeed = (new)) X #define TABS_OK(str) ((str.sg_flags & XTABS) != XTABS) X #endif /* not VMS */ X #endif /* not HAVE_TERMIO */ X*************** X*** 322,327 **** X queue_kbd_input (); X #else /* not VMS */ X! ioctl (0, TIOCGETP, &buf); X! ioctl (0, TIOCSETP, &buf); X #endif /* not VMS */ X } X--- 309,314 ---- X queue_kbd_input (); X #else /* not VMS */ X! term_get (0, &buf); X! term_set (0, &buf); X #endif /* not VMS */ X } X*************** X*** 355,359 **** X #else X SETOSPEED (sg, B9600); X! ioctl (0, TIOCGETP, &sg); X #endif /* not VMS */ X ospeed = OSPEED (sg); X--- 342,346 ---- X #else X SETOSPEED (sg, B9600); X! term_get (0, &sg); X #endif /* not VMS */ X ospeed = OSPEED (sg); X*************** X*** 470,473 **** X--- 457,463 ---- X int channel; X { X+ #ifdef HAVE_TERMIOS X+ tcflush (channel, TCOFLUSH); X+ #else X #ifdef TCFLSH X ioctl (channel, TCFLSH, 1); X*************** X*** 481,484 **** X--- 471,475 ---- X #endif X #endif X+ #endif X } X X*************** X*** 493,497 **** X TERMINAL s; X X! ioctl (out, TIOCGETP, &s); X #ifdef HAVE_TERMIO X s.c_oflag |= OPOST; /* Enable output postprocessing */ X--- 484,488 ---- X TERMINAL s; X X! term_get (out, &s); X #ifdef HAVE_TERMIO X s.c_oflag |= OPOST; /* Enable output postprocessing */ X*************** X*** 510,513 **** X--- 501,510 ---- X s.c_cc[VERASE] = 0377; /* disable erase processing */ X s.c_cc[VKILL] = 0377; /* disable kill processing */ X+ #ifdef VSUSP X+ s.c_cc[VSUSP] = 0377; /* disable suspend processing */ X+ #endif X+ #ifdef VDSUSP X+ s.c_cc[VDSUSP] = 0377; /* disable delayed suspend processing */ X+ #endif X #ifdef HPUX X s.c_cflag = (s.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */ X*************** X*** 536,540 **** X #endif /* not HAVE_TERMIO */ X X! ioctl (out, TIOCSETN, &s); X X #ifdef BSD4_1 X--- 533,537 ---- X #endif /* not HAVE_TERMIO */ X X! term_setw (out, &s); X X #ifdef BSD4_1 X*************** X*** 556,560 **** X int pid; X { X! #ifdef IBMR2AIX X tcsetpgrp ( 0, pid); X #else X--- 553,557 ---- X int pid; X { X! #ifdef HAVE_TERMIOS X tcsetpgrp ( 0, pid); X #else X*************** X*** 571,575 **** X { X int code; X! int (*handler) (); X }; X X--- 568,572 ---- X { X int code; X! SIGTYPE (*handler) (); X }; X X*************** X*** 675,680 **** X while (saved_handlers->code) X { X! saved_handlers->handler X! = (int (*) ()) signal (saved_handlers->code, SIG_IGN); X saved_handlers++; X } X--- 672,676 ---- X while (saved_handlers->code) X { X! saved_handlers->handler = signal (saved_handlers->code, SIG_IGN); X saved_handlers++; X } X*************** X*** 844,848 **** X #endif X #else /* not VMS */ X! ioctl (0, TIOCGETP, &old_gtty); X #endif /* not VMS */ X if (!read_socket_hook) X--- 840,844 ---- X #endif X #else /* not VMS */ X! term_get (0, &old_gtty); X #endif /* not VMS */ X if (!read_socket_hook) X*************** X*** 884,897 **** X tty.c_cc[VSWTCH] = CDEL; /* Turn off shell layering use of C-z */ X #endif /* VSWTCH */ X! #ifdef mips /* The following code looks like the right thing in general, X! but it is said to cause a crash on USG V.4. X! Let's play safe by turning it on only for the MIPS. */ X #ifdef VSUSP X! tty.c_cc[VSUSP] = CDEL; /* Turn off mips handling of C-z. */ X #endif /* VSUSP */ X #ifdef V_DSUSP X tty.c_cc[V_DSUSP] = CDEL; /* Turn off mips handling of C-y. */ X #endif /* V_DSUSP */ X- #endif /* mips */ X X #ifdef AIX X--- 880,900 ---- X tty.c_cc[VSWTCH] = CDEL; /* Turn off shell layering use of C-z */ X #endif /* VSWTCH */ X! /* The following code looks like the right thing in general, X! which it is; SysVr4 can go jump in a lake if it crashes. */ X! #ifdef VSTRT X! tty.c_cc[VSTRT] = CDEL; /* Turn off handling of C-s. */ X! #endif /* VSTRT */ X! #ifdef VSTOP X! tty.c_cc[VSTOP] = CDEL; /* Turn off handling of C-q. */ X! #endif /* VSTOP */ X #ifdef VSUSP X! tty.c_cc[VSUSP] = CDEL; /* Turn off handling of C-z. */ X #endif /* VSUSP */ X+ #ifdef VDSUSP X+ tty.c_cc[VDSUSP] = CDEL; /* Turn off handling of C-y. */ X+ #endif /* VDSUSP */ X #ifdef V_DSUSP X tty.c_cc[V_DSUSP] = CDEL; /* Turn off mips handling of C-y. */ X #endif /* V_DSUSP */ X X #ifdef AIX X*************** X*** 900,908 **** X tty.c_line = 0; X tty.c_iflag &= ~ASCEDIT; X- #else X- tty.c_cc[VSTRT] = 255; X- tty.c_cc[VSTOP] = 255; X- tty.c_cc[VSUSP] = 255; X- tty.c_cc[VDSUSP] = 255; X #endif /* IBMR2AIX */ X /* Also, PTY overloads NUL and BREAK. X--- 903,906 ---- X*************** X*** 933,937 **** X &tty.class, 12, 0, 0, 0, 0); X #else X! ioctl (0, TIOCSETN, &tty); X #endif /* not VMS */ X X--- 931,935 ---- X &tty.class, 12, 0, 0, 0, 0); X #else X! term_setw (0, &tty); X #endif /* not VMS */ X X*************** X*** 938,947 **** X /* This code added to insure that, if flow-control is not to be used, X we have an unlocked screen at the start. */ X #ifdef TCXONC X if (!flow_control) ioctl (0, TCXONC, 1); X! #endif X #ifdef TIOCSTART X if (!flow_control) ioctl (0, TIOCSTART, 0); X #endif X X #ifdef AIX X--- 936,950 ---- X /* This code added to insure that, if flow-control is not to be used, X we have an unlocked screen at the start. */ X+ #ifdef HAVE_TERMIOS X+ if (!flow_control) tcflow (0, TCOON); X+ #else X #ifdef TCXONC X if (!flow_control) ioctl (0, TCXONC, 1); X! #else X #ifdef TIOCSTART X if (!flow_control) ioctl (0, TIOCSTART, 0); X #endif X+ #endif X+ #endif X X #ifdef AIX X*************** X*** 1056,1060 **** X &tty.class, 12, 0, 0, 0, 0); X #else X! ioctl (0, TIOCGETP, &tty); X #endif /* not VMS */ X return (TABS_OK(tty)); X--- 1059,1063 ---- X &tty.class, 12, 0, 0, 0, 0); X #else X! term_get (0, &tty); X #endif /* not VMS */ X return (TABS_OK(tty)); X*************** X*** 1165,1169 **** X &old_gtty.class, 12, 0, 0, 0, 0); X #else /* not VMS */ X! while (ioctl (0, TCSETAW, &old_gtty) < 0 && errno == EINTR); X #endif /* not VMS */ X X--- 1168,1172 ---- X &old_gtty.class, 12, 0, 0, 0, 0); X #else /* not VMS */ X! while (term_setw (0, &old_gtty) < 0 && errno == EINTR); X #endif /* not VMS */ X X*************** X*** 1616,1619 **** X--- 1619,1623 ---- X int read_alarm_should_throw; X X+ SIGTYPE X select_alarm () X { X*************** X*** 1644,1648 **** X extern int process_tick, update_tick; X #endif X! int (*old_trap) (); X char buf; X X--- 1648,1652 ---- X extern int process_tick, update_tick; X #endif X! SIGTYPE (*old_trap) (); X char buf; X X*************** X*** 1714,1718 **** X break; X old_alarm = alarm (0); X! old_trap = (int (*)()) signal (SIGALRM, select_alarm); X select_alarmed = 0; X alarm (SELECT_PAUSE); X--- 1718,1722 ---- X break; X old_alarm = alarm (0); X! old_trap = signal (SIGALRM, select_alarm); X select_alarmed = 0; X alarm (SELECT_PAUSE); X*************** X*** 2282,2287 **** X--- 2286,2296 ---- X X rename (from, to) X+ #ifdef M_UNIX /* SCO UNIX: must match system header */ X+ const char *from; X+ const char *to; X+ #else X char *from; X char *to; X+ #endif X { X if (access (from, 0) == 0) END_OF_FILE if test 12521 -ne `wc -c <'emacs.pat-sco'`; then echo shar: \"'emacs.pat-sco'\" unpacked with wrong size! fi # end of 'emacs.pat-sco' fi echo shar: End of shell archive. exit 0 -- Chip Salzenberg at Teltronics/TCT <chip@tct.uucp>, <uunet!pdn!tct!chip> "Most of my code is written by myself. That is why so little gets done." -- Herman "HLLs will never fly" Rubin