summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authormeri <meri@e0336214-984f-0b4b-a45f-81c69e1f0ede>2007-04-30 18:39:18 +0000
committermeri <meri@e0336214-984f-0b4b-a45f-81c69e1f0ede>2007-04-30 18:39:18 +0000
commit1870e3694d5ce0a892c839b82520ac00f3ea55f8 (patch)
treeda28c28f4bee42663ca13d5abfe7c9c16a65ce51 /utils
parentda107e125605438c7cf739ad34bb6204b3d4b85e (diff)
added win32 support for MINGW32-compiler/cross-compiler
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1989 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile.am11
-rw-r--r--utils/common.c2
-rw-r--r--utils/librfid-tool.c16
-rw-r--r--utils/mifare-tool.c7
4 files changed, 24 insertions, 12 deletions
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 <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <libgen.h>
+//#include <libgen.h>
#include <librfid/rfid.h>
#include <librfid/rfid_scan.h>
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 <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <libgen.h>
+/*#include <libgen.h>*/
#define _GNU_SOURCE
#include <getopt.h>
@@ -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 <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <libgen.h>
+//#include <libgen.h>
#define _GNU_SOURCE
#include <getopt.h>
@@ -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));
personal git repositories of Harald Welte. Your mileage may vary