init
This commit is contained in:
41
sigcat.h
Normal file
41
sigcat.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef SIGCAT_H
|
||||
#define SIGCAT_H
|
||||
#include <csse2310a3.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define SIGMIN 1
|
||||
#define SIGMAX 31
|
||||
|
||||
// Holds the current output stream
|
||||
FILE *outputStream;
|
||||
|
||||
/* setup_default_handlers()
|
||||
* ------------------------
|
||||
* Sets up handlers for signals 1-31 excluding 9, 19, 10 and 12
|
||||
*/
|
||||
void setup_default_handlers(void);
|
||||
|
||||
/* default_signal_handler()
|
||||
* ------------------------
|
||||
* The default handler for signals, prints to the current output_stream
|
||||
* For example: sigcat recieved Hangup
|
||||
*
|
||||
* s: the signal number
|
||||
*/
|
||||
void default_signal_handler(int s);
|
||||
|
||||
/* usr_signal_handler()
|
||||
* ------------------------
|
||||
* The USR handler for signals, changes the output_stream based on the signal
|
||||
* recieved. SIGUSR1 sets the output_stream to stdout and SIGUSR2 sets the
|
||||
* output_stream to stderr
|
||||
*
|
||||
* s: the signal number
|
||||
*/
|
||||
void usr_signal_handler(int s);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user