History

scripts/decodecode: make it take multiline Code line

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. ie, when you have a file out of oops the Code line looks like Code: hh hh ... <hh> ... hh\n When copy'n'paste from, for example, email where sender or some middle MTA split it, the line looks like: Code: hh hh ... hh\n hh ... <hh> ... hh\n hh hh ... hh\n The Code line followed by another oops line usually contains characters out of hex digit + space + < + > set. So add 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.

Andy Shevchenko committed 8 years ago

Commit 7e68b361 parent ee190ca1 file · +12 −0Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/decodecode+12−0
@@ -21,12 +21,24 @@ trap cleanup EXIT · 20 unmodified lines
21 21
22T=`mktemp` || die "cannot create temp file"22T=`mktemp` || die "cannot create temp file"
23code=23code=
24cont=
24 25
25while read i ; do26while read i ; do
26 27
27case "$i" in28case "$i" in
28*Code:*)29*Code:*)
29 code=$i30 code=$i
31 cont=yes
32 ;;
33*)
34 [ -n "$cont" ] && {
35 xdump="$(echo $i | grep '^[[:xdigit:]<>[:space:]]\+$')"
36 if [ -n "$xdump" ]; then
37 code="$code $xdump"
38 else
39 cont=
40 fi
41 }
30 ;;42 ;;
31esac43esac
32 44

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t