From 1870e3694d5ce0a892c839b82520ac00f3ea55f8 Mon Sep 17 00:00:00 2001 From: meri Date: Mon, 30 Apr 2007 18:39:18 +0000 Subject: added win32 support for MINGW32-compiler/cross-compiler git-svn-id: https://svn.gnumonks.org/trunk/librfid@1989 e0336214-984f-0b4b-a45f-81c69e1f0ede --- utils/Makefile.am | 11 ++++++++--- utils/common.c | 2 +- utils/librfid-tool.c | 16 +++++++++------- utils/mifare-tool.c | 7 ++++++- 4 files changed, 24 insertions(+), 12 deletions(-) (limited to 'utils') diff --git a/utils/Makefile.am b/utils/Makefile.am index abae91c..598a6ea 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -8,13 +8,18 @@ noinst_HEADERS = librfid-tool.h librfid_tool_SOURCES = librfid-tool.c common.c librfid_tool_LDADD = ../src/librfid.la -librfid_tool_LDFLAGS = -dynamic librfid_send_script_SOURCES= send_script.c librfid_send_script_LDADD = ../src/librfid.la -librfid_send_script_LDFLAGS = -dynamic mifare_tool_SOURCES = mifare-tool.c common.c mifare_tool_LDADD = ../src/librfid.la -mifare_tool_LDFLAGS = -dynamic + +if ENABLE_WIN32 +LINKOPTS = -dynamic -mno-cygwin +librfid_send_script_LDFLAGS = $(LINKOPTS) +librfid_tool_LDFLAGS = $(LINKOPTS) +mifare_tool_LDFLAGS = $(LINKOPTS) +endif + endif diff --git a/utils/common.c b/utils/common.c index 2966ab4..53acbdd 100644 --- a/utils/common.c +++ b/utils/common.c @@ -3,7 +3,7 @@ #include #include #include -#include +//#include #include #include diff --git a/utils/librfid-tool.c b/utils/librfid-tool.c index be6e843..020b837 100644 --- a/utils/librfid-tool.c +++ b/utils/librfid-tool.c @@ -21,7 +21,7 @@ #include #include #include -#include +/*#include */ #define _GNU_SOURCE #include @@ -352,7 +352,7 @@ void register_module(struct rfidtool_module *me) old = find_module(me->name); if (old) { - fprintf(stderr, "%s: target `%s' already registere.\n", + fprintf(stderr, "%s: target `%s' already registered.\n", program_name, me->name); exit(1); } @@ -370,10 +370,14 @@ static void help(void) int main(int argc, char **argv) { int rc; - char buf[0x40]; - int i, protocol = -1, layer2 = -1; + char buf[0x100]; + int i, len, protocol = -1, layer2 = -1; +#ifdef __MINGW32__ + program_name = argv[0]; +#else /*__MINGW32__*/ program_name = basename(argv[0]); +#endif/*__MINGW32__*/ printf("%s - (C) 2006 by Harald Welte\n" "This program is Free Software and has " @@ -450,8 +454,6 @@ int main(int argc, char **argv) exit(1); switch (protocol) { - char buf[32000]; - int len = 200; case RFID_PROTOCOL_TCL: printf("Protocol T=CL\n"); @@ -493,7 +495,7 @@ int main(int argc, char **argv) while (1) { printf("reading EF1\n"); - len = 200; + len = sizeof(buf); printf("reading ef\n"); rc = iso7816_read_binary(buf, &len); if (rc < 0) { diff --git a/utils/mifare-tool.c b/utils/mifare-tool.c index 4062eaa..aebd0d0 100644 --- a/utils/mifare-tool.c +++ b/utils/mifare-tool.c @@ -21,7 +21,7 @@ #include #include #include -#include +//#include #define _GNU_SOURCE #include @@ -95,7 +95,12 @@ int main(int argc, char **argv) unsigned int page; char key[MIFARE_CL_KEY_LEN]; char buf[MIFARE_CL_PAGE_SIZE]; + +#ifdef __MINGW32__ + program_name = argv[0]; +#else program_name = basename(argv[0]); +#endif/*__MINGW32__*/ memcpy(key, MIFARE_CL_KEYA_DEFAULT_INFINEON, sizeof(MIFARE_CL_KEYA_DEFAULT_INFINEON)); -- cgit v1.2.3