From 7dad1afe6d3e0f00b2033fdf8b83b83ae67db681 Mon Sep 17 00:00:00 2001 From: Roland Lutz Date: Mon, 14 Aug 2017 13:56:18 +0200 Subject: icemulti: Treat offset printing like ordinary flag --- icemulti/icemulti.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'icemulti') diff --git a/icemulti/icemulti.cc b/icemulti/icemulti.cc index ae7d642..03f1a68 100644 --- a/icemulti/icemulti.cc +++ b/icemulti/icemulti.cc @@ -25,13 +25,10 @@ #include #define log(...) fprintf(stderr, __VA_ARGS__); -#define info(...) do { if (log_level > 0) fprintf(stderr, __VA_ARGS__); } while (0) #define error(...) do { fprintf(stderr, "%s: ", program_short_name); fprintf(stderr, __VA_ARGS__); exit(EXIT_FAILURE); } while (0) static char *program_short_name; -int log_level = 0; - static const int NUM_IMAGES = 4; static const int HEADER_SIZE = 32; @@ -191,6 +188,7 @@ int main(int argc, char **argv) Image *header_images[NUM_IMAGES]; std::unique_ptr images[NUM_IMAGES]; const char *outfile_name = NULL; + bool print_offsets = false; static struct option long_options[] = { {NULL, 0, NULL, 0} @@ -234,7 +232,7 @@ int main(int argc, char **argv) outfile_name = optarg; break; case 'v': - log_level++; + print_offsets = true; break; default: usage(); @@ -268,7 +266,8 @@ int main(int argc, char **argv) images[i]->place(offs); offs += images[i]->size(); align_offset(offs, align_bits); - info("Place image %d at %06x .. %06x.\n", i, int(images[i]->offset()), int(offs)); + if (print_offsets) + fprintf(stderr, "Place image %d at %06x .. %06x.\n", i, int(images[i]->offset()), int(offs)); } // Populate headers @@ -302,6 +301,5 @@ int main(int argc, char **argv) images[i]->write(*osp, file_offset); } - info("Done.\n"); return EXIT_SUCCESS; } -- cgit v1.2.3