summaryrefslogtreecommitdiffstats
path: root/gui/console.cpp
diff options
context:
space:
mode:
authorVojtech Bocek <vbocek@gmail.com>2014-03-06 22:56:13 +0100
committerVojtech Bocek <vbocek@gmail.com>2014-03-06 22:59:22 +0100
commitd5b26d61e72c63b22224a87c5a54380f9d2ce3b6 (patch)
tree8180058411e17ac74fd94cd110ee30e690fdfc5b /gui/console.cpp
parent2.7.0.0 (diff)
downloadandroid_bootable_recovery-d5b26d61e72c63b22224a87c5a54380f9d2ce3b6.tar
android_bootable_recovery-d5b26d61e72c63b22224a87c5a54380f9d2ce3b6.tar.gz
android_bootable_recovery-d5b26d61e72c63b22224a87c5a54380f9d2ce3b6.tar.bz2
android_bootable_recovery-d5b26d61e72c63b22224a87c5a54380f9d2ce3b6.tar.lz
android_bootable_recovery-d5b26d61e72c63b22224a87c5a54380f9d2ce3b6.tar.xz
android_bootable_recovery-d5b26d61e72c63b22224a87c5a54380f9d2ce3b6.tar.zst
android_bootable_recovery-d5b26d61e72c63b22224a87c5a54380f9d2ce3b6.zip
Diffstat (limited to '')
-rw-r--r--gui/console.cpp54
1 files changed, 8 insertions, 46 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index f0d76c646..aae30a40b 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -46,60 +46,22 @@ extern "C" void gui_print(const char *fmt, ...)
return;
}
- for (start = next = buf; *next != '\0'; next++)
+ for (start = next = buf; *next != '\0';)
{
if (*next == '\n')
{
*next = '\0';
- next++;
+ gConsole.push_back(start);
- std::string line = start;
- gConsole.push_back(line);
- start = next;
-
- // Handle the normal \n\0 case
- if (*next == '\0')
- return;
+ start = ++next;
}
+ else
+ ++next;
}
- std::string line = start;
- gConsole.push_back(line);
- return;
-}
-
-extern "C" void gui_print_overwrite(const char *fmt, ...)
-{
- char buf[512]; // We're going to limit a single request to 512 bytes
-
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(buf, 512, fmt, ap);
- va_end(ap);
- fputs(buf, stdout);
-
- // Pop the last line, and we can continue
- if (!gConsole.empty()) gConsole.pop_back();
-
- char *start, *next;
- for (start = next = buf; *next != '\0'; next++)
- {
- if (*next == '\n')
- {
- *next = '\0';
- next++;
-
- std::string line = start;
- gConsole.push_back(line);
- start = next;
-
- // Handle the normal \n\0 case
- if (*next == '\0')
- return;
- }
- }
- std::string line = start;
- gConsole.push_back(line);
+ // The text after last \n (or whole string if there is no \n)
+ if(*start)
+ gConsole.push_back(start);
return;
}