summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/examples/reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp-ffi/examples/reader.c')
-rw-r--r--openpgp-ffi/examples/reader.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/openpgp-ffi/examples/reader.c b/openpgp-ffi/examples/reader.c
index b0273ebb..13c47f69 100644
--- a/openpgp-ffi/examples/reader.c
+++ b/openpgp-ffi/examples/reader.c
@@ -1,8 +1,17 @@
#define _GNU_SOURCE
-#include <error.h>
+/* Roughly glibc compatible error reporting. */
+#define error(S, E, F, ...) do { \
+ fprintf (stderr, (F), __VA_ARGS__); \
+ int s = (S), e = (E); \
+ if (e) { fprintf (stderr, ": %s", strerror (e)); } \
+ fprintf (stderr, "\n"); \
+ fflush (stderr); \
+ if (s) { exit (s); } \
+ } while (0)
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sequoia/openpgp.h>