SUMMARY: Disabling Interrupts in C program.

From: John Black (black_zero@usa.net)
Date: Fri Nov 27 1998 - 07:19:09 CST


Hi,

Thank you very much to those who replied.

"Steve Kay" <steve@peachy.com>
Max Trummer <max@axyspharm.com>
"Brion Leary" <brion@dia.state.ma.us>
"Christopher M. Conway" <cmconwa@sandia.gov>
u-kevin@megami.veritas.com (Kevin Sheehan - Uniq)
Matthew Atkinson <m.atkinson@csl.gov.uk>
Roger Fujii <rmf@lookhere.com>
Reddy Muthyala <rmuthyala@lhxperts.com>
edz@bsn.com (Edward C. Zimmermann)
Chad Price <cprice@molbio.unmc.edu>

& Special Thanks to:

jrg@blodwen.demon.co.uk (James R Grinter)
Seth Rothenberg <SROTHENB@montefiore.org>
Harvey Wamboldt <harvey@iotek.ns.ca>
Renny Koshy <rkoshy@xl.com>
wolt@igd.fhg.de <Stephen Wolthusen>
--------------------------------------------

The unanimous reply was to use signal() library. It contains various
routineslike sigprocmask(), sigemptyset(),sigfillset(), sigaddset(),
sigdelset(),sigismember(), sigaction() etc to do such rudimentary things.
 
Some people have advised to use 'trap' command in the parent process which
runs this C program. Another very good suggestion was to use 'stty raw'
command in the parent process.
  
My apologies to those who thought that my question was off-topic. I will be
careful in future.

Thanks & Regards

John Black
_______________________________________________________________
My original Mail:

Hi,
  I am writing a C program which contains something like this:
  -----------------------------------------
  printf("\t\t\t\tA- Archie\n");
  printf("\t\t\t\tN- Finger\n");
  printf("\n\n\n\t\t\tEnter Your Choice (A or F)");
  scanf("%c",&x);
  if (x == 'A')
  {
  system("/usr/bin/archie");
  printf("\n\t\t\tPress Any Key To Continue");
  scanf("%c",&y);

  }
  else if (x == 'N')
  {
  system("/usr/bin/finger");
  scanf("%c",&y);
  printf("\n\t\t\tPress Any Key To Continue");
  scanf("%c",&y);
  }
  --------------------------------
  I want to disable all the interrupts so that if some body presses Ctrl-D or
Ctrl-C to stop the execution of this program then he does not succeed.
  I am compiling this program of solaris 2.5 using gcc.

  Thanks in advance. I will summarize.

  J. Black

____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:53 CDT