Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!caesar.cs.montana.edu!ogccse!orstcs!bionette.cgrb.orst.edu!duvalj From: duvalj@bionette.cgrb.orst.edu (Joe Duval - Entomology) Newsgroups: comp.lang.c Subject: System V function calls to signal() Message-ID: <13842@orstcs.CS.ORST.EDU> Date: 15 Nov 89 22:58:01 GMT Sender: usenet@orstcs.CS.ORST.EDU Reply-To: duvalj@bionette.cgrb.orst.edu.UUCP (Joe Duval - Entomology) Distribution: usa Organization: Oregon State University - CMBL Lines: 64 Hi, I would like some help using the signal function on a SYSV machine. I am using an AT&T 3b2. Here is what I want to do. I want to catch the action previously defined for a signal, lets say SIGINT, so I can reset that action later. After I catch the previous action, I want to do something else and then call signal again to reset the previous action. Redundant, huh? I have tried signal and ssignal both with no luck. I am sure that is in my logic. Any help will be appreciated. I have included two pieces of code; one uses signal and the next uses ssignal. Here is my (attempt at) code USES SIGNAL: #include static Foo() { static int (*sigint)(); int catch_int(); /* First I want to catch the action previously established for that * signal type */ sigint = signal (SIGINT, catch_int); /* An invalid pointer combination error occurs here. */ /* Then I want to do something else, go kill a process in this case */ kill(getpid(), SIGINT); /* Now I want to return to the previous action to that signal type */ signal (SIGINT, sigint); } static catch_int(n) { } Here is my attempt at the code USING SSIGNAL: #include static Foo() { static int (*sigint)(); int catch_int(); /* In ssignal is defined like this int (*ssignal (sig, action))() int sig, (*action)(); */ sigint = (*)ssignal (SIGINT, catch_int); kill(getpid(), SIGINT); signal (SIGINT, sigint); } =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= duvalj@bionette.cgrb.orst.edu.UUCP | Life is a tragedy for those that feel jozo@aes.orst.edu.UUCP | and a comedy for those that think! Phone: (503) 757-1297 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= duvalj@bionette.cgrb.orst.edu.UUCP | Life is a tragedy for those that feel jozo@aes.orst.edu.UUCP | and a comedy for those that think! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=