summaryrefslogtreecommitdiff
path: root/lib/enum-to-names-vals
diff options
context:
space:
mode:
Diffstat (limited to 'lib/enum-to-names-vals')
-rwxr-xr-xlib/enum-to-names-vals17
1 files 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 ""; \
+} ' $@