in reply to including the content of a .shtml file into a cgi page

If you use Apache2, you can tell it to post-process the output from your CGI script with the "includes" filter, which handles SSI:
AddOutputFilter INCLUDES .cgi

If you do this, please beware that all of the output is interpreted as a SSI, so you have to take that nobody can enter unescaped data into your script's output. But you should do that anyway in order to prevent cross-site scripting attacks.