From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,3e5aa1fc3bf2178f,start X-Google-Attributes: gidf678f,public X-Google-Thread: fee84,3e5aa1fc3bf2178f,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1995-03-11 11:33:13 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!news2.near.net!das-news2.harvard.edu!fas-news.harvard.edu!scws4.harvard.edu!mlevin From: mlevin@scws4.harvard.edu (Michael Levin) Newsgroups: comp.unix.osf.misc,comp.unix.osf.osf1 Subject: how to (really) trap ^Z? Date: 11 Mar 1995 19:26:46 GMT Organization: Harvard University, Cambridge, MA Distribution: usa Message-ID: <3jsthm$qtg@decaxp.harvard.edu> NNTP-Posting-Host: scws4.harvard.edu Xref: bga.com comp.unix.osf.misc:1610 comp.unix.osf.osf1:6377 I am writing a program in C, on an Alpha running OSF/1. I want to trap ^Z (as hit from the keyboard, in the shell in which the program was run) - to have it go to a routine when it is hit, and then return. I did the usual: signal(SIGTSTP,f); where f() is my function. When I run the program, and hit ^Z, what happens is that my routine f() does get called properly, but also I see the "suspended" message from the shell, even though my program is not suspended (because I can see it run f() and then continue with its output). I then get the shell's prompt, intermixed with my program's output, until I do "fg", and all returns to normal. This is no good because I need f() to be able to accept keyboard commands (from stdin); why is the shell getting this ^Z when I explicitly trap it in my code? If anyone knows what the right solution is, please email to mlevin@husc.harvard.edu. Mike Levin