diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2017-02-11 15:30:37 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2017-02-11 15:30:37 +0000 |
commit | b8ede3c284299173f3981aa85dcbd16806a57f55 (patch) | |
tree | 31beb63b99f1840472da304de628e6114ba61f8e /hktool.c | |
parent | 99778c999c364ad3e5967f7a9a0a3e484c279716 (diff) | |
parent | 0fc0c19e4dc2b4ec2f175744e1ac468643b6da71 (diff) | |
download | hktool-b8ede3c284299173f3981aa85dcbd16806a57f55.tar.gz hktool-b8ede3c284299173f3981aa85dcbd16806a57f55.tar.xz hktool-b8ede3c284299173f3981aa85dcbd16806a57f55.zip |
Merge branch 'halfkay-error-handling'
Diffstat (limited to 'hktool.c')
-rw-r--r-- | hktool.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -24,7 +24,6 @@ #include <unistd.h> #include "halfkay.h" -#include "log.h" #include "eprintf.h" #include "params.h" @@ -67,8 +66,7 @@ int main(int argc, char **argv) int opt; struct flashparams fp; - argv0 = argv[0] != NULL ? argv[0] : "hktool"; - setprogname(argv0); + setprogname(argv[0] != NULL ? argv[0] : "hktool"); while (opt = getopt(argc, argv, "f:h-lvr"), opt != -1) { switch (opt) { @@ -97,18 +95,18 @@ int main(int argc, char **argv) return EXIT_FAILURE; break; default: - error(0, "getopt returned unexpected value"); + eprintf("getopt returned unexpected value"); } } if (optind >= argc) - error(0, "No MCU specified\nUsage: %s " USAGE, argv[0]); + eprintf("No MCU specified\nUsage: %s " USAGE, argv[0]); if (!doflash && !doreboot) - error(0, "Nothing to do"); + eprintf("Nothing to do"); if (argc - optind > 1) - error(0, "Invalid number of arguments\nUsage: %s " USAGE, argv[0]); + eprintf("Invalid number of arguments\nUsage: %s " USAGE, argv[0]); if (getparams(&fp, argv[optind]) != 0) return EXIT_FAILURE; |