Files
csse2310-a3/sigcat.h
2025-03-21 10:54:32 +10:00

42 lines
948 B
C

#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