From: TJ Date: Sun, 14 Nov 2010 00:10:18 +0000 (+0000) Subject: Flush stdout before writing Done to stderr, and make 'type' 3 columns wide X-Git-Url: https://iam.tj/gitweb/gitweb.cgi?p=part-list.git;a=commitdiff_plain Flush stdout before writing Done to stderr, and make 'type' 3 columns wide --- diff --git a/part-list.c b/part-list.c index 1128cae..0a6324d 100644 --- a/part-list.c +++ b/part-list.c @@ -111,9 +111,9 @@ main(int argc, char *argv[], char *env[]) { } { char fmt_spec[100]; - char *format[2][4] = { - { "%8lX", "%08lX", "%02X", "%04X" }, - { "%8ld", "%10ld", "%2d", "%4d" } + char *format[2][5] = { + { "%8lX", "%08lX", "%02X", "%04X", "%03X" }, + { "%8ld", "%10ld", "%2d", "%4d", "%3d" } }; struct partition_table pt_table[4]; unsigned long offset, found; @@ -144,7 +144,7 @@ main(int argc, char *argv[], char *env[]) { pt_table[pt_entry].count_LBA = *(unsigned int *)(pt_mmap + pt_offset + PT_BASE + PT_COUNT_LBA); sprintf(fmt_spec, "%%d %%s %s %s %s %s %s %s %s %s %s (next %s)\n", - format[use_decimal][2], // type + format[use_decimal][4], // type format[use_decimal][3], // cyl format[use_decimal][2], // head format[use_decimal][2], // sector @@ -172,6 +172,7 @@ main(int argc, char *argv[], char *env[]) { } } } + fflush(stdout); fprintf(stderr, "Done.\n"); } }