CSE320/hw2/include/errmsg.h
Renge c1c2feb549 fix: implemented errmsg
feat: implemented errmsg
2022-03-04 12:24:48 -05:00

40 lines
1.1 KiB
C

/*********************/
/* errmsg.h */
/* for Par 3.20 */
/* Copyright 1993 by */
/* Adam M. Costello */
/*********************/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
/**
* @brief Set an error indication, with a specified error message.
* @param msg Pointer to the error message. The string passed by the caller
* will be copied.
*/
void set_error(char *msg);
/**
* @brief Test whether there is currently an error indication.
* @return 1 if an error indication currently exists, 0 otherwise.
*/
int is_error();
/**
* @brief Issue any existing error message to the specified output stream.
* @param file Stream to which the error message is to be issued.
* @return 0 if either there was no existing error message, or else there
* was an existing error message and it was successfully output.
* Return non-zero if the attempt to output an existing error message
* failed.
*/
int report_error(FILE *file);
/**
* Clear any existing error indication and free storage occupied by
* any existing error message.
*/
void clear_error();
static char * outofmem;