FileName='/u/sf/cottrell/public_html/cgi.html'
/********************************************* */
/*Code fragment to set the Contentype subtype */
/*based on the file type (as determined by the*/
/*characters after the last . in the filename) */
/********************************************* */
L=LASTPOS('.',Filename); Type=''
IF L>0 THEN
IF LENGTH(FileName)>L THEN
Type=TRANSLATE(SUBSTR(FileName,L+1))
SELECT
WHEN Type='HTM' | Type='HTML' THEN
SAY 'Content-type: type/html'
WHEN Type='PS' THEN
SAY 'Content-type: application/postscript'
WHEN FIND('TXT RXX PL C',Type)/=0 | Type=''
THEN SAY 'Content-type: type/text'
OTHERWISE DO
SAY 'Content-type: type/html'; SAY ''
SAY 'Unknown Content-type="'Type'"'
EXIT
END
END
SAY '' /*Don't forget the second line*/
...