summaryrefslogtreecommitdiff
path: root/easytool
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-08-12 20:48:50 +0800
committerHarald Welte <laforge@gnumonks.org>2010-08-12 20:48:50 +0800
commitb5f46dcdcf180d9913e822b50a5c44362534c122 (patch)
tree83259f93ff3a687b4365824c605cfd264ba20fbe /easytool
parent590c3fb3328a3afdae28051e6662c4d242f85d0f (diff)
print copyright and NO WARRANTY statement during startup
Also, check for missing file name argument
Diffstat (limited to 'easytool')
-rw-r--r--easytool/easytool.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/easytool/easytool.c b/easytool/easytool.c
index f8da4e0..a65ea22 100644
--- a/easytool/easytool.c
+++ b/easytool/easytool.c
@@ -41,6 +41,13 @@
/* Easycard specific includes */
#include "easycard.h"
+#define VERSION "0.01"
+#define COPYRIGHT \
+ "EasyTool "VERSION"\n" \
+ "(C) 2010 by Harald Welte <laforge@gnumonks.org>\n" \
+ "This is FREE SOFTWARE with ABSOLUTELY NO VARRANTY\n\n" \
+ "Use of this software is only authorized for RESEARCH PURPOSE!\n\n"
+
struct {
int fd;
unsigned long size;
@@ -175,24 +182,37 @@ static void dump_easycard(mifare_tag *mft)
}
}
+static void print_help(void)
+{
+}
+
int main(int argc, char **argv)
{
struct stat st;
+ printf(COPYRIGHT);
+
+ if (argc < 2) {
+ fprintf(stderr, "ERROR: You must specify the file name of "
+ "a mifare dump file (.mfd)\n");
+ print_help();
+ exit(2);
+ }
+
global.fd = open(argv[1], O_RDONLY);
if (global.fd < 0) {
- perror("open");
+ perror("Error opening the MFD file");
exit(1);
}
if (fstat(global.fd, &st) < 0) {
- perror("stat");
+ perror("Error stat()ing the MFD file");
exit(1);
}
global.size = st.st_size;
global.mft = mmap(NULL, global.size, PROT_READ, MAP_SHARED,
global.fd, 0);
if (!global.mft) {
- perror("mmap");
+ perror("Error mmap()ing the MFD file");
exit(1);
}
personal git repositories of Harald Welte. Your mileage may vary