From 405879699ccdcaea544635814c63fafd46b5af03 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Tue, 21 Apr 2009 15:40:54 -0700 Subject: enum-to-names-vals: cleanup Signed-off-by: Inaky Perez-Gonzalez --- lib/enum-to-names-vals | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/enum-to-names-vals b/lib/enum-to-names-vals index 9d27bd8..bc7224a 100755 --- a/lib/enum-to-names-vals +++ b/lib/enum-to-names-vals @@ -18,7 +18,10 @@ const struct { } ${type}_names_vals[] = { EOF awk -vtype=$type -vtype_regex="^${type}_" ' \ -BEGIN { IGNORECASE = 1; } \ +BEGIN { \ + IGNORECASE = 1; \ +} \ + \ $1 ~ type_regex { \ name=$1; \ symbol=$1; \ @@ -28,6 +31,12 @@ $1 ~ type_regex { \ gsub(/,.*$/, "", name); \ gsub(/_/, "-", name); \ print "\t{ " symbol ", \"" tolower(name) "\" },"; \ -}' $@ -echo " { 0, NULL }" -echo "};" + valid = valid tolower(name) " "; \ +} \ + \ +END { \ + print " { 0, NULL }"; \ + print "};"; \ + print "const char " type "_valid_str[] = \"" valid "\";"; \ + print ""; \ +} ' $@ -- cgit v1.2.3