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
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 |
How many prompts are available in a UNIX system?
What is shell chemistry?
Is bash a shell script?
what is the difference between cmp and diff commands
How can I set the default rwx permission to all users on every file which is created in the current shell?
In shell scripting if text is surrounded by single quotes what does it denotes?
What does chmod do?
is this growing field and what is average package in this?
How to use arguments in a script?
What are types of shells?
What is the command to find out today's date?
what are bootlevel in linux?which level is booting by default.