Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD » NetPlex/!Netplex/!RunImage/CGILibrary

NetPlex/!Netplex/!RunImage/CGILibrary

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD
Filename: NetPlex/!Netplex/!RunImage/CGILibrary
Read OK:
File size: 229C bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >CGILibrary
   20REM =========================================================================
   30REM Purpose: Support library for CGI programs
   40REM  Author: by David Thomas, LEN 1996-7
   50REM Version: 0.09 (05 Sep 1997)
   60REM =========================================================================
   70END
   80
   90REM 0.04 (03 Jan 1997) - Created cgi_statusline and cgi_headerline and
  100REM                      altered the rest of the program to use them.
  110REM 0.05 (21 Mar 1997) - cgi_redirect and cgi_polling added to allow
  120REM                      multitasking CGI.
  130REM 0.06 (30 Apr 1997) - cgi_decodeelement revised by Jimmy Imossi to
  140REM                      deal with the '+' to space character conversion.
  150REM 0.07 (24 Aug 1997) - cgi_redirect extended to allow redirection to be
  160REM                      deactivated and to allow any open CGI streams to be
  170REM                      closed safely.
  180REM                    - Descriptions added.
  190REM 0.08 (29 Aug 1997) - Small alterations for Np 0.21 release.
  201REM 0.09 (05 Sep 1997) - Again, small alterations for Np 0.22.
  202
  210DEF PROCcgi_init
  220REM -------------------------------------------------------------------------
  230REM Initialise the CGI support library
  240REM -------------------------------------------------------------------------
  250REM Establish an error handler
  260ON ERROR PROCcgi_error:END
  270REM Read the redirected stream handles
  280PROCcgi_redirect(-1)
  290REM Allocate a block of memory for miscellaneous use
  300DIM misc% 255
  310REM Initialise the flag which tells us whether we've output a header yet
  320cgi_headered%=FALSE
  330REM Decide which version of HTTP we need to respond using
  340http$=FNsystem_getvar("CGI$ServerProtocol")
  350http10%=http$="HTTP/1.0"
  360http11%=http$="HTTP/1.1"
  370keepalive%=INSTR(FNcase_lower(FNsystem_getvar("HTTP$Connection")),"keep-alive")<>0 OR http11%
  380REM Get our connection number, used for multitasking control
  390cgi_cn%=VAL FNsystem_getvar("CGI$ConnectionNumber")
  400REM Separator character for separating input elements
  410cgi_sep$="&"
  420REM Set to FALSE to stop error line numbers appearing in error reports
  430cgi_debug%=TRUE
  440ENDPROC
  450
  460DEF PROCcgi_closedown
  470REM -------------------------------------------------------------------------
  480REM Close down the CGI support library
  490REM -------------------------------------------------------------------------
  500REM Close the redirected streams
  510PROCcgi_redirect(2)
  520ENDPROC
  530
  540DEF PROCcgi_header(content_type$,content_length%)
  550REM -------------------------------------------------------------------------
  560REM Output an HTTP header
  570REM -------------------------------------------------------------------------
  580REM If we've not already sent a header...
  590IF NOT cgi_headered% THEN
  600  REM Content-Type
  610  PROCcgi_headerline("Content-Type",content_type$)
  620  REM Content-Length (if we have one)
  630  IF content_length%<>-1 THEN PROCcgi_headerline("Content-Length",STR$content_length%)
  640  REM Connection: Keep-Alive / Connection: Close (if applicable)
  650  IF keepalive% AND content_length%<>-1 THEN
  660    IF NOT http11% THEN PROCcgi_headerline("Connection","Keep-Alive")
  670  ELSE
  680    IF http11% THEN PROCcgi_headerline("Connection","Close")
  690  ENDIF
  700  REM Terminate the header with a blank line
  710  PROCcgi_headerline("","")
  720  REM We've now output a header, set the flag as such
  730  cgi_headered%=TRUE
  740ENDIF
  750ENDPROC
  760
  770DEF PROCcgi_statusline(code%,phrase$)
  780REM -------------------------------------------------------------------------
  790REM Output the initial status line of an HTTP header
  800REM -------------------------------------------------------------------------
  810PRINT http$;" ";STR$code%;" ";phrase$;CHR$13;CHR$10;
  820ENDPROC
  830
  840DEF PROCcgi_headerline(name$,value$)
  850REM -------------------------------------------------------------------------
  860REM Output subsequent lines of an HTTP header
  870REM -------------------------------------------------------------------------
  880IF name$<>"" THEN PRINT name$;": ";value$;
  890PRINT CHR$13;CHR$10;
  900ENDPROC
  910
  920DEF PROCcgi_error
  930REM -------------------------------------------------------------------------
  940REM Handle any errors that may occur
  950REM -------------------------------------------------------------------------
  960REM Safety first!
  970LOCAL ERROR
  980ON ERROR LOCAL RESTORE ERROR:ENDPROC
  990REM Log the error to the main Netplex log
 1000SYS "SysLog_LogMessage","Netplex","CGI "+REPORT$+" at line "+STR$ERL,120
 1010REM Note: At this point redirection will have been deactivated
 1020REM Delete the output stream and re-redirect it
 1030SYS "OS_Args",7,cgi_out%,misc%,,,256 TO ,,,,,l%:misc%?(256-l%)=13
 1040SYS "OS_Find",0,cgi_out%
 1050SYS "OS_File",6,misc%
 1060SYS "OS_Find",&8F,$misc% TO cgi_out%
 1070REM Reactivate redirection
 1080PROCcgi_redirect(1)
 1090REM Generate a report
 1100PROCcgi_statusline(500,"Internal Server Error")
 1110PROCcgi_headerline("Content-Type","text/html")
 1120PROCcgi_headerline("","")
 1130PRINT "<HTML><HEAD><TITLE>CGI Error</TITLE></HEAD><BODY>";
 1150PRINT "<H1>CGI Error</H1><HR>The CGI program returned the error :<BR>";
 1160PRINT "<CODE>"+REPORT$;
 1170IF cgi_debug% THEN PRINT " at line "+STR$ERL
 1190PRINT "</CODE>.</BODY></HTML>";
 1200REM Ensure that any multitasking flags are removed
 1210PROCcgi_polling(FALSE)
 1220RESTORE ERROR
 1230ENDPROC
 1240
 1250DEF FNcgi_nextelement
 1260REM -------------------------------------------------------------------------
 1270REM Return the next element from a POST operation
 1280REM -------------------------------------------------------------------------
 1290REM Read in and build up a string until we hit the end of file or an '&'
 1300LOCAL e$,c%,s%
 1310IF EOF#cgi_in% THEN =""
 1320e$="":s%=ASC(cgi_sep$)
 1330REPEAT
 1340  c%=BGET#cgi_in%
 1350  IF c%<>s% THEN e$+=CHR$(c%)
 1360UNTIL c%=s% OR EOF#cgi_in%
 1370=e$
 1380
 1390DEF FNcgi_nextelementdecoded
 1400REM -------------------------------------------------------------------------
 1410REM Return the next element from a POST operation, URL decoded
 1420REM -------------------------------------------------------------------------
 1430=FNcgi_decodeelement(FNcgi_nextelement)
 1440
 1450DEF FNcgi_decodeelement(e$)
 1460REM -------------------------------------------------------------------------
 1470REM Decode a string which has been URL encoded
 1480REM -------------------------------------------------------------------------
 1490REM Loop through the string until we find '+' or '%hh'.  '+' becomes a space,
 1500REM '%hh' is converted into the equivalent ASCII character.
 1510LOCAL m$,d$,c%
 1520d$=""
 1530FOR c%=1 TO LEN e$
 1540  m$=MID$(e$,c%,1)
 1550  IF m$="+" THEN m$=" "
 1560  IF m$="%" THEN m$=CHR$EVAL("&"+MID$(e$,c%+1,2)):c%+=2
 1570  d$+=m$
 1580NEXT
 1590=d$
 1600
 1610DEF PROCcgi_redirect(op%)
 1620REM -------------------------------------------------------------------------
 1630REM Alter the way data is input and output to/from the standard streams
 1640REM -------------------------------------------------------------------------
 1650CASE op% OF
 1660  WHEN -1,0
 1670  REM -1: Read handles or 0:Deactivate redirection
 1680  SYS "OS_ChangeRedirection",op%,op% TO cgi_in%,cgi_out%
 1690  WHEN 1
 1700  REM 1: Reactivate redirection - expects valid cgi_in%,cgi_out%
 1710  SYS "OS_ChangeRedirection",cgi_in%,cgi_out%
 1720  WHEN 2
 1730  REM 2: Close streams
 1740  IF cgi_in% THEN SYS "OS_Find",0,cgi_in%
 1750  IF cgi_out% THEN SYS "OS_Find",0,cgi_out%
 1760ENDCASE
 1770ENDPROC
 1780
 1790DEF PROCcgi_polling(on%)
 1800REM -------------------------------------------------------------------------
 1810REM Set a system variable which informs the server that we're going to be
 1820REM operating over one or more calls to Wimp_Poll
 1830REM -------------------------------------------------------------------------
 1840IF on% THEN
 1850  PROCsystem_setliteral("CGI$Active_"+STR$~cgi_cn%,"Yes")
 1860ELSE
 1870  PROCsystem_unset("CGI$Active_"+STR$~cgi_cn%)
 1880ENDIF
 1890ENDPROC
 1900
 1910DEF FNmime(filetype%)
 1920REM -------------------------------------------------------------------------
 1930REM Convert common filetypes into their equivalent MIME content-types.
 1940REM -------------------------------------------------------------------------
 1950CASE filetype% OF
 1960  WHEN &FFF:="text/plain"
 1970  WHEN &FAF:="text/html"
 1980  WHEN &C85:="image/jpeg"
 1990  WHEN &695:="image/gif"
 2000  WHEN &DDC:="application/x-sparkive"
 2010  WHEN &3FB:="application/x-arcfs"
 2020  WHEN &3DD:="application/x-zip"
 2030  WHEN &FFB:="application/x-bbc-basic"
 2040ENDCASE
 2050="application/octet-stream"
 2060
 2070
 2080REM -- String --------------------------------------------------------------
 2090DEF FNstring_readtoctrl(RETURN p%)
 2100LOCAL s$
 2110SYS "AppEngine_StringOp",1,p% TO ,p%,s$
 2120=s$
 2130
 2140DEF FNvar(p%)=FNstring_readtoctrl(p%)
 2150
 2160DEF FNcase_lower(s$)
 2170SYS "AppEngine_StringOp",4,s$ TO ,,s$
 2180=s$
 2190
 2200DEF FNcase_upper(s$)
 2210SYS "AppEngine_StringOp",5,s$ TO ,,s$
 2220=s$
 2230REM -------------------------------------------------------------- String --
 2240
 2250REM -- System --------------------------------------------------------------
 2260DEF PROCsystem_setliteral(var$,val$)
 2270REM 4 = LiteralString, will not be OS_GSTrans'd.
 2280SYS "OS_SetVarVal",var$,val$,LEN val$,0,4
 2290ENDPROC
 2300
 2310DEF FNsystem_getvar(var$)
 2320REM Note: Expands the returned string.
 2330LOCAL b%
 2340SYS "XOS_ReadVarVal",var$,misc%,256,0,3 TO ,,b%
 2350IF b%=0 THEN ="" ELSE misc%?b%=13
 2360=$misc%
 2370
 2380DEF PROCsystem_unset(var$)
 2390SYS "OS_SetVarVal",var$,,-1
 2400ENDPROC
 2410REM -------------------------------------------------------------- System --

