summaryrefslogtreecommitdiff
path: root/net/wireless/genregdb.awk
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-10-28 03:19:45 +0100
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 20:50:56 +0100
commitaf9b223551634ce1881de258169f3a1ea686a865 (patch)
tree8b6148c92ec6955c2da0a5ca7159565867497184 /net/wireless/genregdb.awk
parent2475b1cc0d5283a33144b79f3eba6d401d873962 (diff)
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: Luis R. Rodriguez <mcgrof@do-not-panic.com> Acked-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/genregdb.awk')
-rw-r--r--net/wireless/genregdb.awk36
1 files changed, 25 insertions, 11 deletions
diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk
index c808619ac9c6..42cd3fd2aa14 100644
--- a/net/wireless/genregdb.awk
+++ b/net/wireless/genregdb.awk
@@ -33,15 +33,7 @@ BEGIN {
regdb = "const struct ieee80211_regdomain *reg_regdb[] = {\n"
}
-/^[ \t]*#/ {
- # Ignore
-}
-
-!active && /^[ \t]*$/ {
- # Ignore
-}
-
-!active && /country/ {
+function parse_country_head() {
country=$2
sub(/:/, "", country)
printf "static const struct ieee80211_regdomain regdom_%s = {\n", country
@@ -57,7 +49,8 @@ BEGIN {
regdb = regdb "\t&regdom_" country ",\n"
}
-active && /^[ \t]*\(/ {
+function parse_reg_rule()
+{
start = $1
sub(/\(/, "", start)
end = $3
@@ -120,7 +113,8 @@ active && /^[ \t]*\(/ {
rules++
}
-active && /^[ \t]*$/ {
+function print_tail_country()
+{
active = 0
printf "\t},\n"
printf "\t.n_reg_rules = %d\n", rules
@@ -128,6 +122,26 @@ active && /^[ \t]*$/ {
rules = 0;
}
+/^[ \t]*#/ {
+ # Ignore
+}
+
+!active && /^[ \t]*$/ {
+ # Ignore
+}
+
+!active && /country/ {
+ parse_country_head()
+}
+
+active && /^[ \t]*\(/ {
+ parse_reg_rule()
+}
+
+active && /^[ \t]*$/ {
+ print_tail_country()
+}
+
END {
print regdb "};"
print ""