about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen-posix-conf-vars.awk46
1 files changed, 23 insertions, 23 deletions
diff --git a/scripts/gen-posix-conf-vars.awk b/scripts/gen-posix-conf-vars.awk
index 007cd744de..220d0e89b9 100644
--- a/scripts/gen-posix-conf-vars.awk
+++ b/scripts/gen-posix-conf-vars.awk
@@ -42,36 +42,36 @@ $1 == "}" {
   # CONFSTR: A configuration string
   # SYSCONF: A numeric value
   # SPEC: A specification
-  sc_prefixes[prefix][$1] = sc_prefix
-  conf[prefix][$1] = type
+  c = prefix "_" $1
+  sc_prefixes[c] = sc_prefix
+  prefix_conf[c] = type
+  conf[c] = $1
 }
 
 END {
   print "/* AUTOGENERATED by gen-posix-conf-vars.awk.  DO NOT EDIT.  */\n"
 
   # Generate macros that specify if a sysconf macro is defined and/or set.
-  for (p in conf) {
-    for (c in conf[p]) {
-      printf "#ifndef _%s_%s\n", p, c
-      printf "# define CONF_DEF_%s_%s CONF_DEF_UNDEFINED\n", p, c
-      # CONFSTR have string values and they are not set or unset.
-      if (conf[p][c] != "CONFSTR") {
-	printf "#else\n"
-	printf "# if _%s_%s > 0\n", p, c
-	printf "#  define CONF_DEF_%s_%s CONF_DEF_DEFINED_SET\n", p, c
-	printf "# else\n"
-	printf "#  define CONF_DEF_%s_%s CONF_DEF_DEFINED_UNSET\n", p, c
-	printf "# endif\n"
-      }
-      printf "#endif\n\n"
+  for (c in prefix_conf) {
+    printf "#ifndef _%s\n", c
+    printf "# define CONF_DEF_%s CONF_DEF_UNDEFINED\n", c
+    # CONFSTR have string values and they are not set or unset.
+    if (prefix_conf[c] != "CONFSTR") {
+      printf "#else\n"
+      printf "# if _%s > 0\n", c
+      printf "#  define CONF_DEF_%s CONF_DEF_DEFINED_SET\n", c
+      printf "# else\n"
+      printf "#  define CONF_DEF_%s CONF_DEF_DEFINED_UNSET\n", c
+      printf "# endif\n"
+    }
+    printf "#endif\n\n"
 
-      # Build a name -> sysconf number associative array to print a C array at
-      # the end.
-      if (conf[p][c] == "SPEC") {
-	name = sprintf ("%s_%s", p, c)
-	num = sprintf ("%s_%s", sc_prefixes[p][c], c)
-	spec[name] = num
-      }
+    # Build a name -> sysconf number associative array to print a C array at
+    # the end.
+    if (prefix_conf[c] == "SPEC") {
+      name = sprintf ("%s", c)
+      num = sprintf ("%s_%s", sc_prefixes[c], conf[c])
+      spec[name] = num
     }
   }