BEGIN { print "#include " print "#include " print "#include " print "static char *interp(int n) {" print "if (n == -1) return \"never supported\";" print "if (n == 0) return \"may be supported; need to test at runtime\";" print "if (n > 0) return \"always supported\";" print "return \"interpretation unknown\";" print "}" print "int main(int argc, char *argv[]) {"; print "char uname[500];" print "if (fgets(uname, sizeof(uname), stdin) == NULL || argc < 2) {" print "fprintf(stderr, \"Usage: uname -a | unistd_opts heading\\n\");" print "exit(EXIT_FAILURE);" print "}" print "FILE *out = fopen(\"unistd_opts.html\", \"w\");" print "fprintf(out, \"

%s

\\n\", argv[1]);" print "fprintf(out, \"

Values of Version Test Macros, Constants for Options and Option Groups, Execution-Time Symbolic Constants\\n\");" print "fprintf(out, \"from The Open Group Base Specifications Issue 6. IEEE Std 1003.1, 2004 Edition

\\n\");" print "fprintf(out, \"

The values shown here are for the system (from uname -a): %s
\\n\", uname);" print "fprintf(out, \"

This web page has been generated automatically from the program unistd_opts,\\n\");" print "fprintf(out, \"which itself was generated automatically from an awk script. To read more and to download\\n\");" print "fprintf(out, \"the programs (BSD-licensed Open Source), go to\\n\");" print "fprintf(out, \"www.basepath.com/aup.\\n\");" print "fprintf(out, \"

For more information on the option groups, go to\\n\");" print "fprintf(out, \"people.redhat.com/~drepper/posix-option-groups.html\\n\");" print "fprintf(out, \"and\\n\");" print "fprintf(out, \"The Single UNIX Specification, Version 3.\\n\");" } /^_/ { if (NR > 1) { do_macro(macro, option, desc) } macro = substr($0, 1, length($0) - 1) option = "" desc = "" next } /^\t\[/ { option = substr($0, 3) option = substr(option, 0, length(option) - 2) next } /^\t/ { gsub(//, "\\>"); desc = substr($0, 2, length($0) - 2) next } END { print "fprintf(out, \"


End.\\n\");" print "fclose(out);" print "exit(EXIT_SUCCESS);" print "}"; print "/* end */" } function do_macro(macro, option, desc) { n = match(macro, / \(LEGACY\)/) if (n > 0) { macro = substr(macro, 1, n - 1) desc = "(LEGACY) " desc } print "fprintf(out, \"

%s

\\n\", \"" macro "\");" if (option != "") print "fprintf(out, \"Option Code: %s\\n\", \"" option "\");" print "fprintf(out, \"

%s\\n\", \"" desc "\");" print "#ifdef " macro print "fprintf(out, \"

%s = %ld (%s)\\n\", \"" macro "\", (long)" macro ", interp(" macro "));" print "#else" print "fprintf(out, \"

%s is undefined (feature may or may not be supported)\\n\", \"" macro "\");" print "#endif" }