logcat: Add -T flag (-t w/o assumption of -d)
(cherry picked from commit de02546e3d7c9c307e3d87e0a7fe8bb39b363a72)
Change-Id: I49763e2db83755e0b7b12dfa3f83a3957c54d389
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index a54167e..3c33938 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -223,6 +223,7 @@
" -c clear (flush) the entire log and exit\n"
" -d dump the log and then exit (don't block)\n"
" -t <count> print only the most recent <count> lines (implies -d)\n"
+ " -T <count> print only the most recent <count> lines (does not imply -d)\n"
" -g get the size of the log's ring buffer and exit\n"
" -b <buffer> Request alternate ring buffer, 'main', 'system', 'radio'\n"
" or 'events'. Multiple -b parameters are allowed and the\n"
@@ -302,7 +303,7 @@
for (;;) {
int ret;
- ret = getopt(argc, argv, "cdt:gsQf:r::n:v:b:B");
+ ret = getopt(argc, argv, "cdt:T:gsQf:r::n:v:b:B");
if (ret < 0) {
break;
@@ -325,6 +326,8 @@
case 't':
mode = O_RDONLY | O_NDELAY;
+ /* FALLTHRU */
+ case 'T':
tail_lines = atoi(optarg);
break;