Deleted Added
full compact
2,7c2
< #
< # This file is in the public domain. Written by Garrett A. Wollman,
< # 2002-09-17.
< #
< # $FreeBSD: head/usr.bin/getconf/fake-gperf.awk 103516 2002-09-18 03:15:25Z wollman $
< #
---
> # $FreeBSD: head/usr.bin/getconf/fake-gperf.awk 103591 2002-09-19 03:39:03Z wollman $
9a5
> struct_seen = "";
19a16,20
> /^struct/ && state == 0 {
> print;
> struct_seen = $2;
> next;
> }
24,27c25,34
< print "static const struct map {";
< print "\tconst char *name;";
< print "\tint key;";
< print "} wordlist[] = {";
---
> if (struct_seen !~ /^$/) {
> print "static const struct", struct_seen, "wordlist[] = {";
> } else {
> print "static const struct map {";
> print "\tconst char *name;";
> print "\tint key;";
> print "\tint valid;";
> print "} wordlist[] = {";
> struct_seen = "map";
> }
34c41
< print "#define\tNWORDS\t(sizeof(wordlist)/sizeof(wordlist[0]))";
---
> print "#define\tNWORDS\t(sizeof(wordlist)/sizeof(wordlist[0]) - 1)";
38c45
< print "\tconst struct map *mp;";
---
> print "\tconst struct", struct_seen, "*mp;";
51c58,62
< printf "\t{ \"%s\", %s },\n", name, $2;
---
> printf "#ifdef %s\n", $2;
> printf "\t{ \"%s\", %s, 1 },\n", name, $2;
> print "#else";
> printf "\t{ \"%s\", 0, 0 },\n", name, $2;
> print "#endif"