Path: utzoo!utgpu!watserv1!watmath!att!pacbell!pacbell.com!decwrl!uunet!mcsun!hp4nl!utrcu1!infnews!infnews!gansevle From: gansevle@cs.utwente.nl (Fred Gansevles) Newsgroups: comp.lang.c Subject: Re: Catching ^C and ^Z Message-ID: <1990Sep7.064716.125@cs.utwente.nl> Date: 7 Sep 90 06:47:16 GMT References: Sender: usenet@cs.utwente.nl Reply-To: gansevle@cs.utwente.nl (Fred Gansevles) Organization: Twente University, Dept. of Computer Science Lines: 46 In article , deen@utopia.rutgers.edu (Cinnamon Raisin) writes: |> |>Hi boys and girls, |> |> I am trying to write a quick programme to lock a terminal(TTY) |> [ stuff deleted ] |> |>------------ |> |>#include |>#include |>#include |>char TMP; /* to hold keyboard entry */ |>struct sgttyb *TTY; /* From unix ref */ struct sgttyb TTY; |> |>int main(void) |>{ |> ioctl(0,TIOCGETP,TTY); /* Get current status */ ioctl(0,TIOCGETP,&TTY); /* ioctl fills the pointer you pass */ |> TTY->sg_flags = RAW | ECHO; /* Unprocessed and echoed */ TTY.sg_flags = RAW | ECHO; |> ioctl(0,TIOCSETN,TTY); /* to the screen */ ioctl(0,TIOCSETN,&TTY) |> while(1 == 1) {TMP = getchar();} |> exit(0); |>} |> |>------------ |> |> Do I have the calling parameters typed wrongly or somethin? ^^^^^^^ YES. This should do the trick. Fred. ________________________________________________________________________ Fred Gansevles gansevle@cs.utwente.nl INF Laboratory University Twente Enschede The Netherlands _________________________________________________________________________