Thanks a lot for the great help, Steve and others. It really helped.

Regrads,
Vidol


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 31, 2001 11:36 PM
Subject: Re: How to disable Ctrl+C in C, PERL, or Shell Script?


> Hi Loeung,
>
> * loeung vidol <[EMAIL PROTECTED]> [07m31d01y 16:03]:
> > How can I trap the 'Ctrl+C' combination in my script: shell, PERL, or
even
> > C, so that my script cannot be terminated by that?
>
> In the shell (I'm assuming bash here) do this at the top of your script:
>
> trap "" 2
>
> That will set signal 2 (SIGINT, generated by ^C) to be ignored.
>
> -
>
> In perl, do this at the top of your script:
>
> $SIG{"INT"} = IGNORE;
>
> That also sets SIGINT to be ignored.
>
> -
>
> In C, you need to do this at the code for which you want ^C blocked:
>
> signal(SIGINT, SIG_IGN);
>
> That sets the SIGINT signal handler to the special value SIG_IGN, which
> ignores the signal. Note you'll have to #include <signal.h> .
>
>
> Hope that helps.
>
>
>
> _______________________________________________
> Seawolf-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/seawolf-list




_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to