Permalink
Browse files

Improve processing output string

  • Loading branch information...
1 parent d4f464f commit 45fa4a3f4fea5828676e78df8407879746e95354 @b4winckler committed Feb 16, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/lxbread.c
View
@@ -254,11 +254,16 @@ int main(int argc, char *argv[])
if (argc < 1)
usage();
+ char processing_fmt[] = "Processing file [%1d of %d]: %s\n";
+ if (argc >= 1000) processing_fmt[18] = '4';
+ else if (argc >= 100) processing_fmt[18] = '3';
+ else if (argc >= 10) processing_fmt[18] = '2';
+ else processing_fmt[18] = '1';
+
int did_header = FALSE;
for (int i = 0; i < argc; ++i) {
if (verbose)
- fprintf(stderr, "Processing file [%d of %d]: %s\n",
- i+1, argc, argv[i]);
+ fprintf(stderr, processing_fmt, i+1, argc, argv[i]);
long size;
char *buf = read_file(argv[i], &size);

0 comments on commit 45fa4a3

Please sign in to comment.