From 2db02fd2bc1f538022c1782a0de55345eb61599d Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Thu, 19 Mar 2015 18:10:10 +1000 Subject: [PATCH] * better maps --- src/util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index 191d681..fce197f 100644 --- a/src/util.c +++ b/src/util.c @@ -21,6 +21,9 @@ #include #include +#define CHAR_USED '@' +#define CHAR_NONE '-' + void usage(int exitcode) { printf( "Usage: imdb-util \n" @@ -79,7 +82,7 @@ int db_usage_map(imdb_t *db, unsigned short int cols) p = blk.data; for (i = 0; i < blk.records; i++, p += IMDB_REC_LEN) { t = p + REC_OFF_RU; - buf[j] = (*t == 0xFF) ? '1' : '0'; + buf[j] = (*t == 0xFF) ? CHAR_USED : CHAR_NONE; if (j++ < cols) continue; puts(buf); @@ -99,6 +102,7 @@ int rec_bitmap(imdb_t *db, imdb_rec_t *sample) { uint16_t row; uint8_t i, j; + char c; assert(db != NULL); assert(sample != NULL); @@ -113,7 +117,9 @@ int rec_bitmap(imdb_t *db, imdb_rec_t *sample) for (i = 0; i < 16; i++) { row = *(((uint16_t *) (&sample->data[REC_OFF_BM])) + i); for (j = 0; j < 16; j++) { - putchar((row & 1) == 1 ? '1' : '0'); + c = (row & 1) == 1 ? CHAR_USED : CHAR_NONE; + putchar(c); + putchar(c); row >>= 1; } putchar('\n');