aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Lutz <rlutz@hedmen.org>2017-08-14 13:56:18 +0200
committerRoland Lutz <rlutz@hedmen.org>2017-09-04 20:13:47 +0200
commit7dad1afe6d3e0f00b2033fdf8b83b83ae67db681 (patch)
tree7ce1d643e2010e4e4fac6e580b3954b69aedcddf
parent0e503a69a8fb2b42d145c72549b311f359636359 (diff)
downloadicestorm-7dad1afe6d3e0f00b2033fdf8b83b83ae67db681.tar.gz
icestorm-7dad1afe6d3e0f00b2033fdf8b83b83ae67db681.tar.bz2
icestorm-7dad1afe6d3e0f00b2033fdf8b83b83ae67db681.zip
icemulti: Treat offset printing like ordinary flag
-rw-r--r--icemulti/icemulti.cc10
1 files changed, 4 insertions, 6 deletions
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 <string.h>
#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<Image> 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;
}