X-Git-Url: http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu%2Fglibc.git;a=blobdiff_plain;f=mach%2Ferrsystems.awk;h=c5cc5302b4386271a9ade84b55e0723a150805ee;hp=f9fa882046ca8adddbba4b0af06089d1a460f814;hb=fcb39030cc930bbbcaaa302612b782ade4a49000;hpb=c1fa4b98df738d05bef70e03544b8587b18d174f diff --git a/mach/errsystems.awk b/mach/errsystems.awk index f9fa882046..c5cc5302b4 100644 --- a/mach/errsystems.awk +++ b/mach/errsystems.awk @@ -1,22 +1,18 @@ BEGIN { - FS=" \t["; print "#include \n#include "; print "#define static static const" nsubs = split(subsys, subs); - for (sub in subs) printf "#includes \"%s\"\n", sub; + while (nsubs > 0) printf "#include \"%s\"\n", subs[nsubs--]; print "\n\n\ -static const struct error_system __mach_error_systems[err_max_system + 1] ="; +const struct error_system __mach_error_systems[err_max_system + 1] ="; print " {"; } -{ - for (i = 1; i <= NF; ++i) - if ($i ~ /err_[a-z0-9A-Z_]+_sub/) { - sub = substr ($i, 0, length ($i) - 4); - printf " [err_get_system (%s)] = { errlib_count (%s),\n", $i, sub; - printf " \"(system %s) error with unknown subsystem\", %s },\n", - sub, $i; - break; - } +/^static.*err_[a-z0-9A-Z_]+_sub *\[/ { + s = $0; sub(/^.*err_/, "", s); sub(/_sub.*$/, "", s); + printf " [err_get_system (err_%s)] = { errlib_count (err_%s_sub),", + s, s; + printf "\"(system %s) error with unknown subsystem\", err_%s_sub },\n", + s, s; } END { print " };";