summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/s390x.c5
-rw-r--r--print_info.c11
-rw-r--r--print_info.h1
3 files changed, 15 insertions, 2 deletions
diff --git a/arch/s390x.c b/arch/s390x.c
index 1b0eb27..e7d7603 100644
--- a/arch/s390x.c
+++ b/arch/s390x.c
@@ -63,6 +63,11 @@ int
get_machdep_info_s390x(void)
{
unsigned long vmlist, vmalloc_start;
+ char *term_str = getenv("TERM");
+
+ if (term_str && strcmp(term_str, "dumb") == 0)
+ /* '\r' control character is ignored on "dumb" terminal. */
+ flag_ignore_r_char = 1;
info->section_size_bits = _SECTION_SIZE_BITS;
info->max_physmem_bits = _MAX_PHYSMEM_BITS;
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
diff --git a/print_info.h b/print_info.h
index bdb4aed..01e3706 100644
--- a/print_info.h
+++ b/print_info.h
@@ -21,6 +21,7 @@
extern int message_level;
extern int flag_strerr_message;
+extern int flag_ignore_r_char;
void show_version(void);
void print_usage(void);