1 /* 2 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. 3 */ 4 5 #ifndef lint 6 static char rcsid[] = "$NetBSD: hack.ioctl.c,v 1.4 1995/03/23 08:30:29 cgd Exp $"; 7 #endif /* not lint */ 8 9 /* This cannot be part of hack.tty.c (as it was earlier) since on some 10 systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h> 11 define the same constants, and the C preprocessor complains. */ 12 #include <stdio.h> 13 #include "config.h" 14 #ifdef BSD 15 #include <sgtty.h> 16 struct ltchars ltchars, ltchars0; 17 #else 18 #include <termio.h> /* also includes part of <sgtty.h> */ 19 struct termio termio; 20 #endif BSD 21 22 getioctls() { 23 #ifdef BSD 24 (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars); 25 (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0); 26 #else 27 (void) ioctl(fileno(stdin), (int) TCGETA, &termio); 28 #endif BSD 29 } 30 31 setioctls() { 32 #ifdef BSD 33 (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars); 34 #else 35 (void) ioctl(fileno(stdin), (int) TCSETA, &termio); 36 #endif BSD 37 } 38 39 #ifdef SUSPEND /* implies BSD */ 40 #include <signal.h> 41 dosuspend() { 42 #ifdef SIGTSTP 43 if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) { 44 settty((char *) 0); 45 (void) signal(SIGTSTP, SIG_DFL); 46 (void) kill(0, SIGTSTP); 47 gettty(); 48 setftty(); 49 docrt(); 50 } else { 51 pline("I don't think your shell has job control."); 52 } 53 #else SIGTSTP 54 pline("Sorry, it seems we have no SIGTSTP here. Try ! or S."); 55 #endif SIGTSTP 56 return(0); 57 } 58 #endif SUSPEND 59