aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-01-03 01:10:45 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-01-03 01:10:45 +0100
commit0ce905c057c3215d1fc1b1beb1900e206024afad (patch)
treedf7be519469ad2cf28c949e64a9d996fc371cc7f /FICS
parenta44358a8d1fafce871ded8085a732e36720a181f (diff)
Added _assert_error()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/assert_error.c12
-rw-r--r--FICS/assert_error.h10
-rw-r--r--FICS/build.mk1
3 files changed, 23 insertions, 0 deletions
diff --git a/FICS/assert_error.c b/FICS/assert_error.c
new file mode 100644
index 0000000..2d26491
--- /dev/null
+++ b/FICS/assert_error.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "assert_error.h"
+
+__dead void
+_assert_error(const char *file, const long int line)
+{
+ (void) fprintf(stderr, "Assertion failed: file %s, line %ld.\n",
+ file, line);
+ abort();
+}
diff --git a/FICS/assert_error.h b/FICS/assert_error.h
new file mode 100644
index 0000000..2de6438
--- /dev/null
+++ b/FICS/assert_error.h
@@ -0,0 +1,10 @@
+#ifndef ASSERT_ERROR_H
+#define ASSERT_ERROR_H
+
+#ifndef __dead
+#define __dead __attribute__((__noreturn__))
+#endif
+
+__dead void _assert_error(const char *, const long int);
+
+#endif
diff --git a/FICS/build.mk b/FICS/build.mk
index b87d430..321cb87 100644
--- a/FICS/build.mk
+++ b/FICS/build.mk
@@ -5,6 +5,7 @@ SRC_DIR := FICS/
OBJS = $(SRC_DIR)adminproc.o\
$(SRC_DIR)algcheck.o\
+ $(SRC_DIR)assert_error.o\
$(SRC_DIR)board.o\
$(SRC_DIR)command.o\
$(SRC_DIR)comproc.o\