mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-25 19:04:57 -05:00
71 lines
1.5 KiB
Text
Executable file
71 lines
1.5 KiB
Text
Executable file
.\"
|
|
.\" Copyright (C) 2000 Internet Software Consortium.
|
|
#!/usr/bin/gawk -f
|
|
#
|
|
# $Id: ctoman,v 1.1 2000/06/01 03:19:06 jim Exp $
|
|
#
|
|
# ctoman - an awk program that makes a passable job of
|
|
# converting ISC BIND9 C files into template
|
|
# man pages
|
|
# Author: Jim Reid 1/6/00
|
|
#
|
|
BEGIN { quote = "\""
|
|
ftc = inc = fnc = arc = 1 }
|
|
|
|
|
|
# skip typedefs
|
|
/typedef/ { next }
|
|
# skip initialisations: lines ending in a semicolon
|
|
$0 ~ /;$/ { next }
|
|
# function return types
|
|
/^[a-z]/ && $0 !~ /\(/ { functypes[ftc++] = $0 }
|
|
|
|
# #include lines
|
|
/#include/ { while ((NF ==0) || ((NF > 0) && $0 ~ /#include/)) {
|
|
inclist[inc++] = $0
|
|
getline
|
|
}
|
|
}
|
|
|
|
# function names and argument prototypes
|
|
/^[a-z]/ && $0 ~ /\(/ {
|
|
str= $0
|
|
while ($NF != "{" ) {
|
|
next
|
|
str += $0
|
|
}
|
|
sub(/\(/, ":", str)
|
|
sub(/\).*{/, "", str)
|
|
gsub(/,./, ":", str)
|
|
arglist[arc++] = str
|
|
split(str, foo, ":")
|
|
funclist[fnc++] = foo[1]
|
|
}
|
|
|
|
#END { for (i = 1; i < inc; i++) print i, inclist[i] }
|
|
END {
|
|
while (getline < "/home/jim/bind9/doc/comment")
|
|
print
|
|
if (ftc != fnc)
|
|
print "FUNCTION NAME/RETURN COUNT MISMATCH"
|
|
for (i = 1; i < fnc - 1; i++)
|
|
print ".Nm", funclist[i], ","
|
|
print ".Nm", funclist[fnc - 1]
|
|
print ".Nd XXX"
|
|
print ".Sh SYNOPSIS"
|
|
for (i = 1; i < inc; i++)
|
|
print ".Fd", inclist[i]
|
|
for (i = 1; i < fnc; i++ ) {
|
|
print ".Ft", functypes[i]
|
|
print ".Fo", funclist[i]
|
|
j = split(arglist[i], foo, ":")
|
|
for (k = 2; k <= j; k++)
|
|
print ".Fa", quote foo[k] quote
|
|
print ".Fc"
|
|
}
|
|
print ".Sh DESCRIPTION"
|
|
print ".Sh RETURN VALUES"
|
|
print ".Sh SEE ALSO"
|
|
print ".Sh BUGS"
|
|
|
|
}
|