cryptutils

Cryptographic Software Utilities
git clone http://git.omkov.net/cryptutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2021-02-15 12:28:45
Commit595bd6b4b1ce42ed8dba1c5e2ac092a0cbedd6c6
Parentf48cfac6b9bc973b69514191dae619ca8ec68de3

lib: Update error to version 1.0.2

Diffstat

M src/lib/error.c | 9 ++++++---
M src/lib/error.h | 8 ++++++--

2 files changed, 12 insertions, 5 deletions

diff --git a/src/lib/error.c b/src/lib/error.c
index f246723..b41041f 100644
--- a/src/lib/error.c
+++ b/src/lib/error.c
@@ -1,4 +1,4 @@
-// error.c, version 1.0.1
+// error.c, version 1.0.2
 // Error source file for OMKOV lib
 // Copyright (C) 2020, Jakob Wakeling
 // All rights reserved.
@@ -34,13 +34,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #include <errno.h>
 #include <stdarg.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdnoreturn.h>
 #include <string.h>
 
 char *A0 = NULL;
+bool warned = false;
 
-_Noreturn void error(int status, const char *format, ...) {
+noreturn void error(int status, const char *format, ...) {
 	fflush(stdout); if (A0) { fputs(A0, stderr); fputs(": ", stderr); }
 	va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap);
 	fputc('\n', stderr); exit(status);
@@ -49,7 +52,7 @@ _Noreturn void error(int status, const char *format, ...) {
 void warn(const char *format, ...) {
 	fflush(stdout); if (A0) { fputs(A0, stderr); fputs(": ", stderr); }
 	va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap);
-	fputc('\n', stderr); return;
+	fputc('\n', stderr); warned = true; return;
 }
 
 char *serr(void) { return strerror(errno); }
diff --git a/src/lib/error.h b/src/lib/error.h
index d0d4585..16db9cf 100644
--- a/src/lib/error.h
+++ b/src/lib/error.h
@@ -1,4 +1,4 @@
-// error.h, version 1.0.1
+// error.h, version 1.0.2
 // Error header file for OMKOV lib
 // Copyright (C) 2020, Jakob Wakeling
 // All rights reserved.
@@ -33,9 +33,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #ifndef OMKOV_LIB_ERROR_H_38W06M3W
 #define OMKOV_LIB_ERROR_H_38W06M3W
 
+#include <stdbool.h>
+#include <stdnoreturn.h>
+
 extern char *A0;
+extern bool warned;
 
-extern _Noreturn void error(int status, const char *format, ...);
+extern noreturn void error(int status, const char *format, ...);
 extern void warn(const char *format, ...);
 
 extern char *serr(void);