Fix: SE004 Problem: Back-port Linux specific code from Debian 0.0.5E3-2 Compatible with: Slash'EM up to 0.0.5E3 (except Debian) Obsoleted by: Slash'EM 0.0.5E4 Author: Peter Makholm, peter@makholm.net J. Ali Harlow, ali@avrc.city.ac.uk Date: 9 Aug 1999 *** src/drawing.c.orig Tue Jul 27 16:15:51 1999 --- src/drawing.c Mon Aug 9 17:55:13 1999 *************** *** 1070,1076 **** #endif /* ASCIIGRAPH */ for (i = 0; i < MAXOCLASSES; i++) { ! #ifdef ASCIIGRAPH if (iflags.IBMgraphics # if defined(USE_TILES) && defined(MSDOS) && !iflags.grmode --- 1070,1076 ---- #endif /* ASCIIGRAPH */ for (i = 0; i < MAXOCLASSES; i++) { ! #if defined(ASCIIGRAPH) && !defined(LINUX) if (iflags.IBMgraphics # if defined(USE_TILES) && defined(MSDOS) && !iflags.grmode *************** *** 1078,1084 **** ) oc_syms[i] = IBM_r_oc_syms[i]; else ! #endif /* ASCIIGRAPH */ oc_syms[i] = r_oc_syms[i]; } #if defined(MSDOS) --- 1078,1084 ---- ) oc_syms[i] = IBM_r_oc_syms[i]; else ! #endif /* ASCIIGRAPH && !LINUX */ oc_syms[i] = r_oc_syms[i]; } #if defined(MSDOS) *** sys/share/ioctl.c.orig Tue Jul 27 16:21:42 1999 --- sys/share/ioctl.c Mon Aug 9 17:16:20 1999 *************** *** 73,78 **** --- 73,83 ---- extern void NDECL(sco_mapoff); #endif + #ifdef LINUX + extern void NDECL(linux_mapon); + extern void NDECL(linux_mapoff); + #endif + #ifdef AUX void catch_stp() *************** *** 158,163 **** --- 163,171 ---- # ifdef _M_UNIX sco_mapon(); # endif + # ifdef LINUX + linux_mapon(); + # endif (void) signal(SIGTSTP, SIG_DFL); # ifdef AUX ( void ) kill ( 0 , SIGSTOP ) ; *************** *** 167,172 **** --- 175,183 ---- # ifdef _M_UNIX sco_mapoff(); # endif + # ifdef LINUX + linux_mapoff(); + # endif resume_nhwindows(); } else { pline("I don't think your shell has job control."); *** win/tty/termcap.c.orig Tue Jul 27 16:25:34 1999 --- win/tty/termcap.c Mon Aug 9 17:54:27 1999 *************** *** 41,48 **** STATIC_VAR char *HO, *CL, *CE, *UP, *XD, *BC, *SO, *SE, *TI, *TE; STATIC_VAR char *VS, *VE; #if 0 ! STATIC_VAR char *MR, *ME; STATIC_VAR char *MB, *MH; STATIC_VAR char *MD; /* may already be in use below */ #endif --- 41,49 ---- STATIC_VAR char *HO, *CL, *CE, *UP, *XD, *BC, *SO, *SE, *TI, *TE; STATIC_VAR char *VS, *VE; + STATIC_VAR char *ME; #if 0 ! STATIC_VAR char *MR; STATIC_VAR char *MB, *MH; STATIC_VAR char *MD; /* may already be in use below */ #endif *************** *** 158,165 **** US = "\033[4m"; # if 0 MR = "\033[7m"; - ME = "\033[0m"; # endif TI = HE = SE = UE = "\033[0m"; /* strictly, SE should be 2, and UE should be 24, but we can't trust all ANSI emulators to be --- 159,166 ---- US = "\033[4m"; # if 0 MR = "\033[7m"; # endif + ME = "\033[0m"; TI = HE = SE = UE = "\033[0m"; /* strictly, SE should be 2, and UE should be 24, but we can't trust all ANSI emulators to be *************** *** 288,295 **** MB = Tgetstr("mb"); /* blink */ MD = Tgetstr("md"); /* boldface */ MH = Tgetstr("mh"); /* dim */ - ME = Tgetstr("me"); # endif /* Get rid of padding numbers for HI and HE. Hope they * aren't really needed!!! HI and HE are ouputted to the --- 289,296 ---- MB = Tgetstr("mb"); /* blink */ MD = Tgetstr("md"); /* boldface */ MH = Tgetstr("mh"); /* dim */ # endif + ME = Tgetstr("me"); /* Get rid of padding numbers for HI and HE. Hope they * aren't really needed!!! HI and HE are ouputted to the *************** *** 827,834 **** hilites[c] = HI; hilites[CLR_GRAY] = hilites[NO_COLOR] = (char *)0; ! if (tgetnum("Co") < 8 || (setf = tgetstr("Sf", (char **)0)) == (char *)0) ! return; for (c = 0; c < CLR_MAX / 2; c++) { scratch = tparm(setf, ti_map[c]); --- 828,838 ---- hilites[c] = HI; hilites[CLR_GRAY] = hilites[NO_COLOR] = (char *)0; ! if (tgetnum("Co") < 8) ! return; ! if ((setf = tgetstr("Sf", (char **)0)) == (char *)0 ! && (setf = tgetstr("AF", (char **)0)) == (char *)0) ! return; for (c = 0; c < CLR_MAX / 2; c++) { scratch = tparm(setf, ti_map[c]); *************** *** 1082,1088 **** void term_end_color() { ! xputs(HE); } --- 1086,1092 ---- void term_end_color() { ! xputs(ME); } *** sys/unix/unixmain.c.orig Tue Jul 27 16:22:52 1999 --- sys/unix/unixmain.c Mon Aug 9 17:43:37 1999 *************** *** 35,40 **** --- 35,45 ---- extern void NDECL(init_sco_cons); #endif + #ifdef LINUX + extern void NDECL(check_linux_console); + extern void NDECL(init_linux_cons); + #endif + static void NDECL(wd_message); #ifdef WIZARD static boolean wiz_error_flag = FALSE; *************** *** 120,125 **** --- 125,133 ---- #ifdef _M_UNIX check_sco_console(); #endif + #ifdef LINUX + check_linux_console(); + #endif initoptions(); init_nhwindows(&argc,argv); exact_username = whoami(); *************** *** 126,131 **** --- 134,142 ---- #ifdef _M_UNIX init_sco_cons(); #endif + #ifdef LINUX + init_linux_cons(); + #endif /* * It seems you really want to play. *** sys/share/unixtty.c.orig Tue Jul 27 16:21:33 1999 --- sys/share/unixtty.c Mon Aug 9 17:19:44 1999 *************** *** 370,376 **** --- 370,428 ---- } #endif /* _M_UNIX */ + #ifdef LINUX + # include + int linux_flag_console = 0; + + void + linux_mapon() + { + # ifdef TTY_GRAPHICS + if (!strcmp(windowprocs.name, "tty") && linux_flag_console) { + write(1, "\033(B", 3); + } + # endif + } + + void + linux_mapoff() + { + # ifdef TTY_GRAPHICS + if (!strcmp(windowprocs.name, "tty") && linux_flag_console) { + write(1, "\033(U", 3); + } + # endif + } + + void + check_linux_console() + { + struct vt_mode vtm; + + if (isatty(0) && ioctl(0,VT_GETMODE,&vtm) >= 0) { + linux_flag_console = 1; + } + } + + void + init_linux_cons() + { + # ifdef TTY_GRAPHICS + if (!strcmp(windowprocs.name, "tty") && linux_flag_console) { + atexit(linux_mapon); + linux_mapoff(); + switch_graphics(IBM_GRAPHICS); + # ifdef TEXTCOLOR + if (has_colors()) + iflags.use_color = TRUE; + # endif + } + # endif + } + #endif /* LINUX */ + + #ifndef __begui__ /* the Be GUI will define its own error proc */ /* fatal error */ /*VARARGS1*/ *** sys/unix/unixunix.c.orig Tue Jul 27 16:22:52 1999 --- sys/unix/unixunix.c Mon Aug 9 17:47:50 1999 *************** *** 17,22 **** --- 17,28 ---- extern void NDECL(sco_mapon); extern void NDECL(sco_mapoff); #endif + + #ifdef LINUX + extern void NDECL(linux_mapon); + extern void NDECL(linux_mapoff); + #endif + static int FDECL (veryold, (int)); static int NDECL (eraseoldlocks); *************** *** 317,322 **** --- 323,331 ---- #ifdef _M_UNIX sco_mapon(); #endif + #ifdef LINUX + linux_mapon(); + #endif if((f = fork()) == 0){ /* child */ (void) setgid(getgid()); (void) setuid(getuid()); *************** *** 336,341 **** --- 345,353 ---- #ifdef _M_UNIX sco_mapoff(); #endif + #ifdef LINUX + linux_mapoff(); + #endif (void) signal(SIGINT, (SIG_RET_TYPE) done1); #ifdef WIZARD if(wizard) (void) signal(SIGQUIT,SIG_DFL);