[Blog] [Twitter] [Facebook] [Linked In] [Github] [Flickr] [SUBSCRIBE] [Skype] Strava [FSF Associate Member]

 

TECO has now entered the realm of the internet

Thursday, 19 November 2009 20:18

So it's Friday and I feel like doing something a little fun although not really that useful.  Yesterday I made a crack about getting TECO running in a Common Gateway Interface environment.  Well, that's exactly what I decided to do.  What follows is a set of basic instructions for getting your favourite editor/language up and running as a CGI handler on OpenVMS using the WASD web server.

First things first.  The WASD_CONFIG_GLOBAL (or HTTPD$CONFIG in the pre-v10.0.0 releases) file needs a tweak to add support for the TECO interpreter.  The snippet below shows how to tell WASD what to do when it encounters a file ending in .TEC.

[DclScriptRunTime]
.TEC EDIT/TECO/NOCOMMAND/EXECUTE=

It is sufficient to simply use the command $ HTTPD/DO=RESTART to make this active.  Now, drop a procedure (like TECO_RULES.TEC) in CGI-BIN:[000000] and point your browser at the right address.  In the case of this example it is http://www.endlesssoftwaresolutions.com.au/cgi-bin/teco_rules.tec.

Seems easy, eh?  Well, there are just a couple things that need to be mentioned.  To fetch the CGI variables it is necessary to use the SYM built-in function.  For example, to fetch the REQUEST_METHOD you would use:

@:EG%SYM WWW_REQUEST_METHOD%

This will leave the value of the REQUEST_METHOD in the file buffer register *.

For POST requests it is necessary to retrieve the POST data from the HTTP$INPUT stream.  This can be opened and read just like a regular file using ER and the various Yank commands. 

The last thing to remember is that TECO CGI procedures, just like regular MUNG'd procedures, have some simple requirements.  The procedure must close the indirect input (like so, @EI%%) and terminate the file with ^C^C<ESC><ESC>.  In the case of the second ^C (as with the <ESC>s) it must be a literal ASCII 0x03.

So far there are no plans for a TECORTE to support persistent scripting, but who knows...? :-)

Links

The following links may prove useful to anyone interested in writing some CGI TECO.

[PRINT]  [PRINT]