Permalink
Browse files

kload: better line filtering

  • Loading branch information...
1 parent 58232ba commit dd685a8f43c61ee172179d44860cdc1366f59785 @falconindy committed Nov 24, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 kload
View
12 kload
@@ -83,31 +83,31 @@ parse_config() {
}
$1 == "LABEL" {
+ add_label(config, label, kernel, append, initrd)
label = $2
kernel = append = initrd = ""
}
- $1 ~ /^(LINUX|KERNEL)$/ {
+ label && $1 ~ /^(LINUX|KERNEL)$/ {
sub(/^[[:blank:]]*(LINUX|KERNEL) /, "")
kernel = $0
}
- $1 == "APPEND" {
+ label && $1 == "APPEND" {
sub(/^[[:blank:]]*APPEND /, "")
gsub(/[[:blank:]]+/, " ")
append = append ? append " " $0 : $0
}
- $1 == "INITRD" {
+ label && $1 == "INITRD" {
sub(/^[[:blank:]]*[^[:blank:]]+ /, "")
initrd = $0
}
- /^[[:blank:]]*$/ {
+ END {
+ # if theres no line after the last section, we wont add the label
add_label(config, label, kernel, append, initrd)
- }
- END {
if (action == "list") {
print_human(config)
} else if (action == "parse_one") {

0 comments on commit dd685a8

Please sign in to comment.