#!/usr/local/bin/perl # freeport.cgi -- freeport server gateway CGI interface # # Written by Russell McOrmond of FLORA Community WEB # $Id: freeport_cgi,v 1.1 1998/10/06 00:47:48 tygerwww Exp $ # # See http://www.flora.ottawa.on.ca/flora/server/freeport/ # for more information. require "freeport.pl"; # Host where Email can be sent for Users who own files. $email_host = "flora.ottawa.on.ca"; # URL to point to for things that did not automatically translate $badfreeport = "http://www.flora.ottawa.on.ca/flora/server/freeport/"; # What is the URL for the un-translated files (for 'p' references) $ip_dir = "/ip"; # What is the URL of translated files. (for menus) $trans_name="/freeport"; # What is the URL for the 'pattern' CGI or gateway? (Unsupported!) $pattern_name="/pattern"; # match externalally represented commands. $command_pattern = '^(nr|\S*lynx|s?gopher|b?btelnet)\s'; # Filename passed on command line? if ($ENV{'GATEWAY_INTERFACE'} ne '') { # CGI mode... $CGI=1; # Filename passed by CGI ScriptAlias? $file = "/home/servers/freeport/ip$ENV{'PATH_INFO'}" } elsif ($ARGV[0] ne '') { # Command line file conversion mode! $CGI=0; $file = $ARGV[0]; } else { print STDERR "Usage: $0 menu_filename\n"; print STDERR "This program can also be executed as a CGI.\n"; exit 1; } &translate_freeport($file); exit 0; # Only error so far is the 'not found' error message...Otherwise, 'status' # needs to be checked. sub error { local($status, $msg) = @_; print < Freeport File not Found The file you requested was not found. EOF exit 2; } # Outputs Status. sub MIME_header { local($status, $content) = @_; if ($CGI) { print "Content-Type: $content\n\n"; } };