� >CGILibrary
O� =========================================================================
/� Purpose: Support library for CGI programs
((�  Author: by David Thomas, � 1996-7
2!� Version: 0.09 (05 Sep 1997)
<O� =========================================================================
F�
P
ZH� 0.04 (03 Jan 1997) - Created cgi_statusline and cgi_headerline and
dG�                      altered the rest of the program to use them.
nF� 0.05 (21 Mar 1997) - cgi_redirect and cgi_polling added to allow
x,�                      multitasking CGI.
�G� 0.06 (30 Apr 1997) - cgi_decodeelement revised by Jimmy Imossi to
�K�                      deal with the '+' to space character conversion.
�K� 0.07 (24 Aug 1997) - cgi_redirect extended to allow redirection to be
�N�                      deactivated and to allow any open CGI streams to be
�)�                      closed safely.
�.�                    - Descriptions added.
�A� 0.08 (29 Aug 1997) - Small alterations for Np 0.21 release.
�@� 0.09 (05 Sep 1997) - Again, small alterations for Np 0.22.
�
�� �cgi_init
�O� -------------------------------------------------------------------------
�(� Initialise the CGI support library
�O� -------------------------------------------------------------------------
� � Establish an error handler
� � �cgi_error:�
(� Read the redirected stream handles
�cgi_redirect(-1)
"6� Allocate a block of memory for miscellaneous use
,� misc% 255
6J� Initialise the flag which tells us whether we've output a header yet
@cgi_headered%=�
J;� Decide which version of HTTP we need to respond using
T.http$=�system_getvar("CGI$ServerProtocol")
^http10%=http$="HTTP/1.0"
hhttp11%=http$="HTTP/1.1"
rYkeepalive%=��case_lower(�system_getvar("HTTP$Connection")),"keep-alive")<>0 � http11%
|>� Get our connection number, used for multitasking control
�4cgi_cn%=� �system_getvar("CGI$ConnectionNumber")
�7� Separator character for separating input elements
�cgi_sep$="&"
�H� Set to FALSE to stop error line numbers appearing in error reports
�cgi_debug%=�
��
�
�� �cgi_closedown
�O� -------------------------------------------------------------------------
�(� Close down the CGI support library
�O� -------------------------------------------------------------------------
�"� Close the redirected streams
��cgi_redirect(2)
�

0� �cgi_header(content_type$,content_length%)
&O� -------------------------------------------------------------------------
0� Output an HTTP header
:O� -------------------------------------------------------------------------
D+� If we've not already sent a header...
N� � cgi_headered% �
X  � Content-Type
b3  �cgi_headerline("Content-Type",content_type$)
l'  � Content-Length (if we have one)
vP  � content_length%<>-1 � �cgi_headerline("Content-Length",�content_length%)
�B  � Connection: Keep-Alive / Connection: Close (if applicable)
�*  � keepalive% � content_length%<>-1 �
�@    � � http11% � �cgi_headerline("Connection","Keep-Alive")
�  �
�9    � http11% � �cgi_headerline("Connection","Close")
�  �
�.  � Terminate the header with a blank line
�  �cgi_headerline("","")
�7  � We've now output a header, set the flag as such
�  cgi_headered%=�
��
��
�
$� �cgi_statusline(code%,phrase$)
O� -------------------------------------------------------------------------
6� Output the initial status line of an HTTP header
 O� -------------------------------------------------------------------------
*+� http$;" ";�code%;" ";phrase$;�13;�10;
4�
>
H#� �cgi_headerline(name$,value$)
RO� -------------------------------------------------------------------------
\/� Output subsequent lines of an HTTP header
fO� -------------------------------------------------------------------------
p&� name$<>"" � � name$;": ";value$;
z� �13;�10;
��
�
�� �cgi_error
�O� -------------------------------------------------------------------------
�&� Handle any errors that may occur
�O� -------------------------------------------------------------------------
�� Safety first!
�� �
�� � � � �:�
�+� Log the error to the main Netplex log
�Aș "SysLog_LogMessage","Netplex","CGI "+�$+" at line "+Þ,120
�@� Note: At this point redirection will have been deactivated
�1� Delete the output stream and re-redirect it
Cș "OS_Args",7,cgi_out%,misc%,,,256 � ,,,,,l%:misc%?(256-l%)=13
ș "OS_Find",0,cgi_out%
ș "OS_File",6,misc%
$&ș "OS_Find",&8F,$misc% � cgi_out%
.� Reactivate redirection
8�cgi_redirect(1)
B� Generate a report
L0�cgi_statusline(500,"Internal Server Error")
V/�cgi_headerline("Content-Type","text/html")
`�cgi_headerline("","")
j:� "<HTML><HEAD><TITLE>CGI Error</TITLE></HEAD><BODY>";
~G� "<H1>CGI Error</H1><HR>The CGI program returned the error :<BR>";
�� "<CODE>"+�$;
�#� cgi_debug% � � " at line "+Þ
�� "</CODE>.</BODY></HTML>";
�4� Ensure that any multitasking flags are removed
��cgi_polling(�)
�� �
��
�
�� �cgi_nextelement
�O� -------------------------------------------------------------------------
�3� Return the next element from a POST operation
O� -------------------------------------------------------------------------

J� Read in and build up a string until we hit the end of file or an '&'
� e$,c%,s%
� �#cgi_in% � =""
(e$="":s%=�(cgi_sep$)
2�
<  c%=�#cgi_in%
F  � c%<>s% � e$+=�(c%)
P� c%=s% � �#cgi_in%
Z=e$
d
n� �cgi_nextelementdecoded
xO� -------------------------------------------------------------------------
�@� Return the next element from a POST operation, URL decoded
�O� -------------------------------------------------------------------------
�)=�cgi_decodeelement(�cgi_nextelement)
�
�� �cgi_decodeelement(e$)
�O� -------------------------------------------------------------------------
�0� Decode a string which has been URL encoded
�O� -------------------------------------------------------------------------
�O� Loop through the string until we find '+' or '%hh'.  '+' becomes a space,
�=� '%hh' is converted into the equivalent ASCII character.
�� m$,d$,c%
�	d$=""
�� c%=1 � � e$
  m$=�e$,c%,1)
  � m$="+" � m$=" "
-  � m$="%" � m$=��("&"+�e$,c%+1,2)):c%+=2
"  d$+=m$
,�
6=d$
@
J� �cgi_redirect(op%)
TO� -------------------------------------------------------------------------
^I� Alter the way data is input and output to/from the standard streams
hO� -------------------------------------------------------------------------
rȎ op% �
|  � -1,0
�4  � -1: Read handles or 0:Deactivate redirection
�:  ș "OS_ChangeRedirection",op%,op% � cgi_in%,cgi_out%
�	  � 1
�B  � 1: Reactivate redirection - expects valid cgi_in%,cgi_out%
�0  ș "OS_ChangeRedirection",cgi_in%,cgi_out%
�	  � 2
�  � 2: Close streams
�(  � cgi_in% � ș "OS_Find",0,cgi_in%
�*  � cgi_out% � ș "OS_Find",0,cgi_out%
��
��
�
�� �cgi_polling(on%)
O� -------------------------------------------------------------------------
K� Set a system variable which informs the server that we're going to be
3� operating over one or more calls to Wimp_Poll
&O� -------------------------------------------------------------------------
0� on% �
:7  �system_setliteral("CGI$Active_"+�~cgi_cn%,"Yes")
D�
N,  �system_unset("CGI$Active_"+�~cgi_cn%)
X�
b�
l
v� �mime(filetype%)
�O� -------------------------------------------------------------------------
�H� Convert common filetypes into their equivalent MIME content-types.
�O� -------------------------------------------------------------------------
�Ȏ filetype% �
�  � &FFF:="text/plain"
�  � &FAF:="text/html"
�  � &C85:="image/jpeg"
�  � &695:="image/gif"
�&  � &DDC:="application/x-sparkive"
�#  � &3FB:="application/x-arcfs"
�!  � &3DD:="application/x-zip"
�'  � &FFB:="application/x-bbc-basic"
��
="application/octet-stream"


 N� -- String --------------------------------------------------------------
*� �string_readtoctrl(� p%)
4� s$
>)ș "AppEngine_StringOp",1,p% � ,p%,s$
H=s$
R
\%� �var(p%)=�string_readtoctrl(p%)
f
p� �case_lower(s$)
z'ș "AppEngine_StringOp",4,s$ � ,,s$
�=s$
�
�� �case_upper(s$)
�'ș "AppEngine_StringOp",5,s$ � ,,s$
�=s$
�N� -------------------------------------------------------------- String --
�
�N� -- System --------------------------------------------------------------
�#� �system_setliteral(var$,val$)
�2� 4 = LiteralString, will not be OS_GSTrans'd.
�*ș "OS_SetVarVal",var$,val$,� val$,0,4
��
�
	� �system_getvar(var$)
	(� Note: Expands the returned string.
	� b%
	$1ș "XOS_ReadVarVal",var$,misc%,256,0,3 � ,,b%
	.� b%=0 � ="" � misc%?b%=13
	8=$misc%
	B
	L� �system_unset(var$)
	Vș "OS_SetVarVal",var$,,-1
	`�
	jN� -------------------------------------------------------------- System --
�
00000000  0d 00 0a 11 f4 20 3e 43  47 49 4c 69 62 72 61 72  |..... >CGILibrar|
00000010  79 0d 00 14 4f f4 20 3d  3d 3d 3d 3d 3d 3d 3d 3d  |y...O. =========|
00000020  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00000060  0d 00 1e 2f f4 20 50 75  72 70 6f 73 65 3a 20 53  |.../. Purpose: S|
00000070  75 70 70 6f 72 74 20 6c  69 62 72 61 72 79 20 66  |upport library f|
00000080  6f 72 20 43 47 49 20 70  72 6f 67 72 61 6d 73 0d  |or CGI programs.|
00000090  00 28 28 f4 20 20 41 75  74 68 6f 72 3a 20 62 79  |.((.  Author: by|
000000a0  20 44 61 76 69 64 20 54  68 6f 6d 61 73 2c 20 a9  | David Thomas, .|
000000b0  20 31 39 39 36 2d 37 0d  00 32 21 f4 20 56 65 72  | 1996-7..2!. Ver|
000000c0  73 69 6f 6e 3a 20 30 2e  30 39 20 28 30 35 20 53  |sion: 0.09 (05 S|
000000d0  65 70 20 31 39 39 37 29  0d 00 3c 4f f4 20 3d 3d  |ep 1997)..<O. ==|
000000e0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00000120  3d 3d 3d 3d 3d 3d 3d 0d  00 46 05 e0 0d 00 50 04  |=======..F....P.|
00000130  0d 00 5a 48 f4 20 30 2e  30 34 20 28 30 33 20 4a  |..ZH. 0.04 (03 J|
00000140  61 6e 20 31 39 39 37 29  20 2d 20 43 72 65 61 74  |an 1997) - Creat|
00000150  65 64 20 63 67 69 5f 73  74 61 74 75 73 6c 69 6e  |ed cgi_statuslin|
00000160  65 20 61 6e 64 20 63 67  69 5f 68 65 61 64 65 72  |e and cgi_header|
00000170  6c 69 6e 65 20 61 6e 64  0d 00 64 47 f4 20 20 20  |line and..dG.   |
00000180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000190  20 20 20 61 6c 74 65 72  65 64 20 74 68 65 20 72  |   altered the r|
000001a0  65 73 74 20 6f 66 20 74  68 65 20 70 72 6f 67 72  |est of the progr|
000001b0  61 6d 20 74 6f 20 75 73  65 20 74 68 65 6d 2e 0d  |am to use them..|
000001c0  00 6e 46 f4 20 30 2e 30  35 20 28 32 31 20 4d 61  |.nF. 0.05 (21 Ma|
000001d0  72 20 31 39 39 37 29 20  2d 20 63 67 69 5f 72 65  |r 1997) - cgi_re|
000001e0  64 69 72 65 63 74 20 61  6e 64 20 63 67 69 5f 70  |direct and cgi_p|
000001f0  6f 6c 6c 69 6e 67 20 61  64 64 65 64 20 74 6f 20  |olling added to |
00000200  61 6c 6c 6f 77 0d 00 78  2c f4 20 20 20 20 20 20  |allow..x,.      |
00000210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000220  6d 75 6c 74 69 74 61 73  6b 69 6e 67 20 43 47 49  |multitasking CGI|
00000230  2e 0d 00 82 47 f4 20 30  2e 30 36 20 28 33 30 20  |....G. 0.06 (30 |
00000240  41 70 72 20 31 39 39 37  29 20 2d 20 63 67 69 5f  |Apr 1997) - cgi_|
00000250  64 65 63 6f 64 65 65 6c  65 6d 65 6e 74 20 72 65  |decodeelement re|
00000260  76 69 73 65 64 20 62 79  20 4a 69 6d 6d 79 20 49  |vised by Jimmy I|
00000270  6d 6f 73 73 69 20 74 6f  0d 00 8c 4b f4 20 20 20  |mossi to...K.   |
00000280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000290  20 20 20 64 65 61 6c 20  77 69 74 68 20 74 68 65  |   deal with the|
000002a0  20 27 2b 27 20 74 6f 20  73 70 61 63 65 20 63 68  | '+' to space ch|
000002b0  61 72 61 63 74 65 72 20  63 6f 6e 76 65 72 73 69  |aracter conversi|
000002c0  6f 6e 2e 0d 00 96 4b f4  20 30 2e 30 37 20 28 32  |on....K. 0.07 (2|
000002d0  34 20 41 75 67 20 31 39  39 37 29 20 2d 20 63 67  |4 Aug 1997) - cg|
000002e0  69 5f 72 65 64 69 72 65  63 74 20 65 78 74 65 6e  |i_redirect exten|
000002f0  64 65 64 20 74 6f 20 61  6c 6c 6f 77 20 72 65 64  |ded to allow red|
00000300  69 72 65 63 74 69 6f 6e  20 74 6f 20 62 65 0d 00  |irection to be..|
00000310  a0 4e f4 20 20 20 20 20  20 20 20 20 20 20 20 20  |.N.             |
00000320  20 20 20 20 20 20 20 20  20 64 65 61 63 74 69 76  |         deactiv|
00000330  61 74 65 64 20 61 6e 64  20 74 6f 20 61 6c 6c 6f  |ated and to allo|
00000340  77 20 61 6e 79 20 6f 70  65 6e 20 43 47 49 20 73  |w any open CGI s|
00000350  74 72 65 61 6d 73 20 74  6f 20 62 65 0d 00 aa 29  |treams to be...)|
00000360  f4 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000370  20 20 20 20 20 20 20 63  6c 6f 73 65 64 20 73 61  |       closed sa|
00000380  66 65 6c 79 2e 0d 00 b4  2e f4 20 20 20 20 20 20  |fely......      |
00000390  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2d 20  |              - |
000003a0  44 65 73 63 72 69 70 74  69 6f 6e 73 20 61 64 64  |Descriptions add|
000003b0  65 64 2e 0d 00 be 41 f4  20 30 2e 30 38 20 28 32  |ed....A. 0.08 (2|
000003c0  39 20 41 75 67 20 31 39  39 37 29 20 2d 20 53 6d  |9 Aug 1997) - Sm|
000003d0  61 6c 6c 20 61 6c 74 65  72 61 74 69 6f 6e 73 20  |all alterations |
000003e0  66 6f 72 20 4e 70 20 30  2e 32 31 20 72 65 6c 65  |for Np 0.21 rele|
000003f0  61 73 65 2e 0d 00 c9 40  f4 20 30 2e 30 39 20 28  |ase....@. 0.09 (|
00000400  30 35 20 53 65 70 20 31  39 39 37 29 20 2d 20 41  |05 Sep 1997) - A|
00000410  67 61 69 6e 2c 20 73 6d  61 6c 6c 20 61 6c 74 65  |gain, small alte|
00000420  72 61 74 69 6f 6e 73 20  66 6f 72 20 4e 70 20 30  |rations for Np 0|
00000430  2e 32 32 2e 0d 00 ca 04  0d 00 d2 0f dd 20 f2 63  |.22.......... .c|
00000440  67 69 5f 69 6e 69 74 0d  00 dc 4f f4 20 2d 2d 2d  |gi_init...O. ---|
00000450  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000490  2d 2d 2d 2d 2d 2d 0d 00  e6 28 f4 20 49 6e 69 74  |------...(. Init|
000004a0  69 61 6c 69 73 65 20 74  68 65 20 43 47 49 20 73  |ialise the CGI s|
000004b0  75 70 70 6f 72 74 20 6c  69 62 72 61 72 79 0d 00  |upport library..|
000004c0  f0 4f f4 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.O. ------------|
000004d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000500  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0d 00 fa  |-------------...|
00000510  20 f4 20 45 73 74 61 62  6c 69 73 68 20 61 6e 20  | . Establish an |
00000520  65 72 72 6f 72 20 68 61  6e 64 6c 65 72 0d 01 04  |error handler...|
00000530  14 ee 20 85 20 f2 63 67  69 5f 65 72 72 6f 72 3a  |.. . .cgi_error:|
00000540  e0 0d 01 0e 28 f4 20 52  65 61 64 20 74 68 65 20  |....(. Read the |
00000550  72 65 64 69 72 65 63 74  65 64 20 73 74 72 65 61  |redirected strea|
00000560  6d 20 68 61 6e 64 6c 65  73 0d 01 18 15 f2 63 67  |m handles.....cg|
00000570  69 5f 72 65 64 69 72 65  63 74 28 2d 31 29 0d 01  |i_redirect(-1)..|
00000580  22 36 f4 20 41 6c 6c 6f  63 61 74 65 20 61 20 62  |"6. Allocate a b|
00000590  6c 6f 63 6b 20 6f 66 20  6d 65 6d 6f 72 79 20 66  |lock of memory f|
000005a0  6f 72 20 6d 69 73 63 65  6c 6c 61 6e 65 6f 75 73  |or miscellaneous|
000005b0  20 75 73 65 0d 01 2c 0f  de 20 6d 69 73 63 25 20  | use..,.. misc% |
000005c0  32 35 35 0d 01 36 4a f4  20 49 6e 69 74 69 61 6c  |255..6J. Initial|
000005d0  69 73 65 20 74 68 65 20  66 6c 61 67 20 77 68 69  |ise the flag whi|
000005e0  63 68 20 74 65 6c 6c 73  20 75 73 20 77 68 65 74  |ch tells us whet|
000005f0  68 65 72 20 77 65 27 76  65 20 6f 75 74 70 75 74  |her we've output|
00000600  20 61 20 68 65 61 64 65  72 20 79 65 74 0d 01 40  | a header yet..@|
00000610  13 63 67 69 5f 68 65 61  64 65 72 65 64 25 3d a3  |.cgi_headered%=.|
00000620  0d 01 4a 3b f4 20 44 65  63 69 64 65 20 77 68 69  |..J;. Decide whi|
00000630  63 68 20 76 65 72 73 69  6f 6e 20 6f 66 20 48 54  |ch version of HT|
00000640  54 50 20 77 65 20 6e 65  65 64 20 74 6f 20 72 65  |TP we need to re|
00000650  73 70 6f 6e 64 20 75 73  69 6e 67 0d 01 54 2e 68  |spond using..T.h|
00000660  74 74 70 24 3d a4 73 79  73 74 65 6d 5f 67 65 74  |ttp$=.system_get|
00000670  76 61 72 28 22 43 47 49  24 53 65 72 76 65 72 50  |var("CGI$ServerP|
00000680  72 6f 74 6f 63 6f 6c 22  29 0d 01 5e 1c 68 74 74  |rotocol")..^.htt|
00000690  70 31 30 25 3d 68 74 74  70 24 3d 22 48 54 54 50  |p10%=http$="HTTP|
000006a0  2f 31 2e 30 22 0d 01 68  1c 68 74 74 70 31 31 25  |/1.0"..h.http11%|
000006b0  3d 68 74 74 70 24 3d 22  48 54 54 50 2f 31 2e 31  |=http$="HTTP/1.1|
000006c0  22 0d 01 72 59 6b 65 65  70 61 6c 69 76 65 25 3d  |"..rYkeepalive%=|
000006d0  a7 a4 63 61 73 65 5f 6c  6f 77 65 72 28 a4 73 79  |..case_lower(.sy|
000006e0  73 74 65 6d 5f 67 65 74  76 61 72 28 22 48 54 54  |stem_getvar("HTT|
000006f0  50 24 43 6f 6e 6e 65 63  74 69 6f 6e 22 29 29 2c  |P$Connection")),|
00000700  22 6b 65 65 70 2d 61 6c  69 76 65 22 29 3c 3e 30  |"keep-alive")<>0|
00000710  20 84 20 68 74 74 70 31  31 25 0d 01 7c 3e f4 20  | . http11%..|>. |
00000720  47 65 74 20 6f 75 72 20  63 6f 6e 6e 65 63 74 69  |Get our connecti|
00000730  6f 6e 20 6e 75 6d 62 65  72 2c 20 75 73 65 64 20  |on number, used |
00000740  66 6f 72 20 6d 75 6c 74  69 74 61 73 6b 69 6e 67  |for multitasking|
00000750  20 63 6f 6e 74 72 6f 6c  0d 01 86 34 63 67 69 5f  | control...4cgi_|
00000760  63 6e 25 3d bb 20 a4 73  79 73 74 65 6d 5f 67 65  |cn%=. .system_ge|
00000770  74 76 61 72 28 22 43 47  49 24 43 6f 6e 6e 65 63  |tvar("CGI$Connec|
00000780  74 69 6f 6e 4e 75 6d 62  65 72 22 29 0d 01 90 37  |tionNumber")...7|
00000790  f4 20 53 65 70 61 72 61  74 6f 72 20 63 68 61 72  |. Separator char|
000007a0  61 63 74 65 72 20 66 6f  72 20 73 65 70 61 72 61  |acter for separa|
000007b0  74 69 6e 67 20 69 6e 70  75 74 20 65 6c 65 6d 65  |ting input eleme|
000007c0  6e 74 73 0d 01 9a 10 63  67 69 5f 73 65 70 24 3d  |nts....cgi_sep$=|
000007d0  22 26 22 0d 01 a4 48 f4  20 53 65 74 20 74 6f 20  |"&"...H. Set to |
000007e0  46 41 4c 53 45 20 74 6f  20 73 74 6f 70 20 65 72  |FALSE to stop er|
000007f0  72 6f 72 20 6c 69 6e 65  20 6e 75 6d 62 65 72 73  |ror line numbers|
00000800  20 61 70 70 65 61 72 69  6e 67 20 69 6e 20 65 72  | appearing in er|
00000810  72 6f 72 20 72 65 70 6f  72 74 73 0d 01 ae 10 63  |ror reports....c|
00000820  67 69 5f 64 65 62 75 67  25 3d b9 0d 01 b8 05 e1  |gi_debug%=......|
00000830  0d 01 c2 04 0d 01 cc 14  dd 20 f2 63 67 69 5f 63  |......... .cgi_c|
00000840  6c 6f 73 65 64 6f 77 6e  0d 01 d6 4f f4 20 2d 2d  |losedown...O. --|
00000850  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000890  2d 2d 2d 2d 2d 2d 2d 0d  01 e0 28 f4 20 43 6c 6f  |-------...(. Clo|
000008a0  73 65 20 64 6f 77 6e 20  74 68 65 20 43 47 49 20  |se down the CGI |
000008b0  73 75 70 70 6f 72 74 20  6c 69 62 72 61 72 79 0d  |support library.|
000008c0  01 ea 4f f4 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..O. -----------|
000008d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000900  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0d 01  |--------------..|
00000910  f4 22 f4 20 43 6c 6f 73  65 20 74 68 65 20 72 65  |.". Close the re|
00000920  64 69 72 65 63 74 65 64  20 73 74 72 65 61 6d 73  |directed streams|
00000930  0d 01 fe 14 f2 63 67 69  5f 72 65 64 69 72 65 63  |.....cgi_redirec|
00000940  74 28 32 29 0d 02 08 05  e1 0d 02 12 04 0d 02 1c  |t(2)............|
00000950  30 dd 20 f2 63 67 69 5f  68 65 61 64 65 72 28 63  |0. .cgi_header(c|
00000960  6f 6e 74 65 6e 74 5f 74  79 70 65 24 2c 63 6f 6e  |ontent_type$,con|
00000970  74 65 6e 74 5f 6c 65 6e  67 74 68 25 29 0d 02 26  |tent_length%)..&|
00000980  4f f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |O. -------------|
00000990  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000009c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0d 02 30 1b  |------------..0.|
000009d0  f4 20 4f 75 74 70 75 74  20 61 6e 20 48 54 54 50  |. Output an HTTP|
000009e0  20 68 65 61 64 65 72 0d  02 3a 4f f4 20 2d 2d 2d  | header..:O. ---|
000009f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000a30  2d 2d 2d 2d 2d 2d 0d 02  44 2b f4 20 49 66 20 77  |------..D+. If w|
00000a40  65 27 76 65 20 6e 6f 74  20 61 6c 72 65 61 64 79  |e've not already|
00000a50  20 73 65 6e 74 20 61 20  68 65 61 64 65 72 2e 2e  | sent a header..|
00000a60  2e 0d 02 4e 17 e7 20 ac  20 63 67 69 5f 68 65 61  |...N.. . cgi_hea|
00000a70  64 65 72 65 64 25 20 8c  0d 02 58 14 20 20 f4 20  |dered% ...X.  . |
00000a80  43 6f 6e 74 65 6e 74 2d  54 79 70 65 0d 02 62 33  |Content-Type..b3|
00000a90  20 20 f2 63 67 69 5f 68  65 61 64 65 72 6c 69 6e  |  .cgi_headerlin|
00000aa0  65 28 22 43 6f 6e 74 65  6e 74 2d 54 79 70 65 22  |e("Content-Type"|
00000ab0  2c 63 6f 6e 74 65 6e 74  5f 74 79 70 65 24 29 0d  |,content_type$).|
00000ac0  02 6c 27 20 20 f4 20 43  6f 6e 74 65 6e 74 2d 4c  |.l'  . Content-L|
00000ad0  65 6e 67 74 68 20 28 69  66 20 77 65 20 68 61 76  |ength (if we hav|
00000ae0  65 20 6f 6e 65 29 0d 02  76 50 20 20 e7 20 63 6f  |e one)..vP  . co|
00000af0  6e 74 65 6e 74 5f 6c 65  6e 67 74 68 25 3c 3e 2d  |ntent_length%<>-|
00000b00  31 20 8c 20 f2 63 67 69  5f 68 65 61 64 65 72 6c  |1 . .cgi_headerl|
00000b10  69 6e 65 28 22 43 6f 6e  74 65 6e 74 2d 4c 65 6e  |ine("Content-Len|
00000b20  67 74 68 22 2c c3 63 6f  6e 74 65 6e 74 5f 6c 65  |gth",.content_le|
00000b30  6e 67 74 68 25 29 0d 02  80 42 20 20 f4 20 43 6f  |ngth%)...B  . Co|
00000b40  6e 6e 65 63 74 69 6f 6e  3a 20 4b 65 65 70 2d 41  |nnection: Keep-A|
00000b50  6c 69 76 65 20 2f 20 43  6f 6e 6e 65 63 74 69 6f  |live / Connectio|
00000b60  6e 3a 20 43 6c 6f 73 65  20 28 69 66 20 61 70 70  |n: Close (if app|
00000b70  6c 69 63 61 62 6c 65 29  0d 02 8a 2a 20 20 e7 20  |licable)...*  . |
00000b80  6b 65 65 70 61 6c 69 76  65 25 20 80 20 63 6f 6e  |keepalive% . con|
00000b90  74 65 6e 74 5f 6c 65 6e  67 74 68 25 3c 3e 2d 31  |tent_length%<>-1|
00000ba0  20 8c 0d 02 94 40 20 20  20 20 e7 20 ac 20 68 74  | ....@    . . ht|
00000bb0  74 70 31 31 25 20 8c 20  f2 63 67 69 5f 68 65 61  |tp11% . .cgi_hea|
00000bc0  64 65 72 6c 69 6e 65 28  22 43 6f 6e 6e 65 63 74  |derline("Connect|
00000bd0  69 6f 6e 22 2c 22 4b 65  65 70 2d 41 6c 69 76 65  |ion","Keep-Alive|
00000be0  22 29 0d 02 9e 07 20 20  cc 0d 02 a8 39 20 20 20  |")....  ....9   |
00000bf0  20 e7 20 68 74 74 70 31  31 25 20 8c 20 f2 63 67  | . http11% . .cg|
00000c00  69 5f 68 65 61 64 65 72  6c 69 6e 65 28 22 43 6f  |i_headerline("Co|
00000c10  6e 6e 65 63 74 69 6f 6e  22 2c 22 43 6c 6f 73 65  |nnection","Close|
00000c20  22 29 0d 02 b2 07 20 20  cd 0d 02 bc 2e 20 20 f4  |")....  .....  .|
00000c30  20 54 65 72 6d 69 6e 61  74 65 20 74 68 65 20 68  | Terminate the h|
00000c40  65 61 64 65 72 20 77 69  74 68 20 61 20 62 6c 61  |eader with a bla|
00000c50  6e 6b 20 6c 69 6e 65 0d  02 c6 1c 20 20 f2 63 67  |nk line....  .cg|
00000c60  69 5f 68 65 61 64 65 72  6c 69 6e 65 28 22 22 2c  |i_headerline("",|
00000c70  22 22 29 0d 02 d0 37 20  20 f4 20 57 65 27 76 65  |"")...7  . We've|
00000c80  20 6e 6f 77 20 6f 75 74  70 75 74 20 61 20 68 65  | now output a he|
00000c90  61 64 65 72 2c 20 73 65  74 20 74 68 65 20 66 6c  |ader, set the fl|
00000ca0  61 67 20 61 73 20 73 75  63 68 0d 02 da 15 20 20  |ag as such....  |
00000cb0  63 67 69 5f 68 65 61 64  65 72 65 64 25 3d b9 0d  |cgi_headered%=..|
00000cc0  02 e4 05 cd 0d 02 ee 05  e1 0d 02 f8 04 0d 03 02  |................|
00000cd0  24 dd 20 f2 63 67 69 5f  73 74 61 74 75 73 6c 69  |$. .cgi_statusli|
00000ce0  6e 65 28 63 6f 64 65 25  2c 70 68 72 61 73 65 24  |ne(code%,phrase$|
00000cf0  29 0d 03 0c 4f f4 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |)...O. ---------|
00000d00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000d40  0d 03 16 36 f4 20 4f 75  74 70 75 74 20 74 68 65  |...6. Output the|
00000d50  20 69 6e 69 74 69 61 6c  20 73 74 61 74 75 73 20  | initial status |
00000d60  6c 69 6e 65 20 6f 66 20  61 6e 20 48 54 54 50 20  |line of an HTTP |
00000d70  68 65 61 64 65 72 0d 03  20 4f f4 20 2d 2d 2d 2d  |header.. O. ----|
00000d80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000dc0  2d 2d 2d 2d 2d 0d 03 2a  2b f1 20 68 74 74 70 24  |-----..*+. http$|
00000dd0  3b 22 20 22 3b c3 63 6f  64 65 25 3b 22 20 22 3b  |;" ";.code%;" ";|
00000de0  70 68 72 61 73 65 24 3b  bd 31 33 3b bd 31 30 3b  |phrase$;.13;.10;|
00000df0  0d 03 34 05 e1 0d 03 3e  04 0d 03 48 23 dd 20 f2  |..4....>...H#. .|
00000e00  63 67 69 5f 68 65 61 64  65 72 6c 69 6e 65 28 6e  |cgi_headerline(n|
00000e10  61 6d 65 24 2c 76 61 6c  75 65 24 29 0d 03 52 4f  |ame$,value$)..RO|
00000e20  f4 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |. --------------|
00000e30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000e60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 03 5c 2f f4  |-----------..\/.|
00000e70  20 4f 75 74 70 75 74 20  73 75 62 73 65 71 75 65  | Output subseque|
00000e80  6e 74 20 6c 69 6e 65 73  20 6f 66 20 61 6e 20 48  |nt lines of an H|
00000e90  54 54 50 20 68 65 61 64  65 72 0d 03 66 4f f4 20  |TTP header..fO. |
00000ea0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000ee0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 03 70 26 e7 20 6e  |---------..p&. n|
00000ef0  61 6d 65 24 3c 3e 22 22  20 8c 20 f1 20 6e 61 6d  |ame$<>"" . . nam|
00000f00  65 24 3b 22 3a 20 22 3b  76 61 6c 75 65 24 3b 0d  |e$;": ";value$;.|
00000f10  03 7a 0e f1 20 bd 31 33  3b bd 31 30 3b 0d 03 84  |.z.. .13;.10;...|
00000f20  05 e1 0d 03 8e 04 0d 03  98 10 dd 20 f2 63 67 69  |........... .cgi|
00000f30  5f 65 72 72 6f 72 0d 03  a2 4f f4 20 2d 2d 2d 2d  |_error...O. ----|
00000f40  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000f80  2d 2d 2d 2d 2d 0d 03 ac  26 f4 20 48 61 6e 64 6c  |-----...&. Handl|
00000f90  65 20 61 6e 79 20 65 72  72 6f 72 73 20 74 68 61  |e any errors tha|
00000fa0  74 20 6d 61 79 20 6f 63  63 75 72 0d 03 b6 4f f4  |t may occur...O.|
00000fb0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
00000fc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000ff0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0d 03 c0 13 f4 20  |----------..... |
00001000  53 61 66 65 74 79 20 66  69 72 73 74 21 0d 03 ca  |Safety first!...|
00001010  07 ea 20 85 0d 03 d4 0f  ee 20 85 20 ea 20 f7 20  |.. ...... . . . |
00001020  85 3a e1 0d 03 de 2b f4  20 4c 6f 67 20 74 68 65  |.:....+. Log the|
00001030  20 65 72 72 6f 72 20 74  6f 20 74 68 65 20 6d 61  | error to the ma|
00001040  69 6e 20 4e 65 74 70 6c  65 78 20 6c 6f 67 0d 03  |in Netplex log..|
00001050  e8 41 c8 99 20 22 53 79  73 4c 6f 67 5f 4c 6f 67  |.A.. "SysLog_Log|
00001060  4d 65 73 73 61 67 65 22  2c 22 4e 65 74 70 6c 65  |Message","Netple|
00001070  78 22 2c 22 43 47 49 20  22 2b f6 24 2b 22 20 61  |x","CGI "+.$+" a|
00001080  74 20 6c 69 6e 65 20 22  2b c3 9e 2c 31 32 30 0d  |t line "+..,120.|
00001090  03 f2 40 f4 20 4e 6f 74  65 3a 20 41 74 20 74 68  |..@. Note: At th|
000010a0  69 73 20 70 6f 69 6e 74  20 72 65 64 69 72 65 63  |is point redirec|
000010b0  74 69 6f 6e 20 77 69 6c  6c 20 68 61 76 65 20 62  |tion will have b|
000010c0  65 65 6e 20 64 65 61 63  74 69 76 61 74 65 64 0d  |een deactivated.|
000010d0  03 fc 31 f4 20 44 65 6c  65 74 65 20 74 68 65 20  |..1. Delete the |
000010e0  6f 75 74 70 75 74 20 73  74 72 65 61 6d 20 61 6e  |output stream an|
000010f0  64 20 72 65 2d 72 65 64  69 72 65 63 74 20 69 74  |d re-redirect it|
00001100  0d 04 06 43 c8 99 20 22  4f 53 5f 41 72 67 73 22  |...C.. "OS_Args"|
00001110  2c 37 2c 63 67 69 5f 6f  75 74 25 2c 6d 69 73 63  |,7,cgi_out%,misc|
00001120  25 2c 2c 2c 32 35 36 20  b8 20 2c 2c 2c 2c 2c 6c  |%,,,256 . ,,,,,l|
00001130  25 3a 6d 69 73 63 25 3f  28 32 35 36 2d 6c 25 29  |%:misc%?(256-l%)|
00001140  3d 31 33 0d 04 10 1b c8  99 20 22 4f 53 5f 46 69  |=13...... "OS_Fi|
00001150  6e 64 22 2c 30 2c 63 67  69 5f 6f 75 74 25 0d 04  |nd",0,cgi_out%..|
00001160  1a 18 c8 99 20 22 4f 53  5f 46 69 6c 65 22 2c 36  |.... "OS_File",6|
00001170  2c 6d 69 73 63 25 0d 04  24 26 c8 99 20 22 4f 53  |,misc%..$&.. "OS|
00001180  5f 46 69 6e 64 22 2c 26  38 46 2c 24 6d 69 73 63  |_Find",&8F,$misc|
00001190  25 20 b8 20 63 67 69 5f  6f 75 74 25 0d 04 2e 1c  |% . cgi_out%....|
000011a0  f4 20 52 65 61 63 74 69  76 61 74 65 20 72 65 64  |. Reactivate red|
000011b0  69 72 65 63 74 69 6f 6e  0d 04 38 14 f2 63 67 69  |irection..8..cgi|
000011c0  5f 72 65 64 69 72 65 63  74 28 31 29 0d 04 42 17  |_redirect(1)..B.|
000011d0  f4 20 47 65 6e 65 72 61  74 65 20 61 20 72 65 70  |. Generate a rep|
000011e0  6f 72 74 0d 04 4c 30 f2  63 67 69 5f 73 74 61 74  |ort..L0.cgi_stat|
000011f0  75 73 6c 69 6e 65 28 35  30 30 2c 22 49 6e 74 65  |usline(500,"Inte|
00001200  72 6e 61 6c 20 53 65 72  76 65 72 20 45 72 72 6f  |rnal Server Erro|
00001210  72 22 29 0d 04 56 2f f2  63 67 69 5f 68 65 61 64  |r")..V/.cgi_head|
00001220  65 72 6c 69 6e 65 28 22  43 6f 6e 74 65 6e 74 2d  |erline("Content-|
00001230  54 79 70 65 22 2c 22 74  65 78 74 2f 68 74 6d 6c  |Type","text/html|
00001240  22 29 0d 04 60 1a f2 63  67 69 5f 68 65 61 64 65  |")..`..cgi_heade|
00001250  72 6c 69 6e 65 28 22 22  2c 22 22 29 0d 04 6a 3a  |rline("","")..j:|
00001260  f1 20 22 3c 48 54 4d 4c  3e 3c 48 45 41 44 3e 3c  |. "<HTML><HEAD><|
00001270  54 49 54 4c 45 3e 43 47  49 20 45 72 72 6f 72 3c  |TITLE>CGI Error<|
00001280  2f 54 49 54 4c 45 3e 3c  2f 48 45 41 44 3e 3c 42  |/TITLE></HEAD><B|
00001290  4f 44 59 3e 22 3b 0d 04  7e 47 f1 20 22 3c 48 31  |ODY>";..~G. "<H1|
000012a0  3e 43 47 49 20 45 72 72  6f 72 3c 2f 48 31 3e 3c  |>CGI Error</H1><|
000012b0  48 52 3e 54 68 65 20 43  47 49 20 70 72 6f 67 72  |HR>The CGI progr|
000012c0  61 6d 20 72 65 74 75 72  6e 65 64 20 74 68 65 20  |am returned the |
000012d0  65 72 72 6f 72 20 3a 3c  42 52 3e 22 3b 0d 04 88  |error :<BR>";...|
000012e0  12 f1 20 22 3c 43 4f 44  45 3e 22 2b f6 24 3b 0d  |.. "<CODE>"+.$;.|
000012f0  04 92 23 e7 20 63 67 69  5f 64 65 62 75 67 25 20  |..#. cgi_debug% |
00001300  8c 20 f1 20 22 20 61 74  20 6c 69 6e 65 20 22 2b  |. . " at line "+|
00001310  c3 9e 0d 04 a6 1f f1 20  22 3c 2f 43 4f 44 45 3e  |....... "</CODE>|
00001320  2e 3c 2f 42 4f 44 59 3e  3c 2f 48 54 4d 4c 3e 22  |.</BODY></HTML>"|
00001330  3b 0d 04 b0 34 f4 20 45  6e 73 75 72 65 20 74 68  |;...4. Ensure th|
00001340  61 74 20 61 6e 79 20 6d  75 6c 74 69 74 61 73 6b  |at any multitask|
00001350  69 6e 67 20 66 6c 61 67  73 20 61 72 65 20 72 65  |ing flags are re|
00001360  6d 6f 76 65 64 0d 04 ba  13 f2 63 67 69 5f 70 6f  |moved.....cgi_po|
00001370  6c 6c 69 6e 67 28 a3 29  0d 04 c4 07 f7 20 85 0d  |lling(.)..... ..|
00001380  04 ce 05 e1 0d 04 d8 04  0d 04 e2 16 dd 20 a4 63  |............. .c|
00001390  67 69 5f 6e 65 78 74 65  6c 65 6d 65 6e 74 0d 04  |gi_nextelement..|
000013a0  ec 4f f4 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.O. ------------|
000013b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000013e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0d 04 f6  |-------------...|
000013f0  33 f4 20 52 65 74 75 72  6e 20 74 68 65 20 6e 65  |3. Return the ne|
00001400  78 74 20 65 6c 65 6d 65  6e 74 20 66 72 6f 6d 20  |xt element from |
00001410  61 20 50 4f 53 54 20 6f  70 65 72 61 74 69 6f 6e  |a POST operation|
00001420  0d 05 00 4f f4 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |...O. ----------|
00001430  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001460  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0d  |---------------.|
00001470  05 0a 4a f4 20 52 65 61  64 20 69 6e 20 61 6e 64  |..J. Read in and|
00001480  20 62 75 69 6c 64 20 75  70 20 61 20 73 74 72 69  | build up a stri|
00001490  6e 67 20 75 6e 74 69 6c  20 77 65 20 68 69 74 20  |ng until we hit |
000014a0  74 68 65 20 65 6e 64 20  6f 66 20 66 69 6c 65 20  |the end of file |
000014b0  6f 72 20 61 6e 20 27 26  27 0d 05 14 0e ea 20 65  |or an '&'..... e|
000014c0  24 2c 63 25 2c 73 25 0d  05 1e 15 e7 20 c5 23 63  |$,c%,s%..... .#c|
000014d0  67 69 5f 69 6e 25 20 8c  20 3d 22 22 0d 05 28 18  |gi_in% . =""..(.|
000014e0  65 24 3d 22 22 3a 73 25  3d 97 28 63 67 69 5f 73  |e$="":s%=.(cgi_s|
000014f0  65 70 24 29 0d 05 32 05  f5 0d 05 3c 12 20 20 63  |ep$)..2....<.  c|
00001500  25 3d 9a 23 63 67 69 5f  69 6e 25 0d 05 46 1a 20  |%=.#cgi_in%..F. |
00001510  20 e7 20 63 25 3c 3e 73  25 20 8c 20 65 24 2b 3d  | . c%<>s% . e$+=|
00001520  bd 28 63 25 29 0d 05 50  17 fd 20 63 25 3d 73 25  |.(c%)..P.. c%=s%|
00001530  20 84 20 c5 23 63 67 69  5f 69 6e 25 0d 05 5a 07  | . .#cgi_in%..Z.|
00001540  3d 65 24 0d 05 64 04 0d  05 6e 1d dd 20 a4 63 67  |=e$..d...n.. .cg|
00001550  69 5f 6e 65 78 74 65 6c  65 6d 65 6e 74 64 65 63  |i_nextelementdec|
00001560  6f 64 65 64 0d 05 78 4f  f4 20 2d 2d 2d 2d 2d 2d  |oded..xO. ------|
00001570  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000015b0  2d 2d 2d 0d 05 82 40 f4  20 52 65 74 75 72 6e 20  |---...@. Return |
000015c0  74 68 65 20 6e 65 78 74  20 65 6c 65 6d 65 6e 74  |the next element|
000015d0  20 66 72 6f 6d 20 61 20  50 4f 53 54 20 6f 70 65  | from a POST ope|
000015e0  72 61 74 69 6f 6e 2c 20  55 52 4c 20 64 65 63 6f  |ration, URL deco|
000015f0  64 65 64 0d 05 8c 4f f4  20 2d 2d 2d 2d 2d 2d 2d  |ded...O. -------|
00001600  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001640  2d 2d 0d 05 96 29 3d a4  63 67 69 5f 64 65 63 6f  |--...)=.cgi_deco|
00001650  64 65 65 6c 65 6d 65 6e  74 28 a4 63 67 69 5f 6e  |deelement(.cgi_n|
00001660  65 78 74 65 6c 65 6d 65  6e 74 29 0d 05 a0 04 0d  |extelement).....|
00001670  05 aa 1c dd 20 a4 63 67  69 5f 64 65 63 6f 64 65  |.... .cgi_decode|
00001680  65 6c 65 6d 65 6e 74 28  65 24 29 0d 05 b4 4f f4  |element(e$)...O.|
00001690  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
000016a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000016d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0d 05 be 30 f4 20  |----------...0. |
000016e0  44 65 63 6f 64 65 20 61  20 73 74 72 69 6e 67 20  |Decode a string |
000016f0  77 68 69 63 68 20 68 61  73 20 62 65 65 6e 20 55  |which has been U|
00001700  52 4c 20 65 6e 63 6f 64  65 64 0d 05 c8 4f f4 20  |RL encoded...O. |
00001710  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001750  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 05 d2 4f f4 20 4c  |---------...O. L|
00001760  6f 6f 70 20 74 68 72 6f  75 67 68 20 74 68 65 20  |oop through the |
00001770  73 74 72 69 6e 67 20 75  6e 74 69 6c 20 77 65 20  |string until we |
00001780  66 69 6e 64 20 27 2b 27  20 6f 72 20 27 25 68 68  |find '+' or '%hh|
00001790  27 2e 20 20 27 2b 27 20  62 65 63 6f 6d 65 73 20  |'.  '+' becomes |
000017a0  61 20 73 70 61 63 65 2c  0d 05 dc 3d f4 20 27 25  |a space,...=. '%|
000017b0  68 68 27 20 69 73 20 63  6f 6e 76 65 72 74 65 64  |hh' is converted|
000017c0  20 69 6e 74 6f 20 74 68  65 20 65 71 75 69 76 61  | into the equiva|
000017d0  6c 65 6e 74 20 41 53 43  49 49 20 63 68 61 72 61  |lent ASCII chara|
000017e0  63 74 65 72 2e 0d 05 e6  0e ea 20 6d 24 2c 64 24  |cter...... m$,d$|
000017f0  2c 63 25 0d 05 f0 09 64  24 3d 22 22 0d 05 fa 11  |,c%....d$=""....|
00001800  e3 20 63 25 3d 31 20 b8  20 a9 20 65 24 0d 06 04  |. c%=1 . . e$...|
00001810  12 20 20 6d 24 3d c1 65  24 2c 63 25 2c 31 29 0d  |.  m$=.e$,c%,1).|
00001820  06 0e 17 20 20 e7 20 6d  24 3d 22 2b 22 20 8c 20  |...  . m$="+" . |
00001830  6d 24 3d 22 20 22 0d 06  18 2d 20 20 e7 20 6d 24  |m$=" "...-  . m$|
00001840  3d 22 25 22 20 8c 20 6d  24 3d bd a0 28 22 26 22  |="%" . m$=..("&"|
00001850  2b c1 65 24 2c 63 25 2b  31 2c 32 29 29 3a 63 25  |+.e$,c%+1,2)):c%|
00001860  2b 3d 32 0d 06 22 0c 20  20 64 24 2b 3d 6d 24 0d  |+=2..".  d$+=m$.|
00001870  06 2c 05 ed 0d 06 36 07  3d 64 24 0d 06 40 04 0d  |.,....6.=d$..@..|
00001880  06 4a 18 dd 20 f2 63 67  69 5f 72 65 64 69 72 65  |.J.. .cgi_redire|
00001890  63 74 28 6f 70 25 29 0d  06 54 4f f4 20 2d 2d 2d  |ct(op%)..TO. ---|
000018a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000018e0  2d 2d 2d 2d 2d 2d 0d 06  5e 49 f4 20 41 6c 74 65  |------..^I. Alte|
000018f0  72 20 74 68 65 20 77 61  79 20 64 61 74 61 20 69  |r the way data i|
00001900  73 20 69 6e 70 75 74 20  61 6e 64 20 6f 75 74 70  |s input and outp|
00001910  75 74 20 74 6f 2f 66 72  6f 6d 20 74 68 65 20 73  |ut to/from the s|
00001920  74 61 6e 64 61 72 64 20  73 74 72 65 61 6d 73 0d  |tandard streams.|
00001930  06 68 4f f4 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.hO. -----------|
00001940  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001970  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0d 06  |--------------..|
00001980  72 0c c8 8e 20 6f 70 25  20 ca 0d 06 7c 0c 20 20  |r... op% ...|.  |
00001990  c9 20 2d 31 2c 30 0d 06  86 34 20 20 f4 20 2d 31  |. -1,0...4  . -1|
000019a0  3a 20 52 65 61 64 20 68  61 6e 64 6c 65 73 20 6f  |: Read handles o|
000019b0  72 20 30 3a 44 65 61 63  74 69 76 61 74 65 20 72  |r 0:Deactivate r|
000019c0  65 64 69 72 65 63 74 69  6f 6e 0d 06 90 3a 20 20  |edirection...:  |
000019d0  c8 99 20 22 4f 53 5f 43  68 61 6e 67 65 52 65 64  |.. "OS_ChangeRed|
000019e0  69 72 65 63 74 69 6f 6e  22 2c 6f 70 25 2c 6f 70  |irection",op%,op|
000019f0  25 20 b8 20 63 67 69 5f  69 6e 25 2c 63 67 69 5f  |% . cgi_in%,cgi_|
00001a00  6f 75 74 25 0d 06 9a 09  20 20 c9 20 31 0d 06 a4  |out%....  . 1...|
00001a10  42 20 20 f4 20 31 3a 20  52 65 61 63 74 69 76 61  |B  . 1: Reactiva|
00001a20  74 65 20 72 65 64 69 72  65 63 74 69 6f 6e 20 2d  |te redirection -|
00001a30  20 65 78 70 65 63 74 73  20 76 61 6c 69 64 20 63  | expects valid c|
00001a40  67 69 5f 69 6e 25 2c 63  67 69 5f 6f 75 74 25 0d  |gi_in%,cgi_out%.|
00001a50  06 ae 30 20 20 c8 99 20  22 4f 53 5f 43 68 61 6e  |..0  .. "OS_Chan|
00001a60  67 65 52 65 64 69 72 65  63 74 69 6f 6e 22 2c 63  |geRedirection",c|
00001a70  67 69 5f 69 6e 25 2c 63  67 69 5f 6f 75 74 25 0d  |gi_in%,cgi_out%.|
00001a80  06 b8 09 20 20 c9 20 32  0d 06 c2 18 20 20 f4 20  |...  . 2....  . |
00001a90  32 3a 20 43 6c 6f 73 65  20 73 74 72 65 61 6d 73  |2: Close streams|
00001aa0  0d 06 cc 28 20 20 e7 20  63 67 69 5f 69 6e 25 20  |...(  . cgi_in% |
00001ab0  8c 20 c8 99 20 22 4f 53  5f 46 69 6e 64 22 2c 30  |. .. "OS_Find",0|
00001ac0  2c 63 67 69 5f 69 6e 25  0d 06 d6 2a 20 20 e7 20  |,cgi_in%...*  . |
00001ad0  63 67 69 5f 6f 75 74 25  20 8c 20 c8 99 20 22 4f  |cgi_out% . .. "O|
00001ae0  53 5f 46 69 6e 64 22 2c  30 2c 63 67 69 5f 6f 75  |S_Find",0,cgi_ou|
00001af0  74 25 0d 06 e0 05 cb 0d  06 ea 05 e1 0d 06 f4 04  |t%..............|
00001b00  0d 06 fe 17 dd 20 f2 63  67 69 5f 70 6f 6c 6c 69  |..... .cgi_polli|
00001b10  6e 67 28 6f 6e 25 29 0d  07 08 4f f4 20 2d 2d 2d  |ng(on%)...O. ---|
00001b20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001b60  2d 2d 2d 2d 2d 2d 0d 07  12 4b f4 20 53 65 74 20  |------...K. Set |
00001b70  61 20 73 79 73 74 65 6d  20 76 61 72 69 61 62 6c  |a system variabl|
00001b80  65 20 77 68 69 63 68 20  69 6e 66 6f 72 6d 73 20  |e which informs |
00001b90  74 68 65 20 73 65 72 76  65 72 20 74 68 61 74 20  |the server that |
00001ba0  77 65 27 72 65 20 67 6f  69 6e 67 20 74 6f 20 62  |we're going to b|
00001bb0  65 0d 07 1c 33 f4 20 6f  70 65 72 61 74 69 6e 67  |e...3. operating|
00001bc0  20 6f 76 65 72 20 6f 6e  65 20 6f 72 20 6d 6f 72  | over one or mor|
00001bd0  65 20 63 61 6c 6c 73 20  74 6f 20 57 69 6d 70 5f  |e calls to Wimp_|
00001be0  50 6f 6c 6c 0d 07 26 4f  f4 20 2d 2d 2d 2d 2d 2d  |Poll..&O. ------|
00001bf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001c30  2d 2d 2d 0d 07 30 0b e7  20 6f 6e 25 20 8c 0d 07  |---..0.. on% ...|
00001c40  3a 37 20 20 f2 73 79 73  74 65 6d 5f 73 65 74 6c  |:7  .system_setl|
00001c50  69 74 65 72 61 6c 28 22  43 47 49 24 41 63 74 69  |iteral("CGI$Acti|
00001c60  76 65 5f 22 2b c3 7e 63  67 69 5f 63 6e 25 2c 22  |ve_"+.~cgi_cn%,"|
00001c70  59 65 73 22 29 0d 07 44  05 cc 0d 07 4e 2c 20 20  |Yes")..D....N,  |
00001c80  f2 73 79 73 74 65 6d 5f  75 6e 73 65 74 28 22 43  |.system_unset("C|
00001c90  47 49 24 41 63 74 69 76  65 5f 22 2b c3 7e 63 67  |GI$Active_"+.~cg|
00001ca0  69 5f 63 6e 25 29 0d 07  58 05 cd 0d 07 62 05 e1  |i_cn%)..X....b..|
00001cb0  0d 07 6c 04 0d 07 76 16  dd 20 a4 6d 69 6d 65 28  |..l...v.. .mime(|
00001cc0  66 69 6c 65 74 79 70 65  25 29 0d 07 80 4f f4 20  |filetype%)...O. |
00001cd0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001d10  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 07 8a 48 f4 20 43  |---------...H. C|
00001d20  6f 6e 76 65 72 74 20 63  6f 6d 6d 6f 6e 20 66 69  |onvert common fi|
00001d30  6c 65 74 79 70 65 73 20  69 6e 74 6f 20 74 68 65  |letypes into the|
00001d40  69 72 20 65 71 75 69 76  61 6c 65 6e 74 20 4d 49  |ir equivalent MI|
00001d50  4d 45 20 63 6f 6e 74 65  6e 74 2d 74 79 70 65 73  |ME content-types|
00001d60  2e 0d 07 94 4f f4 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |....O. ---------|
00001d70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001db0  0d 07 9e 12 c8 8e 20 66  69 6c 65 74 79 70 65 25  |...... filetype%|
00001dc0  20 ca 0d 07 a8 1a 20 20  c9 20 26 46 46 46 3a 3d  | .....  . &FFF:=|
00001dd0  22 74 65 78 74 2f 70 6c  61 69 6e 22 0d 07 b2 19  |"text/plain"....|
00001de0  20 20 c9 20 26 46 41 46  3a 3d 22 74 65 78 74 2f  |  . &FAF:="text/|
00001df0  68 74 6d 6c 22 0d 07 bc  1a 20 20 c9 20 26 43 38  |html"....  . &C8|
00001e00  35 3a 3d 22 69 6d 61 67  65 2f 6a 70 65 67 22 0d  |5:="image/jpeg".|
00001e10  07 c6 19 20 20 c9 20 26  36 39 35 3a 3d 22 69 6d  |...  . &695:="im|
00001e20  61 67 65 2f 67 69 66 22  0d 07 d0 26 20 20 c9 20  |age/gif"...&  . |
00001e30  26 44 44 43 3a 3d 22 61  70 70 6c 69 63 61 74 69  |&DDC:="applicati|
00001e40  6f 6e 2f 78 2d 73 70 61  72 6b 69 76 65 22 0d 07  |on/x-sparkive"..|
00001e50  da 23 20 20 c9 20 26 33  46 42 3a 3d 22 61 70 70  |.#  . &3FB:="app|
00001e60  6c 69 63 61 74 69 6f 6e  2f 78 2d 61 72 63 66 73  |lication/x-arcfs|
00001e70  22 0d 07 e4 21 20 20 c9  20 26 33 44 44 3a 3d 22  |"...!  . &3DD:="|
00001e80  61 70 70 6c 69 63 61 74  69 6f 6e 2f 78 2d 7a 69  |application/x-zi|
00001e90  70 22 0d 07 ee 27 20 20  c9 20 26 46 46 42 3a 3d  |p"...'  . &FFB:=|
00001ea0  22 61 70 70 6c 69 63 61  74 69 6f 6e 2f 78 2d 62  |"application/x-b|
00001eb0  62 63 2d 62 61 73 69 63  22 0d 07 f8 05 cb 0d 08  |bc-basic".......|
00001ec0  02 1f 3d 22 61 70 70 6c  69 63 61 74 69 6f 6e 2f  |..="application/|
00001ed0  6f 63 74 65 74 2d 73 74  72 65 61 6d 22 0d 08 0c  |octet-stream"...|
00001ee0  04 0d 08 16 04 0d 08 20  4e f4 20 2d 2d 20 53 74  |....... N. -- St|
00001ef0  72 69 6e 67 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ring -----------|
00001f00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001f30  2d 2d 2d 0d 08 2a 1e dd  20 a4 73 74 72 69 6e 67  |---..*.. .string|
00001f40  5f 72 65 61 64 74 6f 63  74 72 6c 28 f8 20 70 25  |_readtoctrl(. p%|
00001f50  29 0d 08 34 08 ea 20 73  24 0d 08 3e 29 c8 99 20  |)..4.. s$..>).. |
00001f60  22 41 70 70 45 6e 67 69  6e 65 5f 53 74 72 69 6e  |"AppEngine_Strin|
00001f70  67 4f 70 22 2c 31 2c 70  25 20 b8 20 2c 70 25 2c  |gOp",1,p% . ,p%,|
00001f80  73 24 0d 08 48 07 3d 73  24 0d 08 52 04 0d 08 5c  |s$..H.=s$..R...\|
00001f90  25 dd 20 a4 76 61 72 28  70 25 29 3d a4 73 74 72  |%. .var(p%)=.str|
00001fa0  69 6e 67 5f 72 65 61 64  74 6f 63 74 72 6c 28 70  |ing_readtoctrl(p|
00001fb0  25 29 0d 08 66 04 0d 08  70 15 dd 20 a4 63 61 73  |%)..f...p.. .cas|
00001fc0  65 5f 6c 6f 77 65 72 28  73 24 29 0d 08 7a 27 c8  |e_lower(s$)..z'.|
00001fd0  99 20 22 41 70 70 45 6e  67 69 6e 65 5f 53 74 72  |. "AppEngine_Str|
00001fe0  69 6e 67 4f 70 22 2c 34  2c 73 24 20 b8 20 2c 2c  |ingOp",4,s$ . ,,|
00001ff0  73 24 0d 08 84 07 3d 73  24 0d 08 8e 04 0d 08 98  |s$....=s$.......|
00002000  15 dd 20 a4 63 61 73 65  5f 75 70 70 65 72 28 73  |.. .case_upper(s|
00002010  24 29 0d 08 a2 27 c8 99  20 22 41 70 70 45 6e 67  |$)...'.. "AppEng|
00002020  69 6e 65 5f 53 74 72 69  6e 67 4f 70 22 2c 35 2c  |ine_StringOp",5,|
00002030  73 24 20 b8 20 2c 2c 73  24 0d 08 ac 07 3d 73 24  |s$ . ,,s$....=s$|
00002040  0d 08 b6 4e f4 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |...N. ----------|
00002050  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002080  2d 2d 2d 2d 20 53 74 72  69 6e 67 20 2d 2d 0d 08  |---- String --..|
00002090  c0 04 0d 08 ca 4e f4 20  2d 2d 20 53 79 73 74 65  |.....N. -- Syste|
000020a0  6d 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |m --------------|
000020b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000020e0  0d 08 d4 23 dd 20 f2 73  79 73 74 65 6d 5f 73 65  |...#. .system_se|
000020f0  74 6c 69 74 65 72 61 6c  28 76 61 72 24 2c 76 61  |tliteral(var$,va|
00002100  6c 24 29 0d 08 de 32 f4  20 34 20 3d 20 4c 69 74  |l$)...2. 4 = Lit|
00002110  65 72 61 6c 53 74 72 69  6e 67 2c 20 77 69 6c 6c  |eralString, will|
00002120  20 6e 6f 74 20 62 65 20  4f 53 5f 47 53 54 72 61  | not be OS_GSTra|
00002130  6e 73 27 64 2e 0d 08 e8  2a c8 99 20 22 4f 53 5f  |ns'd....*.. "OS_|
00002140  53 65 74 56 61 72 56 61  6c 22 2c 76 61 72 24 2c  |SetVarVal",var$,|
00002150  76 61 6c 24 2c a9 20 76  61 6c 24 2c 30 2c 34 0d  |val$,. val$,0,4.|
00002160  08 f2 05 e1 0d 08 fc 04  0d 09 06 1a dd 20 a4 73  |............. .s|
00002170  79 73 74 65 6d 5f 67 65  74 76 61 72 28 76 61 72  |ystem_getvar(var|
00002180  24 29 0d 09 10 28 f4 20  4e 6f 74 65 3a 20 45 78  |$)...(. Note: Ex|
00002190  70 61 6e 64 73 20 74 68  65 20 72 65 74 75 72 6e  |pands the return|
000021a0  65 64 20 73 74 72 69 6e  67 2e 0d 09 1a 08 ea 20  |ed string...... |
000021b0  62 25 0d 09 24 31 c8 99  20 22 58 4f 53 5f 52 65  |b%..$1.. "XOS_Re|
000021c0  61 64 56 61 72 56 61 6c  22 2c 76 61 72 24 2c 6d  |adVarVal",var$,m|
000021d0  69 73 63 25 2c 32 35 36  2c 30 2c 33 20 b8 20 2c  |isc%,256,0,3 . ,|
000021e0  2c 62 25 0d 09 2e 1e e7  20 62 25 3d 30 20 8c 20  |,b%..... b%=0 . |
000021f0  3d 22 22 20 8b 20 6d 69  73 63 25 3f 62 25 3d 31  |="" . misc%?b%=1|
00002200  33 0d 09 38 0b 3d 24 6d  69 73 63 25 0d 09 42 04  |3..8.=$misc%..B.|
00002210  0d 09 4c 19 dd 20 f2 73  79 73 74 65 6d 5f 75 6e  |..L.. .system_un|
00002220  73 65 74 28 76 61 72 24  29 0d 09 56 1e c8 99 20  |set(var$)..V... |
00002230  22 4f 53 5f 53 65 74 56  61 72 56 61 6c 22 2c 76  |"OS_SetVarVal",v|
00002240  61 72 24 2c 2c 2d 31 0d  09 60 05 e1 0d 09 6a 4e  |ar$,,-1..`....jN|
00002250  f4 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |. --------------|
00002260  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002290  20 53 79 73 74 65 6d 20  2d 2d 0d ff              | System --..|
0000229c