Commit af9b2235 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Johannes Berg

cfg80211: add function helpers to genregdb.awk

This has no functional change, this just lets us reuse
helpers at a later time.
Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@do-not-panic.com>
Acked-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2475b1cc
...@@ -33,15 +33,7 @@ BEGIN { ...@@ -33,15 +33,7 @@ BEGIN {
regdb = "const struct ieee80211_regdomain *reg_regdb[] = {\n" regdb = "const struct ieee80211_regdomain *reg_regdb[] = {\n"
} }
/^[ \t]*#/ { function parse_country_head() {
# Ignore
}
!active && /^[ \t]*$/ {
# Ignore
}
!active && /country/ {
country=$2 country=$2
sub(/:/, "", country) sub(/:/, "", country)
printf "static const struct ieee80211_regdomain regdom_%s = {\n", country printf "static const struct ieee80211_regdomain regdom_%s = {\n", country
...@@ -57,7 +49,8 @@ BEGIN { ...@@ -57,7 +49,8 @@ BEGIN {
regdb = regdb "\t&regdom_" country ",\n" regdb = regdb "\t&regdom_" country ",\n"
} }
active && /^[ \t]*\(/ { function parse_reg_rule()
{
start = $1 start = $1
sub(/\(/, "", start) sub(/\(/, "", start)
end = $3 end = $3
...@@ -120,7 +113,8 @@ active && /^[ \t]*\(/ { ...@@ -120,7 +113,8 @@ active && /^[ \t]*\(/ {
rules++ rules++
} }
active && /^[ \t]*$/ { function print_tail_country()
{
active = 0 active = 0
printf "\t},\n" printf "\t},\n"
printf "\t.n_reg_rules = %d\n", rules printf "\t.n_reg_rules = %d\n", rules
...@@ -128,6 +122,26 @@ active && /^[ \t]*$/ { ...@@ -128,6 +122,26 @@ active && /^[ \t]*$/ {
rules = 0; rules = 0;
} }
/^[ \t]*#/ {
# Ignore
}
!active && /^[ \t]*$/ {
# Ignore
}
!active && /country/ {
parse_country_head()
}
active && /^[ \t]*\(/ {
parse_reg_rule()
}
active && /^[ \t]*$/ {
print_tail_country()
}
END { END {
print regdb "};" print regdb "};"
print "" print ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment