lkml.org 
[lkml]   [2017]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1] scripts/decodecode: Make it take multiline Code line
Date
In case of running scripts/decodecode without any parameters in order to give a
copy'n'pasted Code line from, for example, email it would parse only first line
of it, while in emails it's split to few.

So, add a logic to join this split back if and only if the following lines have
hex digits, or spaces, or '<', or '>' characters. It will be quite unlikely to
have a broken input in well formed Oops or dmesg, thus a simple regex is being
used.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
scripts/decodecode | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/scripts/decodecode b/scripts/decodecode
index 5ea071099330..9cef558528aa 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -21,12 +21,24 @@ trap cleanup EXIT

T=`mktemp` || die "cannot create temp file"
code=
+cont=

while read i ; do

case "$i" in
*Code:*)
code=$i
+ cont=yes
+ ;;
+*)
+ [ -n "$cont" ] && {
+ xdump="$(echo $i | grep '^[[:xdigit:]<>[:space:]]\+$')"
+ if [ -n "$xdump" ]; then
+ code="$code $xdump"
+ else
+ cont=
+ fi
+ }
;;
esac

--
2.15.0
\
 
 \ /
  Last update: 2017-12-12 11:04    [W:0.125 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site