Elaborato_SO/src/errExit.c

19 lines
426 B
C
Raw Normal View History

2023-05-14 17:07:34 +02:00
#include <stdio.h>
#include <stdlib.h>
2023-05-14 18:10:44 +02:00
#include <errExit.h>
2023-05-14 17:07:34 +02:00
void errExit(char *func, char *where) {
fprintf(stderr, "\033[91m<Error>\033[39m %s failed in %s\n", func, where);
perror("");
exit(1);
}
2023-05-18 11:58:55 +02:00
void warningMsg(char *msg) {
fprintf(stderr, "\033[0;33m<Warning>\033[39m %s\n", msg);
}
2023-05-14 17:07:34 +02:00
void errExitMsg(char *msg) {
2023-05-18 12:07:19 +02:00
fprintf(stderr, "\033[91m<Error>\033[39m %s\n", msg);
2023-05-14 17:07:34 +02:00
exit(1);
}