Skip to content

Commit 9144eff

Browse files
committed
Add missing err.h on Windows
1 parent 30ded6f commit 9144eff

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ AC_CHECK_FUNCS([memset])
3737
# C99
3838
CFLAGS="$CFLAGS -std=c99"
3939

40+
case "${host}" in
41+
*-cygwin* | *-mingw*)
42+
os_win32=yes
43+
;;
44+
*)
45+
os_win32=no
46+
;;
47+
esac
48+
49+
AM_CONDITIONAL([OS_WIN32], [test "x$os_win32" = "xyes"])
50+
4051
AC_CONFIG_FILES([Makefile
4152
src/Makefile])
4253
AC_OUTPUT

src/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ mfoc_SOURCES = crapto1.c crypto1.c mfoc.c mifare.c nfc-utils.c
88
mfoc_LDADD = @libnfc_LIBS@
99

1010
dist_man_MANS = mfoc.1
11+
12+
if OS_WIN32
13+
AM_CFLAGS += -I@srcdir@/win32
14+
endif

src/win32/err.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef _ERR_H_
2+
#define _ERR_H_
3+
4+
#include <stdlib.h>
5+
6+
#define warnx(...) do { \
7+
fprintf (stderr, __VA_ARGS__); \
8+
fprintf (stderr, "\n"); \
9+
} while (0)
10+
11+
#define errx(code, ...) do { \
12+
fprintf (stderr, __VA_ARGS__); \
13+
fprintf (stderr, "\n"); \
14+
exit (code); \
15+
} while (0)
16+
17+
#define err errx
18+
19+
#endif /* !_ERR_H_ */

0 commit comments

Comments
 (0)