diff options
| author | David M. Syzdek <david@syzdek.net> | 2021-10-12 09:49:34 -0800 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2021-10-12 09:49:34 -0800 |
| commit | c33fcb53e9e7473baf77190c2f394ce62aceda4d (patch) | |
| tree | 71c6a7b07322e0e0514193a9a34233fc72eddc04 /src | |
| parent | c1b69847903c73b62df993989cacc84d97a64a55 (diff) | |
| download | dmstools-c33fcb53e9e7473baf77190c2f394ce62aceda4d.tar.gz dmstools-c33fcb53e9e7473baf77190c2f394ce62aceda4d.tar.bz2 dmstools-c33fcb53e9e7473baf77190c2f394ce62aceda4d.tar.xz dmstools-c33fcb53e9e7473baf77190c2f394ce62aceda4d.zip | |
numconvert: updating whitespace output
Diffstat (limited to 'src')
| -rw-r--r-- | src/numconvert.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/numconvert.c b/src/numconvert.c index 4b1f196..3f52a53 100644 --- a/src/numconvert.c +++ b/src/numconvert.c | |||
| @@ -455,7 +455,7 @@ void my_print(int32_t opt, uintmax_t num, const char * order) | |||
| 455 | printf((opt & MY_OPT_SPACE) ? ", " : ","); | 455 | printf((opt & MY_OPT_SPACE) ? ", " : ","); |
| 456 | if ((opt & MY_OPT_HEADER)) | 456 | if ((opt & MY_OPT_HEADER)) |
| 457 | { | 457 | { |
| 458 | len = printf("%*s", (unsigned)(max*2)+2, "Hex"); | 458 | len = printf("%*s", ((!(opt & MY_OPT_SPACE)) ? 0 : (unsigned)(max*2)+2), "Hex"); |
| 459 | break; | 459 | break; |
| 460 | }; | 460 | }; |
| 461 | len = printf("0x%0*jX", (unsigned)(max*2), num); | 461 | len = printf("0x%0*jX", (unsigned)(max*2), num); |
| @@ -470,11 +470,11 @@ void my_print(int32_t opt, uintmax_t num, const char * order) | |||
| 470 | printf((opt & MY_OPT_SPACE) ? ", " : ","); | 470 | printf((opt & MY_OPT_SPACE) ? ", " : ","); |
| 471 | if ((opt & MY_OPT_HEADER)) | 471 | if ((opt & MY_OPT_HEADER)) |
| 472 | { | 472 | { |
| 473 | len = printf("%*s", ((int)max*3), "Octal"); | 473 | len = printf("%*s", ((!(opt & MY_OPT_SPACE)) ? 0 : ((int)max*3)), "Octal"); |
| 474 | break; | 474 | break; |
| 475 | }; | 475 | }; |
| 476 | snprintf(buff, sizeof(buff), "0%jo", num); | 476 | snprintf(buff, sizeof(buff), "0%jo", num); |
| 477 | len = printf("%*s", ((3*(int)max)), buff); | 477 | len = printf("%*s", ((!(opt & MY_OPT_SPACE)) ? 0 : ((3*(int)max))), buff); |
| 478 | break; | 478 | break; |
| 479 | 479 | ||
| 480 | // print decimal value | 480 | // print decimal value |
| @@ -486,10 +486,10 @@ void my_print(int32_t opt, uintmax_t num, const char * order) | |||
| 486 | printf((opt & MY_OPT_SPACE) ? ", " : ","); | 486 | printf((opt & MY_OPT_SPACE) ? ", " : ","); |
| 487 | if ((opt & MY_OPT_HEADER)) | 487 | if ((opt & MY_OPT_HEADER)) |
| 488 | { | 488 | { |
| 489 | len = printf("%*s", (((int)max/4)*10), "Decimal"); | 489 | len = printf("%*s", ((!(opt & MY_OPT_SPACE)) ? 0 : (((int)max/4)*10)), "Decimal"); |
| 490 | break; | 490 | break; |
| 491 | }; | 491 | }; |
| 492 | len = printf("%*ju", (((int)max/4)*10), num); | 492 | len = printf("%*ju", ((!(opt & MY_OPT_SPACE)) ? 0 : (((int)max/4)*10)), num); |
| 493 | break; | 493 | break; |
| 494 | 494 | ||
| 495 | default: | 495 | default: |
