c program the catches the ctrl-c(SIGINT) Signal for the
first time and prints a output rather and exit on pressing
Ctrl-C again

Answers were Sorted based on User's Feedback



c program the catches the ctrl-c(SIGINT) Signal for the first time and prints a output rather and ..

Answer / dwarf

on Linux:
man 2 signal
for signum use SIGINT

Is This Answer Correct ?    0 Yes 0 No

c program the catches the ctrl-c(SIGINT) Signal for the first time and prints a output rather and ..

Answer / rakesh

#include <stdio.h>

#include <signal.h>



void sigproc(void);


main()

{


signal(SIGINT, sigproc);


printf("This program catches ctrl-c(SIGINT) signal for
first time and exit on pressing ctrl-c again\n");

for(;;);
/* infinite loop */

}

void sigproc()

{

signal(SIGINT, sigproc);

printf("you have pressed ctrl-c \n");

(void) signal(SIGINT,SIG_DFL);


}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Shell Script Interview Questions

how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com

0 Answers  


What is the first line in every perl script called?

0 Answers  


What is k shell?

0 Answers  


What are the advantages of shell script?

0 Answers  


Is shell scripting a language?

0 Answers  






How do I set bash as default shell mac?

0 Answers  


In which variable prompt value is stored?

2 Answers  


what is the difference between cmp and diff commands

2 Answers   Amazon, CTS,


Why do we use shell scripting?

0 Answers  


What is a batch file used for?

0 Answers  


What does egrep mean?

0 Answers  


Write a command sequence to find the count of each word?

0 Answers  


Categories