Blame mach/errsystems.awk

Packit Service 82fcde
BEGIN {
Packit Service 82fcde
  print "#include <errno.h>";
Packit Service 82fcde
  print "#include <mach/error.h>";
Packit Service 82fcde
  print "#include <errorlib.h>";
Packit Service 82fcde
  print "#define static static const";
Packit Service 82fcde
  nsubs = split(subsys, subs);
Packit Service 82fcde
  while (nsubs > 0) printf "#include \"%s\"\n", subs[nsubs--];
Packit Service 82fcde
  print "\n\n\
Packit Service 82fcde
const struct error_system __mach_error_systems[err_max_system + 1] =";
Packit Service 82fcde
  print "  {";
Packit Service 82fcde
}
Packit Service 82fcde
/^static.*err_[a-z0-9A-Z_]+_sub *\[/ {
Packit Service 82fcde
  s = $0; sub(/^.*err_/, "", s); sub(/_sub.*$/, "", s);
Packit Service 82fcde
  printf "    [err_get_system (err_%s)] = { errlib_count (err_%s_sub),",
Packit Service 82fcde
	s, s;
Packit Service 82fcde
  printf "\"(system %s) error with unknown subsystem\", err_%s_sub },\n",
Packit Service 82fcde
	s, s;
Packit Service 82fcde
}
Packit Service 82fcde
END {
Packit Service 82fcde
  print "  };";
Packit Service 82fcde
  print "\n\
Packit Service 82fcde
const int __mach_error_system_count = errlib_count (__mach_error_systems);";
Packit Service 82fcde
}