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

Create a bash shell script that removes all files whose names end with a "~" from your home directory and subdirectories. Name this script "cleanup.sh"

6 Answers  


defination of mapfile in winrunner?

0 Answers  


RAM one table colums a1,a2,a3,a4 respective values 2,4,7,8 KRISH one table colums a1,a2,a3,a4 respective values 3,4,6,9 IN RAM & KRISH a4 column if comparing values RAM A4 - KRISH A4 ( 8-9 =1 THEN print 5 or (RAM) a4 value 10 KRISH a4 values 2 then 10 -2 =8 print 5*8=40 or diff 5 print same

1 Answers   Tech Mahindra,


Explain how you Automate your application using Shell scripting.

0 Answers   MAHINDRA,


In shell scripting if text is surrounded by single quotes what does it denotes?

3 Answers  


Explain about non-login shell files?

0 Answers  


write a non recursive shell script that accepts any number of arguments and prints them in the reverse order

3 Answers  


What are the different commands available to check the disk usage?

0 Answers  


What exactly is a shell?

0 Answers  


How to get the first line from a file using just the terminal?

0 Answers  


Is cmd a shell?

0 Answers  


shell script for reverse the string

0 Answers  


Categories