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

What are the four fundamental components of every file system on linux?

0 Answers  


What is the use of "shift" command in passing parameters?

1 Answers  


How to make userdefined variables to available for all other shells?

4 Answers  


How are shells born?

0 Answers  


How to get script name inside a script?

0 Answers  






What are the 3 standard streams in linux?

0 Answers  


How do I set bash as default shell mac?

0 Answers  


How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and perl scripting ( at the compile time error or run time error) in Unix environment ?

4 Answers  


How to rename all the files in a folder having specific extension? Example: I have some files with extension (.txt) in a folder name 'Test'. I have to rename all the .txt files in a test and its subdirectories to .my extension.

15 Answers   Interra IT,


How will you find the 99th line of a file using only tail and head command?

0 Answers  


What is eval in shell script?

0 Answers  


Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.

0 Answers  


Categories