From b5f46dcdcf180d9913e822b50a5c44362534c122 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 12 Aug 2010 20:48:50 +0800 Subject: print copyright and NO WARRANTY statement during startup Also, check for missing file name argument --- easytool/easytool.c | 26 +++++++++++++++++++++++--- 1 file 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 \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); } -- cgit v1.2.3