(Alex Yukhimets) wrote: > > Beeing busy to write a programm I would like to add a routine > > that forces it to shut down orderly (closing files etc.) when > > recieving a SIGTERM from the system, because the program itself > > is doing work that will keep it going for months at least. > > Can somone tell me of already existing programs where i can study > > the source to learn about that subject? > > man 2 signal > > Usage: > > siganl(SIGTERM,shutdown_handler); > > where "shutdown_handler" is > > void shutdown_handler(int sig){ > /* do cleanup */ > exit(0); > }
What about CTRL + C. Is that a signal? If not, how can a do something before exiting from CTRL + C? /Mats -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]