#!/bin/sh
cat << \EOD
PGPLOT GRAPHICS SUBROUTINE LIBRARY Version 5.1

PGPLOT is a Fortran subroutine package for drawing graphs on a variety
of display devices. For more details, see the manual ``PGPLOT Graphics
Subroutine Library'' available from T. J. Pearson
(tjp@astro.caltech.edu).

INDEX OF ROUTINES

EOD

# Extract documentation from pgplot source code: output index of routines

awk '
/^C\*/ { print substr($0, 3, 500)}
' $*

# Extract documentation from pgplot source code: output ASCII text

awk '
/^C\*/ { print ""; print "";
         print "------------------------------------------------------------------------";
         print "Module: " substr($0, 3, 500);
         print "------------------------------------------------------------------------"; print "";
       }
/^C\+/ { echo = 1; getline }
/^C--/ { echo = 0}

echo == 1 && /^C/ {print substr($0, 3, 500) }

echo == 1 && !/^C/ { print }
' $*

