1 |
# AWK script used to print out "END SUBROUTINE" at the end of all the SUBROUTINES in |
2 |
# a module instead of just "END". Who put this in the F90 and standard and why. I wonder? |
3 |
# |
4 |
BEGIN{isub=0} |
5 |
/^ *[Ss][Uu][Bb][Rr][Oo][Uu][Tt][Ii][Nn][Ee]/,/^ *[Ee][Nn][Dd] *$/ {printf("%s",$0); isub=1} |
6 |
/^ *[Ee][Nn][Dd] *$/{if (isub==1){isub=2}} |
7 |
{ if ( isub==0 ) {} |
8 |
else if ( isub==1 ) {printf("\n")} |
9 |
else if ( isub==2 ) {printf(" SUBROUTINE\n");isub=0;printf(".") | "cat >&2"} |
10 |
} |
11 |
END{printf("\n") | "cat >&2"} |