diff options
Diffstat (limited to 'src/suffix.c')
-rw-r--r-- | src/suffix.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/suffix.c b/src/suffix.c index 0df248f..fc26e25 100644 --- a/src/suffix.c +++ b/src/suffix.c @@ -3,7 +3,7 @@ * * Copyright 2011-2012 Stefan Schmidt <stefan@datenfreihafen.org> * Copyright 2013 Hans Petter Selasky <hps@bitfrost.no> - * Copyright 2014 Tormod Volden <debian.tormod@gmail.com> + * Copyright 2014-2020 Tormod Volden <debian.tormod@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <stdlib.h> #include <stdio.h> #include <stdint.h> @@ -51,13 +55,12 @@ static void help(void) " -d --did <deviceID>\t\tAdd device ID into DFU suffix in <file>\n" " -S --spec <specID>\t\tAdd DFU specification ID into DFU suffix in <file>\n" ); - exit(EX_USAGE); } static void print_version(void) { printf("dfu-suffix (%s) %s\n\n", PACKAGE, PACKAGE_VERSION); - printf("Copyright 2011-2012 Stefan Schmidt, 2013-2014 Tormod Volden\n" + printf("Copyright 2011-2012 Stefan Schmidt, 2013-2020 Tormod Volden\n" "This program is Free Software and has ABSOLUTELY NO WARRANTY\n" "Please report bugs to %s\n\n", PACKAGE_BUGREPORT); @@ -73,6 +76,7 @@ static struct option opts[] = { { "vid", 1, 0, 'v' }, { "did", 1, 0, 'd' }, { "spec", 1, 0, 'S' }, + { 0, 0, 0, 0 } }; int main(int argc, char **argv) @@ -100,9 +104,10 @@ int main(int argc, char **argv) switch (c) { case 'h': help(); + exit(EX_OK); break; case 'V': - exit(0); + exit(EX_OK); break; case 'D': file.name = optarg; @@ -130,6 +135,7 @@ int main(int argc, char **argv) break; default: help(); + exit(EX_USAGE); break; } } @@ -137,11 +143,13 @@ int main(int argc, char **argv) if (!file.name) { fprintf(stderr, "You need to specify a filename\n"); help(); + exit(EX_USAGE); } if (spec != 0x0100 && spec != 0x011a) { fprintf(stderr, "Only DFU specification 0x0100 and 0x011a supported\n"); help(); + exit(EX_USAGE); } switch(mode) { @@ -170,7 +178,8 @@ int main(int argc, char **argv) default: help(); + exit(EX_USAGE); break; } - return (0); + return EX_OK; } |