1 |
# AWK script to print out END FUNCTION at the end of all the FUNCTIONS. |
2 |
# For some reason F90 standard specifies this, instead of just END and so |
3 |
# some compilers choke if its not there - not sure why anyone would put |
4 |
# this in the standard! |
5 |
# |
6 |
BEGIN{isub=0} |
7 |
/^ .*[Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]/,/^ *[Ee][Nn][Dd] *$/ {printf("%s",$0); isub=1} |
8 |
/^ *[Ee][Nn][Dd] *$/{if (isub==1){isub=2}} |
9 |
{ if ( isub==0 ) {} |
10 |
else if ( isub==1 ) {printf("\n")} |
11 |
else if ( isub==2 ) {printf(" FUNCTION\n");isub=0;printf(".") | "cat >&2" } |
12 |
} |
13 |
END{printf("\n") | "cat >&2"} |