Hope you can help me to resolve this problem.
For school I have to transform Ctrl+C to a command which doesn\'t shut down the shell, but he reminds through
Ctrl+C sends an interrupt signal (SIGINT) to the running process.You can use signal() to catch SIGINT like this:
#include
#include
void sigint_handler(int sig)
{
printf("Type exit to close the shell!\n");
}
int main()
{
signal(SIGINT, sigint_handler);
/*Your code should replace the while loop.*/
while(1)
{
printf("Running!\n");
getchar();
}
return 0 ;
}