summaryrefslogtreecommitdiff
path: root/print_info.c
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2011-09-07 16:40:21 +0900
committerKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>2011-09-07 16:40:21 +0900
commit714d177d594703adadd48cf393c2a3aa03e928ad (patch)
treef3ebdaf92499373f3cb83a9e486639fc90be1c94 /print_info.c
parente3ac177a9f484e4e853614f1431eb0bbc9626e0f (diff)
[PATCH] Support line mode terminals.
On S390 we have line mode terminals that do not have the possibility to position the cursor. When using kdump the output of makedumpfile will be shown on such terminals. Currently the output looks very strange because the '\r' control character is ignored. It looks like the following: Checking for memory holes : [ 0 %] Checking for memory holes : [100 %] Copying data : [ 33 %] Copying data : [ 65 %] Copying data : [ 96 %] Copying data : [100 %] For those line mode terminals the TERM environment variable is set to "dumb". With this patch makedumpfile checks the TERM variable and in case of "dumb" instead of using '\r' each progress message is printed into a separate line. The output will then look like the following: Checking for memory holes : [ 0 %] Checking for memory holes : [100 %] Copying data : [ 11 %] Copying data : [ 44 %] Copying data : [ 75 %] Copying data : [100 %] Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Diffstat (limited to 'print_info.c')
-rw-r--r--print_info.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/print_info.c b/print_info.c
index d283986..547976e 100644
--- a/print_info.c
+++ b/print_info.c
@@ -20,6 +20,7 @@
int message_level;
int flag_strerr_message;
+int flag_ignore_r_char; /* 0: '\r' is effective. 1: not effective. */
void
show_version(void)
@@ -246,8 +247,14 @@ print_progress(const char *msg, unsigned long current, unsigned long end)
} else
progress = 100;
- PROGRESS_MSG("\r");
- PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%] ", msg, progress);
+ if (flag_ignore_r_char) {
+ PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%]\n",
+ msg, progress);
+ } else {
+ PROGRESS_MSG("\r");
+ PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%] ",
+ msg, progress);
+ }
}
void