Path: utzoo!attcan!telly!eci386!clewis From: clewis@eci386.uucp (Chris Lewis) Newsgroups: comp.lang.perl Subject: Signal handling... Message-ID: <1990Mar21.173423.7281@eci386.uucp> Date: 21 Mar 90 17:34:23 GMT Reply-To: clewis@eci386 (Chris Lewis) Organization: Elegant Communications Inc., Toronto, Canada Lines: 22 I want to be able to set signals in Perl for SIGINT/SIGQUIT/SIGTERM etc. analogously to the traditional C: if (signal(SIGINT, SIG_IGN) == SIG_DFL) signal(SIGINT, &myhandler); Above means: if SIGINT is set to default behaviour, assign it to my handler, otherwise ignore INT's altogether. Unfortunately $SIG{'INT'} isn't initialized to anything at perl start-up time (as per the manual), so I can't tell whether it's SIG_DFL or SIG_IGN (eg: I can't tell whether the command is foreground or background respectively). My code is currently saying: if (-t) { ... set INT/TERM/QUIT signals to my handler ... } But this is usually wrong..... Any ideas? -- Chris Lewis, Elegant Communications Inc, {uunet!attcan,utzoo}!lsuc!eci386!clewis Ferret mailing list: eci386!ferret-list, psroff mailing list: eci386!psroff-list