TOMS451 is a FORTRAN77 library which implements ACM TOMS algorithm 451, which evaluates quantiles of the Chi-Square probability distribution.
The text of many ACM TOMS algorithms is available online through ACM: http://www.acm.org/pubs/calgo or NETLIB: http://www.netlib.org/toms/index.html.
TOMS451 is available in a FORTRAN77 version.
PROB, a FORTRAN90 library which contains numerous routines for handling the Chi square distribution and other probability distributions.
TEST_VALUES, a FORTRAN90 library which contains routines which return sample values of various functions, including the modified beta function, and the logarithm of the gamma function.
You can go up one level to the FORTRAN77 source codes.