Home » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared » !JFShared/BasicLib/CGILibrary

!JFShared/BasicLib/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 1998-02 B.adf » JFShared
Filename: !JFShared/BasicLib/CGILibrary
Read OK:
File size: 1677 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > CGILibrary
   20REM LEN Justin Fletcher
   30REM Version 1.01 (20 Dec 1996) - for NetPlex applications
   40REM
   50REM Basic Routines to allow CGI programs to be written
   60REM Assumes similar protocols to that used by the server
   70REM I use at uni, which I assume is pretty standard (Apache)
   80REM
   90ERROR 0,"Do not run the CGI Library"
  100END
  110:
  120REM PROCinitcgi : Initialise the CGI library
  130DEFPROCinitcgi
  140ON ERROR PROCcgierror(REPORT$,ERL):END
  150headed=FALSE
  160DIM buffer% 256
  170scriptdir$=FNpathname(FNsystemvar("CGI$ScriptFilename"))
  180cgidivider$="&"
  190ENDPROC
  200:
  210REM PROCcgierror : Notify the user of an error having occured
  220REM Use -1 for user errors
  230DEFPROCcgierror(err$,line)
  240OSCLI("*Set CGIError$ "+err$+" at line "+STR$line)
  250PROCcgiheader("text","html")
  260PRINT"<head>"
  270PRINT"<title>An error occured in the CGI Script</title>"
  280PRINT"</head>"
  290PRINT"<body>"
  300IF line=-1 THEN
  310 PRINT"<h1>"+err$+"</h1>"
  320ELSE
  330 PRINT"<h1>"+err$+" ("+STR$line+")</h1>"
  340ENDIF
  350PRINT"Whilst processing the CGI script, an error occured which could not be resolved. Please report this to the System Administrator."
  360PRINT"<hr>"
  370ENDPROC
  380:
  390DEFPROCcgiheader(type$,ext$)
  400IF NOT headed THEN
  410 PRINT"Content-Type: "+type$+"/"+ext$;CHR$10;CHR$10;
  420 headed=TRUE
  430ENDIF
  440ENDPROC
  450:
  460REM FNcgirawdata : Read raw query data (<256 chars)
  470DEFFNcgirawdata
  480LOCAL str$,len:str$=""
  490IF FNcgimethodget THEN
  500 str$=FNsystemvar("CGI$QueryString")
  510ELSE
  520 len=VAL(FNsystemvar("CGI$ContentLength"))
  530 FORI=0TOlen:str$+=GET$:NEXT
  540ENDIF
  550=str$
  560:
  570REM PROCcgidivider : Change divider (used in some apps as | not &)
  580DEFPROCcgidivider(d$)
  590cgidivider$=d$
  600ENDPROC
  610:
  620REM PROCcgiparsedata : Process request and set variables
  630REM Should process correctly if GET, or POST
  640DEFPROCcgiparsedata
  650cgidebug$=""
  660IF FNcgimethodget THEN
  670 str$=FNsystemvar("CGI$QueryString"):len=1:get=TRUE
  680ELSE
  690 len=VAL(FNsystemvar("CGI$ContentLength")):str$="":get=FALSE
  700ENDIF
  710var$="":val$="":type=0
  720WHILE (len>0 AND NOT get) OR (len<LEN(str$)+1 AND get)
  730 IF get THENG=ASC(MID$(str$,len,1)) ELSEG=GET
  740 added=FALSE
  750 CASE G OF
  760  WHEN ASC(cgidivider$):REM A variable break
  770   PROCassign("_"+FNupper(var$)+"$",val$)
  780   IF LEN(cgidebug$)+LEN(var$)<250 THENcgidebug$+=FNupper(var$)+"$"
  790   type=1-type
  800   added=TRUE:var$="":val$=""
  810  WHEN ASC("+"):REM A space
  820   G=32:addeded=FALSE
  830  WHEN ASC("%"):REM An escaped character
  840   G=EVAL("&"+GET$+GET$):len-=2:added=FALSE
  850  WHEN ASC("=")
  860   IF type=0 THENtype=1:added=TRUE
  870 ENDCASE
  880 IF NOT added THEN
  890  IF type=0 THENvar$+=CHR$G ELSEval$+=CHR$G
  900 ENDIF
  910 IF get THENlen+=1 ELSElen-=1
  920ENDWHILE
  930IF var$<>"" THEN
  940 PROCassign("_"+FNupper(var$)+"$",val$)
  950 cgidebug$+=FNupper(var$)+"$"
  960ENDIF
  970ENDPROC
  980:
  990DEFPROCcgidebug
 1000a$=cgidebug$
 1010PRINT"<p align=left>Debug - variables (";cgidebug$;") :"
 1020WHILE a$<>""
 1030 b$=LEFT$(a$,INSTR(a$,"$")):a$=MID$(a$,INSTR(a$,"$")+1)
 1040 PRINT"<DT>";b$
 1050 PRINT"<DD><i>";EVAL("_"+b$);"</i>"
 1060ENDWHILE
 1070PRINT"<p>End of list"
 1080PRINT"<p>"
 1090ENDPROC
 1100:
 1110REM PROCassign : Assign user defined variables
 1120DEFPROCassign(var$,val$)
 1130LOCAL dummy
 1140dummy=EVAL("FNassignvar("+var$+",val$)")
 1150ENDPROC
 1160DEFFNassignvar(RETURN var$,val$)
 1170var$=val$:=0
 1180:
 1190REM FNcgimethod : Return TRUE if method was GET
 1200DEFFNcgimethodget=FNsystemvar("CGI$RequestMethod")="GET"
 1210:
 1220REM FNcgiextrapath : Return the rest of the path passed
 1230DEFFNcgiextrapath=FNsystemvar("CGI$PathInfo")
 1240:
 1250REM FNunixtorofile : Convert a unix filename to a RiscOs style
 1260DEFFNunixtorofile(file$)
 1270LOCAL b$,I,c$:b$=file$
 1280WHILE (INSTR(b$,"//")<>0):REM // becomes /
 1290 b$=LEFT$(b$,INSTR(b$,"//"))+MID$(b$,INSTR(b$,"//")+2)
 1300ENDWHILE
 1310WHILE (INSTR(b$,"..")<>0):REM .. becomes ^
 1320 b$=LEFT$(b$,INSTR(b$,"..")-1)+"^"+MID$(b$,INSTR(b$,"..")+2)
 1330ENDWHILE
 1340WHILE (INSTR(b$,"./")<>0):REM ./ becomes nothing
 1350 b$=LEFT$(b$,INSTR(b$,"./"))+MID$(b$,INSTR(b$,"./")+2)
 1360ENDWHILE
 1370c$=""
 1380FORI=1TOLEN(b$)
 1390 CASE MID$(b$,I,1) OF
 1400  WHEN ".":c$+="/"
 1410  WHEN "/":c$+="."
 1420  WHEN "^":c$=LEFT$(c$):IF RIGHT$(c$)="^" THENc$+=".^" ELSEc$=FNpathname(c$):IF c$="@" THENc$="^"
 1430  OTHERWISE:c$+=MID$(b$,I,1)
 1440 ENDCASE
 1450NEXT
 1460IF c$="/" OR c$="" THENc$="@"
 1470=c$
 1480:
 1490REM FNrotounixfile : Convert RiscOs filename to unix style
 1500DEFFNrotounixfile(file$)
 1510LOCAL b$,I:b$=file$
 1520FORI=1TOLEN(b$)
 1530 CASE MID$(b$,I,1) OF
 1540  WHEN ".":MID$(b$,I,1)="/"
 1550  WHEN "/":MID$(b$,I,1)="."
 1560 ENDCASE
 1570NEXT
 1580WHILE (INSTR(b$,"^")<>0):REM ^ becomes ..
 1590 b$=LEFT$(b$,INSTR(b$,"^")-1)+".."+MID$(b$,INSTR(b$,"^")+1)
 1600ENDWHILE
 1610IF b$="@" THEN b$="."
 1620=b$
 1630:
 1640:
 1650REM *************************************************
 1660REM ******** Routines stolen from WimpLib ***********
 1670REM *************************************************
 1680:
 1690REM FNsystemvar : Return the contents of any string system var
 1700DEFFNsystemvar(Var$):LOCAL len
 1710SYS "XOS_ReadVarVal",Var$,buffer%,255,0,3TO,,len
 1720buffer%?len=13:=$buffer%
 1730:
 1740REM ******** String manipulation routines ***********
 1750:
 1760REM FNstring0 : Return 0-terminated string at location
 1770DEFFNstring0(a%):LOCAL a$:IF a%=0 THEN=""
 1780WHILE?a%>31 ANDLEN(a$)<255:a$=a$+CHR$?a%:a%=a%+1:ENDWHILE
 1790=a$
 1800:
 1810REM FNlower       : Return given string in lower case
 1820REM FNupper       : Return given string in upper case
 1830REM FNtidy        : Return given string in tidy format
 1840REM FNstripspaces : Remove spaces from start and end of string
 1850DEFFNlower(a$):LOCAL c$,b$,I
 1860FORI=1TOLEN(a$)
 1870c$=MID$(a$,I,1)
 1880IF c$>="A"ANDc$<="Z"THENc$=CHR$(ASC(c$)+32)
 1890b$+=c$:NEXT:=b$
 1900DEFFNupper(a$):LOCAL c$,b$,I
 1910FORI=1TOLEN(a$)
 1920c$=MID$(a$,I,1)
 1930IF c$>="a"ANDc$<="z"THENc$=CHR$(ASC(c$)-32)
 1940b$+=c$:NEXT:=b$
 1950DEFFNtidy(a$):LOCAL cap,b$,I,c$
 1960cap=TRUE
 1970FORI=1TOLEN(a$)
 1980 b$=MID$(a$,I,1):IF b$>="a"ANDb$<="z" THENb$=CHR$(ASC(b$)-32)
 1990 IF (b$<"A" ORb$>"Z") AND b$<>"'" THEN
 2000  cap=TRUE
 2010 ELSE
 2020  IF cap=FALSE AND b$<>"'" THENb$=CHR$(ASC(b$)+32) ELSEcap=FALSE
 2030 ENDIF:c$+=b$
 2040NEXT:=c$
 2050DEFFNstripspaces(f$)
 2060WHILE RIGHT$(f$,1)=" " OR RIGHT$(f$,1)=CHR$9
 2070 f$=LEFT$(f$)
 2080ENDWHILE
 2090WHILE LEFT$(f$,1)=" " OR LEFT$(f$,1)=CHR$9
 2100 f$=MID$(f$,2)
 2110ENDWHILE
 2120=f$
 2130:
 2140REM FNleafname : Return the leafname of the file
 2150REM FNpathname : Return the directory containing the file
 2160DEF FNleafname(f$):LOCAL r$
 2170IF INSTR(f$,":")>0 THENf$=MID$(f$,INSTR(f$,":")+1)
 2180CASE INSTR(f$,".") OF
 2190 WHEN 0    :r$=f$
 2200 OTHERWISE :r$=FNleafname(RIGHT$(f$,LEN(f$)-INSTR(f$,".")))
 2210ENDCASE
 2220=r$
 2230DEF FNpathname(f$)
 2240IF INSTR(f$,":")>0 AND INSTR(f$,".")=0 THEN=LEFT$(f$,INSTR(f$,":")) ELSEIF INSTR(f$,":")=0 AND INSTR(f$,".")=0 THEN="@"
 2250=LEFT$(f$,LEN(f$)-LEN(FNleafname(f$))-1)

� > CGILibrary
� � Justin Fletcher
;� Version 1.01 (20 Dec 1996) - for NetPlex applications
(�
28� Basic Routines to allow CGI programs to be written
<:� Assumes similar protocols to that used by the server
F>� I use at uni, which I assume is pretty standard (Apache)
P�
Z$� 0,"Do not run the CGI Library"
d�
n:
x.� PROCinitcgi : Initialise the CGI library
�
��initcgi
�� � �cgierror(�$,�):�
�headed=�
�� buffer% 256
�:scriptdir$=�pathname(�systemvar("CGI$ScriptFilename"))
�cgidivider$="&"
��
�:
�?� PROCcgierror : Notify the user of an error having occured
�� Use -1 for user errors
���cgierror(err$,line)
�/�("*Set CGIError$ "+err$+" at line "+�line)
��cgiheader("text","html")

�"<head>"
8�"<title>An error occured in the CGI Script</title>"
�"</head>"
"
�"<body>"
,� line=-1 �
6 �"<h1>"+err$+"</h1>"
@�
J% �"<h1>"+err$+" ("+�line+")</h1>"
T�
^��"Whilst processing the CGI script, an error occured which could not be resolved. Please report this to the System Administrator."
h�"<hr>"
r�
|:
���cgiheader(type$,ext$)
�� � headed �
�. �"Content-Type: "+type$+"/"+ext$;�10;�10;
�
 headed=�
��
��
�:
�5� FNcgirawdata : Read raw query data (<256 chars)
�ݤcgirawdata
�� str$,len:str$=""
�� �cgimethodget �
�' str$=�systemvar("CGI$QueryString")
��
+ len=�(�systemvar("CGI$ContentLength"))
 �I=0�len:str$+=�:�
�
&	=str$
0:
:D� PROCcgidivider : Change divider (used in some apps as | not &)
D��cgidivider(d$)
Ncgidivider$=d$
X�
b:
l:� PROCcgiparsedata : Process request and set variables
v.� Should process correctly if GET, or POST
���cgiparsedata
�cgidebug$=""
�� �cgimethodget �
�3 str$=�systemvar("CGI$QueryString"):len=1:get=�
��
�9 len=�(�systemvar("CGI$ContentLength")):str$="":get=�
��
�var$="":val$="":type=0
�.ȕ (len>0 � � get) � (len<�(str$)+1 � get)
�" � get �G=�(�str$,len,1)) �G=�
� added=�
� Ȏ G �
�)  � �(cgidivider$):� A variable break
)   �assign("_"+�upper(var$)+"$",val$)
>   � �(cgidebug$)+�(var$)<250 �cgidebug$+=�upper(var$)+"$"
   type=1-type
    added=�:var$="":val$=""
*  � �("+"):� A space
4   G=32:addeded=�
>%  � �("%"):� An escaped character
H"   G=�("&"+�+�):len-=2:added=�
R  � �("=")
\   � type=0 �type=1:added=�
f �
p � � added �
z"  � type=0 �var$+=�G �val$+=�G
� �
� � get �len+=1 �len-=1
��
�� var$<>"" �
�' �assign("_"+�upper(var$)+"$",val$)
�  cgidebug$+=�upper(var$)+"$"
��
��
�:
���cgidebug
�a$=cgidebug$
�8�"<p align=left>Debug - variables (";cgidebug$;") :"
�
ȕ a$<>""
( b$=�a$,�a$,"$")):a$=�a$,�a$,"$")+1)
 �"<DT>";b$
  �"<DD><i>";�("_"+b$);"</i>"
$�
.�"<p>End of list"
8
�"<p>"
B�
L:
V0� PROCassign : Assign user defined variables
`��assign(var$,val$)
j� dummy
t)dummy=�("FNassignvar("+var$+",val$)")
~�
�ݤassignvar(� var$,val$)
�var$=val$:=0
�:
�1� FNcgimethod : Return TRUE if method was GET
�8ݤcgimethodget=�systemvar("CGI$RequestMethod")="GET"
�:
�9� FNcgiextrapath : Return the rest of the path passed
�-ݤcgiextrapath=�systemvar("CGI$PathInfo")
�:
�@� FNunixtorofile : Convert a unix filename to a RiscOs style
�ݤunixtorofile(file$)
�� b$,I,c$:b$=file$
$ȕ (�b$,"//")<>0):� // becomes /

' b$=�b$,�b$,"//"))+�b$,�b$,"//")+2)
�
$ȕ (�b$,"..")<>0):� .. becomes ^
(- b$=�b$,�b$,"..")-1)+"^"+�b$,�b$,"..")+2)
2�
<*ȕ (�b$,"./")<>0):� ./ becomes nothing
F' b$=�b$,�b$,"./"))+�b$,�b$,"./")+2)
P�
Z	c$=""
d�I=1��(b$)
n Ȏ �b$,I,1) �
x  � ".":c$+="/"
�  � "/":c$+="."
�K  � "^":c$=�c$):� �c$)="^" �c$+=".^" �c$=�pathname(c$):� c$="@" �c$="^"
�  :c$+=�b$,I,1)
� �
��
�� c$="/" � c$="" �c$="@"
�=c$
�:
�<� FNrotounixfile : Convert RiscOs filename to unix style
�ݤrotounixfile(file$)
�� b$,I:b$=file$
��I=1��(b$)
� Ȏ �b$,I,1) �
  � ".":�b$,I,1)="/"
  � "/":�b$,I,1)="."
 �
"�
,#ȕ (�b$,"^")<>0):� ^ becomes ..
6, b$=�b$,�b$,"^")-1)+".."+�b$,�b$,"^")+1)
@�
J� b$="@" � b$="."
T=b$
^:
h:
r7� *************************************************
|7� ******** Routines stolen from WimpLib ***********
�7� *************************************************
�:
�@� FNsystemvar : Return the contents of any string system var
�ݤsystemvar(Var$):� len
�2ș "XOS_ReadVarVal",Var$,buffer%,255,0,3�,,len
�buffer%?len=13:=$buffer%
�:
�7� ******** String manipulation routines ***********
�:
�8� FNstring0 : Return 0-terminated string at location
�"ݤstring0(a%):� a$:� a%=0 �=""
�,ȕ?a%>31 ��(a$)<255:a$=a$+�?a%:a%=a%+1:�
�=a$
:
7� FNlower       : Return given string in lower case
7� FNupper       : Return given string in upper case
&8� FNtidy        : Return given string in tidy format
0@� FNstripspaces : Remove spaces from start and end of string
:ݤlower(a$):� c$,b$,I
D�I=1��(a$)
Nc$=�a$,I,1)
X$� c$>="A"�c$<="Z"�c$=�(�(c$)+32)
bb$+=c$:�:=b$
lݤupper(a$):� c$,b$,I
v�I=1��(a$)
�c$=�a$,I,1)
�$� c$>="a"�c$<="z"�c$=�(�(c$)-32)
�b$+=c$:�:=b$
�ݤtidy(a$):� cap,b$,I,c$
�	cap=�
��I=1��(a$)
�2 b$=�a$,I,1):� b$>="a"�b$<="z" �b$=�(�(b$)-32)
�# � (b$<"A" �b$>"Z") � b$<>"'" �
�  cap=�
� �
�.  � cap=� � b$<>"'" �b$=�(�(b$)+32) �cap=�
�
 �:c$+=b$
�	�:=c$
ݤstripspaces(f$)
ȕ �f$,1)=" " � �f$,1)=�9
 f$=�f$)
 �
*ȕ �f$,1)=" " � �f$,1)=�9
4 f$=�f$,2)
>�
H=f$
R:
\2� FNleafname : Return the leafname of the file
f;� FNpathname : Return the directory containing the file
p� �leafname(f$):� r$
z$� �f$,":")>0 �f$=�f$,�f$,":")+1)
�Ȏ �f$,".") �
� � 0    :r$=f$
�)  :r$=�leafname(�f$,�(f$)-�f$,".")))
��
�=r$
�� �pathname(f$)
�N� �f$,":")>0 � �f$,".")=0 �=�f$,�f$,":")) �� �f$,":")=0 � �f$,".")=0 �="@"
�"=�f$,�(f$)-�(�leafname(f$))-1)
�
00000000  0d 00 0a 12 f4 20 3e 20  43 47 49 4c 69 62 72 61  |..... > CGILibra|
00000010  72 79 0d 00 14 17 f4 20  a9 20 4a 75 73 74 69 6e  |ry..... . Justin|
00000020  20 46 6c 65 74 63 68 65  72 0d 00 1e 3b f4 20 56  | Fletcher...;. V|
00000030  65 72 73 69 6f 6e 20 31  2e 30 31 20 28 32 30 20  |ersion 1.01 (20 |
00000040  44 65 63 20 31 39 39 36  29 20 2d 20 66 6f 72 20  |Dec 1996) - for |
00000050  4e 65 74 50 6c 65 78 20  61 70 70 6c 69 63 61 74  |NetPlex applicat|
00000060  69 6f 6e 73 0d 00 28 05  f4 0d 00 32 38 f4 20 42  |ions..(....28. B|
00000070  61 73 69 63 20 52 6f 75  74 69 6e 65 73 20 74 6f  |asic Routines to|
00000080  20 61 6c 6c 6f 77 20 43  47 49 20 70 72 6f 67 72  | allow CGI progr|
00000090  61 6d 73 20 74 6f 20 62  65 20 77 72 69 74 74 65  |ams to be writte|
000000a0  6e 0d 00 3c 3a f4 20 41  73 73 75 6d 65 73 20 73  |n..<:. Assumes s|
000000b0  69 6d 69 6c 61 72 20 70  72 6f 74 6f 63 6f 6c 73  |imilar protocols|
000000c0  20 74 6f 20 74 68 61 74  20 75 73 65 64 20 62 79  | to that used by|
000000d0  20 74 68 65 20 73 65 72  76 65 72 0d 00 46 3e f4  | the server..F>.|
000000e0  20 49 20 75 73 65 20 61  74 20 75 6e 69 2c 20 77  | I use at uni, w|
000000f0  68 69 63 68 20 49 20 61  73 73 75 6d 65 20 69 73  |hich I assume is|
00000100  20 70 72 65 74 74 79 20  73 74 61 6e 64 61 72 64  | pretty standard|
00000110  20 28 41 70 61 63 68 65  29 0d 00 50 05 f4 0d 00  | (Apache)..P....|
00000120  5a 24 85 20 30 2c 22 44  6f 20 6e 6f 74 20 72 75  |Z$. 0,"Do not ru|
00000130  6e 20 74 68 65 20 43 47  49 20 4c 69 62 72 61 72  |n the CGI Librar|
00000140  79 22 0d 00 64 05 e0 0d  00 6e 05 3a 0d 00 78 2e  |y"..d....n.:..x.|
00000150  f4 20 50 52 4f 43 69 6e  69 74 63 67 69 20 3a 20  |. PROCinitcgi : |
00000160  49 6e 69 74 69 61 6c 69  73 65 20 74 68 65 20 43  |Initialise the C|
00000170  47 49 20 6c 69 62 72 61  72 79 0d 00 82 0d dd f2  |GI library......|
00000180  69 6e 69 74 63 67 69 0d  00 8c 19 ee 20 85 20 f2  |initcgi..... . .|
00000190  63 67 69 65 72 72 6f 72  28 f6 24 2c 9e 29 3a e0  |cgierror(.$,.):.|
000001a0  0d 00 96 0c 68 65 61 64  65 64 3d a3 0d 00 a0 11  |....headed=.....|
000001b0  de 20 62 75 66 66 65 72  25 20 32 35 36 0d 00 aa  |. buffer% 256...|
000001c0  3a 73 63 72 69 70 74 64  69 72 24 3d a4 70 61 74  |:scriptdir$=.pat|
000001d0  68 6e 61 6d 65 28 a4 73  79 73 74 65 6d 76 61 72  |hname(.systemvar|
000001e0  28 22 43 47 49 24 53 63  72 69 70 74 46 69 6c 65  |("CGI$ScriptFile|
000001f0  6e 61 6d 65 22 29 29 0d  00 b4 13 63 67 69 64 69  |name"))....cgidi|
00000200  76 69 64 65 72 24 3d 22  26 22 0d 00 be 05 e1 0d  |vider$="&"......|
00000210  00 c8 05 3a 0d 00 d2 3f  f4 20 50 52 4f 43 63 67  |...:...?. PROCcg|
00000220  69 65 72 72 6f 72 20 3a  20 4e 6f 74 69 66 79 20  |ierror : Notify |
00000230  74 68 65 20 75 73 65 72  20 6f 66 20 61 6e 20 65  |the user of an e|
00000240  72 72 6f 72 20 68 61 76  69 6e 67 20 6f 63 63 75  |rror having occu|
00000250  72 65 64 0d 00 dc 1c f4  20 55 73 65 20 2d 31 20  |red..... Use -1 |
00000260  66 6f 72 20 75 73 65 72  20 65 72 72 6f 72 73 0d  |for user errors.|
00000270  00 e6 19 dd f2 63 67 69  65 72 72 6f 72 28 65 72  |.....cgierror(er|
00000280  72 24 2c 6c 69 6e 65 29  0d 00 f0 2f ff 28 22 2a  |r$,line).../.("*|
00000290  53 65 74 20 43 47 49 45  72 72 6f 72 24 20 22 2b  |Set CGIError$ "+|
000002a0  65 72 72 24 2b 22 20 61  74 20 6c 69 6e 65 20 22  |err$+" at line "|
000002b0  2b c3 6c 69 6e 65 29 0d  00 fa 1d f2 63 67 69 68  |+.line).....cgih|
000002c0  65 61 64 65 72 28 22 74  65 78 74 22 2c 22 68 74  |eader("text","ht|
000002d0  6d 6c 22 29 0d 01 04 0d  f1 22 3c 68 65 61 64 3e  |ml")....."<head>|
000002e0  22 0d 01 0e 38 f1 22 3c  74 69 74 6c 65 3e 41 6e  |"...8."<title>An|
000002f0  20 65 72 72 6f 72 20 6f  63 63 75 72 65 64 20 69  | error occured i|
00000300  6e 20 74 68 65 20 43 47  49 20 53 63 72 69 70 74  |n the CGI Script|
00000310  3c 2f 74 69 74 6c 65 3e  22 0d 01 18 0e f1 22 3c  |</title>"....."<|
00000320  2f 68 65 61 64 3e 22 0d  01 22 0d f1 22 3c 62 6f  |/head>"..".."<bo|
00000330  64 79 3e 22 0d 01 2c 0f  e7 20 6c 69 6e 65 3d 2d  |dy>"..,.. line=-|
00000340  31 20 8c 0d 01 36 19 20  f1 22 3c 68 31 3e 22 2b  |1 ...6. ."<h1>"+|
00000350  65 72 72 24 2b 22 3c 2f  68 31 3e 22 0d 01 40 05  |err$+"</h1>"..@.|
00000360  cc 0d 01 4a 25 20 f1 22  3c 68 31 3e 22 2b 65 72  |...J% ."<h1>"+er|
00000370  72 24 2b 22 20 28 22 2b  c3 6c 69 6e 65 2b 22 29  |r$+" ("+.line+")|
00000380  3c 2f 68 31 3e 22 0d 01  54 05 cd 0d 01 5e 86 f1  |</h1>"..T....^..|
00000390  22 57 68 69 6c 73 74 20  70 72 6f 63 65 73 73 69  |"Whilst processi|
000003a0  6e 67 20 74 68 65 20 43  47 49 20 73 63 72 69 70  |ng the CGI scrip|
000003b0  74 2c 20 61 6e 20 65 72  72 6f 72 20 6f 63 63 75  |t, an error occu|
000003c0  72 65 64 20 77 68 69 63  68 20 63 6f 75 6c 64 20  |red which could |
000003d0  6e 6f 74 20 62 65 20 72  65 73 6f 6c 76 65 64 2e  |not be resolved.|
000003e0  20 50 6c 65 61 73 65 20  72 65 70 6f 72 74 20 74  | Please report t|
000003f0  68 69 73 20 74 6f 20 74  68 65 20 53 79 73 74 65  |his to the Syste|
00000400  6d 20 41 64 6d 69 6e 69  73 74 72 61 74 6f 72 2e  |m Administrator.|
00000410  22 0d 01 68 0b f1 22 3c  68 72 3e 22 0d 01 72 05  |"..h.."<hr>"..r.|
00000420  e1 0d 01 7c 05 3a 0d 01  86 1b dd f2 63 67 69 68  |...|.:......cgih|
00000430  65 61 64 65 72 28 74 79  70 65 24 2c 65 78 74 24  |eader(type$,ext$|
00000440  29 0d 01 90 10 e7 20 ac  20 68 65 61 64 65 64 20  |)..... . headed |
00000450  8c 0d 01 9a 2e 20 f1 22  43 6f 6e 74 65 6e 74 2d  |..... ."Content-|
00000460  54 79 70 65 3a 20 22 2b  74 79 70 65 24 2b 22 2f  |Type: "+type$+"/|
00000470  22 2b 65 78 74 24 3b bd  31 30 3b bd 31 30 3b 0d  |"+ext$;.10;.10;.|
00000480  01 a4 0d 20 68 65 61 64  65 64 3d b9 0d 01 ae 05  |... headed=.....|
00000490  cd 0d 01 b8 05 e1 0d 01  c2 05 3a 0d 01 cc 35 f4  |..........:...5.|
000004a0  20 46 4e 63 67 69 72 61  77 64 61 74 61 20 3a 20  | FNcgirawdata : |
000004b0  52 65 61 64 20 72 61 77  20 71 75 65 72 79 20 64  |Read raw query d|
000004c0  61 74 61 20 28 3c 32 35  36 20 63 68 61 72 73 29  |ata (<256 chars)|
000004d0  0d 01 d6 10 dd a4 63 67  69 72 61 77 64 61 74 61  |......cgirawdata|
000004e0  0d 01 e0 16 ea 20 73 74  72 24 2c 6c 65 6e 3a 73  |..... str$,len:s|
000004f0  74 72 24 3d 22 22 0d 01  ea 15 e7 20 a4 63 67 69  |tr$=""..... .cgi|
00000500  6d 65 74 68 6f 64 67 65  74 20 8c 0d 01 f4 27 20  |methodget ....' |
00000510  73 74 72 24 3d a4 73 79  73 74 65 6d 76 61 72 28  |str$=.systemvar(|
00000520  22 43 47 49 24 51 75 65  72 79 53 74 72 69 6e 67  |"CGI$QueryString|
00000530  22 29 0d 01 fe 05 cc 0d  02 08 2b 20 6c 65 6e 3d  |")........+ len=|
00000540  bb 28 a4 73 79 73 74 65  6d 76 61 72 28 22 43 47  |.(.systemvar("CG|
00000550  49 24 43 6f 6e 74 65 6e  74 4c 65 6e 67 74 68 22  |I$ContentLength"|
00000560  29 29 0d 02 12 17 20 e3  49 3d 30 b8 6c 65 6e 3a  |)).... .I=0.len:|
00000570  73 74 72 24 2b 3d be 3a  ed 0d 02 1c 05 cd 0d 02  |str$+=.:........|
00000580  26 09 3d 73 74 72 24 0d  02 30 05 3a 0d 02 3a 44  |&.=str$..0.:..:D|
00000590  f4 20 50 52 4f 43 63 67  69 64 69 76 69 64 65 72  |. PROCcgidivider|
000005a0  20 3a 20 43 68 61 6e 67  65 20 64 69 76 69 64 65  | : Change divide|
000005b0  72 20 28 75 73 65 64 20  69 6e 20 73 6f 6d 65 20  |r (used in some |
000005c0  61 70 70 73 20 61 73 20  7c 20 6e 6f 74 20 26 29  |apps as | not &)|
000005d0  0d 02 44 14 dd f2 63 67  69 64 69 76 69 64 65 72  |..D...cgidivider|
000005e0  28 64 24 29 0d 02 4e 12  63 67 69 64 69 76 69 64  |(d$)..N.cgidivid|
000005f0  65 72 24 3d 64 24 0d 02  58 05 e1 0d 02 62 05 3a  |er$=d$..X....b.:|
00000600  0d 02 6c 3a f4 20 50 52  4f 43 63 67 69 70 61 72  |..l:. PROCcgipar|
00000610  73 65 64 61 74 61 20 3a  20 50 72 6f 63 65 73 73  |sedata : Process|
00000620  20 72 65 71 75 65 73 74  20 61 6e 64 20 73 65 74  | request and set|
00000630  20 76 61 72 69 61 62 6c  65 73 0d 02 76 2e f4 20  | variables..v.. |
00000640  53 68 6f 75 6c 64 20 70  72 6f 63 65 73 73 20 63  |Should process c|
00000650  6f 72 72 65 63 74 6c 79  20 69 66 20 47 45 54 2c  |orrectly if GET,|
00000660  20 6f 72 20 50 4f 53 54  0d 02 80 12 dd f2 63 67  | or POST......cg|
00000670  69 70 61 72 73 65 64 61  74 61 0d 02 8a 10 63 67  |iparsedata....cg|
00000680  69 64 65 62 75 67 24 3d  22 22 0d 02 94 15 e7 20  |idebug$=""..... |
00000690  a4 63 67 69 6d 65 74 68  6f 64 67 65 74 20 8c 0d  |.cgimethodget ..|
000006a0  02 9e 33 20 73 74 72 24  3d a4 73 79 73 74 65 6d  |..3 str$=.system|
000006b0  76 61 72 28 22 43 47 49  24 51 75 65 72 79 53 74  |var("CGI$QuerySt|
000006c0  72 69 6e 67 22 29 3a 6c  65 6e 3d 31 3a 67 65 74  |ring"):len=1:get|
000006d0  3d b9 0d 02 a8 05 cc 0d  02 b2 39 20 6c 65 6e 3d  |=.........9 len=|
000006e0  bb 28 a4 73 79 73 74 65  6d 76 61 72 28 22 43 47  |.(.systemvar("CG|
000006f0  49 24 43 6f 6e 74 65 6e  74 4c 65 6e 67 74 68 22  |I$ContentLength"|
00000700  29 29 3a 73 74 72 24 3d  22 22 3a 67 65 74 3d a3  |)):str$="":get=.|
00000710  0d 02 bc 05 cd 0d 02 c6  1a 76 61 72 24 3d 22 22  |.........var$=""|
00000720  3a 76 61 6c 24 3d 22 22  3a 74 79 70 65 3d 30 0d  |:val$="":type=0.|
00000730  02 d0 2e c8 95 20 28 6c  65 6e 3e 30 20 80 20 ac  |..... (len>0 . .|
00000740  20 67 65 74 29 20 84 20  28 6c 65 6e 3c a9 28 73  | get) . (len<.(s|
00000750  74 72 24 29 2b 31 20 80  20 67 65 74 29 0d 02 da  |tr$)+1 . get)...|
00000760  22 20 e7 20 67 65 74 20  8c 47 3d 97 28 c1 73 74  |" . get .G=.(.st|
00000770  72 24 2c 6c 65 6e 2c 31  29 29 20 8b 47 3d a5 0d  |r$,len,1)) .G=..|
00000780  02 e4 0c 20 61 64 64 65  64 3d a3 0d 02 ee 0b 20  |... added=..... |
00000790  c8 8e 20 47 20 ca 0d 02  f8 29 20 20 c9 20 97 28  |.. G ....)  . .(|
000007a0  63 67 69 64 69 76 69 64  65 72 24 29 3a f4 20 41  |cgidivider$):. A|
000007b0  20 76 61 72 69 61 62 6c  65 20 62 72 65 61 6b 0d  | variable break.|
000007c0  03 02 29 20 20 20 f2 61  73 73 69 67 6e 28 22 5f  |..)   .assign("_|
000007d0  22 2b a4 75 70 70 65 72  28 76 61 72 24 29 2b 22  |"+.upper(var$)+"|
000007e0  24 22 2c 76 61 6c 24 29  0d 03 0c 3e 20 20 20 e7  |$",val$)...>   .|
000007f0  20 a9 28 63 67 69 64 65  62 75 67 24 29 2b a9 28  | .(cgidebug$)+.(|
00000800  76 61 72 24 29 3c 32 35  30 20 8c 63 67 69 64 65  |var$)<250 .cgide|
00000810  62 75 67 24 2b 3d a4 75  70 70 65 72 28 76 61 72  |bug$+=.upper(var|
00000820  24 29 2b 22 24 22 0d 03  16 12 20 20 20 74 79 70  |$)+"$"....   typ|
00000830  65 3d 31 2d 74 79 70 65  0d 03 20 1e 20 20 20 61  |e=1-type.. .   a|
00000840  64 64 65 64 3d b9 3a 76  61 72 24 3d 22 22 3a 76  |dded=.:var$="":v|
00000850  61 6c 24 3d 22 22 0d 03  2a 18 20 20 c9 20 97 28  |al$=""..*.  . .(|
00000860  22 2b 22 29 3a f4 20 41  20 73 70 61 63 65 0d 03  |"+"):. A space..|
00000870  34 15 20 20 20 47 3d 33  32 3a 61 64 64 65 64 65  |4.   G=32:addede|
00000880  64 3d a3 0d 03 3e 25 20  20 c9 20 97 28 22 25 22  |d=...>%  . .("%"|
00000890  29 3a f4 20 41 6e 20 65  73 63 61 70 65 64 20 63  |):. An escaped c|
000008a0  68 61 72 61 63 74 65 72  0d 03 48 22 20 20 20 47  |haracter..H"   G|
000008b0  3d a0 28 22 26 22 2b be  2b be 29 3a 6c 65 6e 2d  |=.("&"+.+.):len-|
000008c0  3d 32 3a 61 64 64 65 64  3d a3 0d 03 52 0e 20 20  |=2:added=...R.  |
000008d0  c9 20 97 28 22 3d 22 29  0d 03 5c 1f 20 20 20 e7  |. .("=")..\.   .|
000008e0  20 74 79 70 65 3d 30 20  8c 74 79 70 65 3d 31 3a  | type=0 .type=1:|
000008f0  61 64 64 65 64 3d b9 0d  03 66 06 20 cb 0d 03 70  |added=...f. ...p|
00000900  10 20 e7 20 ac 20 61 64  64 65 64 20 8c 0d 03 7a  |. . . added ...z|
00000910  22 20 20 e7 20 74 79 70  65 3d 30 20 8c 76 61 72  |"  . type=0 .var|
00000920  24 2b 3d bd 47 20 8b 76  61 6c 24 2b 3d bd 47 0d  |$+=.G .val$+=.G.|
00000930  03 84 06 20 cd 0d 03 8e  1a 20 e7 20 67 65 74 20  |... ..... . get |
00000940  8c 6c 65 6e 2b 3d 31 20  8b 6c 65 6e 2d 3d 31 0d  |.len+=1 .len-=1.|
00000950  03 98 05 ce 0d 03 a2 10  e7 20 76 61 72 24 3c 3e  |......... var$<>|
00000960  22 22 20 8c 0d 03 ac 27  20 f2 61 73 73 69 67 6e  |"" ....' .assign|
00000970  28 22 5f 22 2b a4 75 70  70 65 72 28 76 61 72 24  |("_"+.upper(var$|
00000980  29 2b 22 24 22 2c 76 61  6c 24 29 0d 03 b6 20 20  |)+"$",val$)...  |
00000990  63 67 69 64 65 62 75 67  24 2b 3d a4 75 70 70 65  |cgidebug$+=.uppe|
000009a0  72 28 76 61 72 24 29 2b  22 24 22 0d 03 c0 05 cd  |r(var$)+"$".....|
000009b0  0d 03 ca 05 e1 0d 03 d4  05 3a 0d 03 de 0e dd f2  |.........:......|
000009c0  63 67 69 64 65 62 75 67  0d 03 e8 10 61 24 3d 63  |cgidebug....a$=c|
000009d0  67 69 64 65 62 75 67 24  0d 03 f2 38 f1 22 3c 70  |gidebug$...8."<p|
000009e0  20 61 6c 69 67 6e 3d 6c  65 66 74 3e 44 65 62 75  | align=left>Debu|
000009f0  67 20 2d 20 76 61 72 69  61 62 6c 65 73 20 28 22  |g - variables ("|
00000a00  3b 63 67 69 64 65 62 75  67 24 3b 22 29 20 3a 22  |;cgidebug$;") :"|
00000a10  0d 03 fc 0d c8 95 20 61  24 3c 3e 22 22 0d 04 06  |...... a$<>""...|
00000a20  28 20 62 24 3d c0 61 24  2c a7 61 24 2c 22 24 22  |( b$=.a$,.a$,"$"|
00000a30  29 29 3a 61 24 3d c1 61  24 2c a7 61 24 2c 22 24  |)):a$=.a$,.a$,"$|
00000a40  22 29 2b 31 29 0d 04 10  0f 20 f1 22 3c 44 54 3e  |")+1).... ."<DT>|
00000a50  22 3b 62 24 0d 04 1a 20  20 f1 22 3c 44 44 3e 3c  |";b$...  ."<DD><|
00000a60  69 3e 22 3b a0 28 22 5f  22 2b 62 24 29 3b 22 3c  |i>";.("_"+b$);"<|
00000a70  2f 69 3e 22 0d 04 24 05  ce 0d 04 2e 15 f1 22 3c  |/i>"..$......."<|
00000a80  70 3e 45 6e 64 20 6f 66  20 6c 69 73 74 22 0d 04  |p>End of list"..|
00000a90  38 0a f1 22 3c 70 3e 22  0d 04 42 05 e1 0d 04 4c  |8.."<p>"..B....L|
00000aa0  05 3a 0d 04 56 30 f4 20  50 52 4f 43 61 73 73 69  |.:..V0. PROCassi|
00000ab0  67 6e 20 3a 20 41 73 73  69 67 6e 20 75 73 65 72  |gn : Assign user|
00000ac0  20 64 65 66 69 6e 65 64  20 76 61 72 69 61 62 6c  | defined variabl|
00000ad0  65 73 0d 04 60 17 dd f2  61 73 73 69 67 6e 28 76  |es..`...assign(v|
00000ae0  61 72 24 2c 76 61 6c 24  29 0d 04 6a 0b ea 20 64  |ar$,val$)..j.. d|
00000af0  75 6d 6d 79 0d 04 74 29  64 75 6d 6d 79 3d a0 28  |ummy..t)dummy=.(|
00000b00  22 46 4e 61 73 73 69 67  6e 76 61 72 28 22 2b 76  |"FNassignvar("+v|
00000b10  61 72 24 2b 22 2c 76 61  6c 24 29 22 29 0d 04 7e  |ar$+",val$)")..~|
00000b20  05 e1 0d 04 88 1c dd a4  61 73 73 69 67 6e 76 61  |........assignva|
00000b30  72 28 f8 20 76 61 72 24  2c 76 61 6c 24 29 0d 04  |r(. var$,val$)..|
00000b40  92 10 76 61 72 24 3d 76  61 6c 24 3a 3d 30 0d 04  |..var$=val$:=0..|
00000b50  9c 05 3a 0d 04 a6 31 f4  20 46 4e 63 67 69 6d 65  |..:...1. FNcgime|
00000b60  74 68 6f 64 20 3a 20 52  65 74 75 72 6e 20 54 52  |thod : Return TR|
00000b70  55 45 20 69 66 20 6d 65  74 68 6f 64 20 77 61 73  |UE if method was|
00000b80  20 47 45 54 0d 04 b0 38  dd a4 63 67 69 6d 65 74  | GET...8..cgimet|
00000b90  68 6f 64 67 65 74 3d a4  73 79 73 74 65 6d 76 61  |hodget=.systemva|
00000ba0  72 28 22 43 47 49 24 52  65 71 75 65 73 74 4d 65  |r("CGI$RequestMe|
00000bb0  74 68 6f 64 22 29 3d 22  47 45 54 22 0d 04 ba 05  |thod")="GET"....|
00000bc0  3a 0d 04 c4 39 f4 20 46  4e 63 67 69 65 78 74 72  |:...9. FNcgiextr|
00000bd0  61 70 61 74 68 20 3a 20  52 65 74 75 72 6e 20 74  |apath : Return t|
00000be0  68 65 20 72 65 73 74 20  6f 66 20 74 68 65 20 70  |he rest of the p|
00000bf0  61 74 68 20 70 61 73 73  65 64 0d 04 ce 2d dd a4  |ath passed...-..|
00000c00  63 67 69 65 78 74 72 61  70 61 74 68 3d a4 73 79  |cgiextrapath=.sy|
00000c10  73 74 65 6d 76 61 72 28  22 43 47 49 24 50 61 74  |stemvar("CGI$Pat|
00000c20  68 49 6e 66 6f 22 29 0d  04 d8 05 3a 0d 04 e2 40  |hInfo")....:...@|
00000c30  f4 20 46 4e 75 6e 69 78  74 6f 72 6f 66 69 6c 65  |. FNunixtorofile|
00000c40  20 3a 20 43 6f 6e 76 65  72 74 20 61 20 75 6e 69  | : Convert a uni|
00000c50  78 20 66 69 6c 65 6e 61  6d 65 20 74 6f 20 61 20  |x filename to a |
00000c60  52 69 73 63 4f 73 20 73  74 79 6c 65 0d 04 ec 19  |RiscOs style....|
00000c70  dd a4 75 6e 69 78 74 6f  72 6f 66 69 6c 65 28 66  |..unixtorofile(f|
00000c80  69 6c 65 24 29 0d 04 f6  16 ea 20 62 24 2c 49 2c  |ile$)..... b$,I,|
00000c90  63 24 3a 62 24 3d 66 69  6c 65 24 0d 05 00 24 c8  |c$:b$=file$...$.|
00000ca0  95 20 28 a7 62 24 2c 22  2f 2f 22 29 3c 3e 30 29  |. (.b$,"//")<>0)|
00000cb0  3a f4 20 2f 2f 20 62 65  63 6f 6d 65 73 20 2f 0d  |:. // becomes /.|
00000cc0  05 0a 27 20 62 24 3d c0  62 24 2c a7 62 24 2c 22  |..' b$=.b$,.b$,"|
00000cd0  2f 2f 22 29 29 2b c1 62  24 2c a7 62 24 2c 22 2f  |//"))+.b$,.b$,"/|
00000ce0  2f 22 29 2b 32 29 0d 05  14 05 ce 0d 05 1e 24 c8  |/")+2)........$.|
00000cf0  95 20 28 a7 62 24 2c 22  2e 2e 22 29 3c 3e 30 29  |. (.b$,"..")<>0)|
00000d00  3a f4 20 2e 2e 20 62 65  63 6f 6d 65 73 20 5e 0d  |:. .. becomes ^.|
00000d10  05 28 2d 20 62 24 3d c0  62 24 2c a7 62 24 2c 22  |.(- b$=.b$,.b$,"|
00000d20  2e 2e 22 29 2d 31 29 2b  22 5e 22 2b c1 62 24 2c  |..")-1)+"^"+.b$,|
00000d30  a7 62 24 2c 22 2e 2e 22  29 2b 32 29 0d 05 32 05  |.b$,"..")+2)..2.|
00000d40  ce 0d 05 3c 2a c8 95 20  28 a7 62 24 2c 22 2e 2f  |...<*.. (.b$,"./|
00000d50  22 29 3c 3e 30 29 3a f4  20 2e 2f 20 62 65 63 6f  |")<>0):. ./ beco|
00000d60  6d 65 73 20 6e 6f 74 68  69 6e 67 0d 05 46 27 20  |mes nothing..F' |
00000d70  62 24 3d c0 62 24 2c a7  62 24 2c 22 2e 2f 22 29  |b$=.b$,.b$,"./")|
00000d80  29 2b c1 62 24 2c a7 62  24 2c 22 2e 2f 22 29 2b  |)+.b$,.b$,"./")+|
00000d90  32 29 0d 05 50 05 ce 0d  05 5a 09 63 24 3d 22 22  |2)..P....Z.c$=""|
00000da0  0d 05 64 0e e3 49 3d 31  b8 a9 28 62 24 29 0d 05  |..d..I=1..(b$)..|
00000db0  6e 12 20 c8 8e 20 c1 62  24 2c 49 2c 31 29 20 ca  |n. .. .b$,I,1) .|
00000dc0  0d 05 78 13 20 20 c9 20  22 2e 22 3a 63 24 2b 3d  |..x.  . ".":c$+=|
00000dd0  22 2f 22 0d 05 82 13 20  20 c9 20 22 2f 22 3a 63  |"/"....  . "/":c|
00000de0  24 2b 3d 22 2e 22 0d 05  8c 4b 20 20 c9 20 22 5e  |$+="."...K  . "^|
00000df0  22 3a 63 24 3d c0 63 24  29 3a e7 20 c2 63 24 29  |":c$=.c$):. .c$)|
00000e00  3d 22 5e 22 20 8c 63 24  2b 3d 22 2e 5e 22 20 8b  |="^" .c$+=".^" .|
00000e10  63 24 3d a4 70 61 74 68  6e 61 6d 65 28 63 24 29  |c$=.pathname(c$)|
00000e20  3a e7 20 63 24 3d 22 40  22 20 8c 63 24 3d 22 5e  |:. c$="@" .c$="^|
00000e30  22 0d 05 96 14 20 20 7f  3a 63 24 2b 3d c1 62 24  |"....  .:c$+=.b$|
00000e40  2c 49 2c 31 29 0d 05 a0  06 20 cb 0d 05 aa 05 ed  |,I,1).... ......|
00000e50  0d 05 b4 1c e7 20 63 24  3d 22 2f 22 20 84 20 63  |..... c$="/" . c|
00000e60  24 3d 22 22 20 8c 63 24  3d 22 40 22 0d 05 be 07  |$="" .c$="@"....|
00000e70  3d 63 24 0d 05 c8 05 3a  0d 05 d2 3c f4 20 46 4e  |=c$....:...<. FN|
00000e80  72 6f 74 6f 75 6e 69 78  66 69 6c 65 20 3a 20 43  |rotounixfile : C|
00000e90  6f 6e 76 65 72 74 20 52  69 73 63 4f 73 20 66 69  |onvert RiscOs fi|
00000ea0  6c 65 6e 61 6d 65 20 74  6f 20 75 6e 69 78 20 73  |lename to unix s|
00000eb0  74 79 6c 65 0d 05 dc 19  dd a4 72 6f 74 6f 75 6e  |tyle......rotoun|
00000ec0  69 78 66 69 6c 65 28 66  69 6c 65 24 29 0d 05 e6  |ixfile(file$)...|
00000ed0  13 ea 20 62 24 2c 49 3a  62 24 3d 66 69 6c 65 24  |.. b$,I:b$=file$|
00000ee0  0d 05 f0 0e e3 49 3d 31  b8 a9 28 62 24 29 0d 05  |.....I=1..(b$)..|
00000ef0  fa 12 20 c8 8e 20 c1 62  24 2c 49 2c 31 29 20 ca  |.. .. .b$,I,1) .|
00000f00  0d 06 04 18 20 20 c9 20  22 2e 22 3a c1 62 24 2c  |....  . ".":.b$,|
00000f10  49 2c 31 29 3d 22 2f 22  0d 06 0e 18 20 20 c9 20  |I,1)="/"....  . |
00000f20  22 2f 22 3a c1 62 24 2c  49 2c 31 29 3d 22 2e 22  |"/":.b$,I,1)="."|
00000f30  0d 06 18 06 20 cb 0d 06  22 05 ed 0d 06 2c 23 c8  |.... ..."....,#.|
00000f40  95 20 28 a7 62 24 2c 22  5e 22 29 3c 3e 30 29 3a  |. (.b$,"^")<>0):|
00000f50  f4 20 5e 20 62 65 63 6f  6d 65 73 20 2e 2e 0d 06  |. ^ becomes ....|
00000f60  36 2c 20 62 24 3d c0 62  24 2c a7 62 24 2c 22 5e  |6, b$=.b$,.b$,"^|
00000f70  22 29 2d 31 29 2b 22 2e  2e 22 2b c1 62 24 2c a7  |")-1)+".."+.b$,.|
00000f80  62 24 2c 22 5e 22 29 2b  31 29 0d 06 40 05 ce 0d  |b$,"^")+1)..@...|
00000f90  06 4a 15 e7 20 62 24 3d  22 40 22 20 8c 20 62 24  |.J.. b$="@" . b$|
00000fa0  3d 22 2e 22 0d 06 54 07  3d 62 24 0d 06 5e 05 3a  |="."..T.=b$..^.:|
00000fb0  0d 06 68 05 3a 0d 06 72  37 f4 20 2a 2a 2a 2a 2a  |..h.:..r7. *****|
00000fc0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000fe0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 0d 06 7c 37  |************..|7|
00000ff0  f4 20 2a 2a 2a 2a 2a 2a  2a 2a 20 52 6f 75 74 69  |. ******** Routi|
00001000  6e 65 73 20 73 74 6f 6c  65 6e 20 66 72 6f 6d 20  |nes stolen from |
00001010  57 69 6d 70 4c 69 62 20  2a 2a 2a 2a 2a 2a 2a 2a  |WimpLib ********|
00001020  2a 2a 2a 0d 06 86 37 f4  20 2a 2a 2a 2a 2a 2a 2a  |***...7. *******|
00001030  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00001050  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 0d 06 90 05 3a 0d  |**********....:.|
00001060  06 9a 40 f4 20 46 4e 73  79 73 74 65 6d 76 61 72  |..@. FNsystemvar|
00001070  20 3a 20 52 65 74 75 72  6e 20 74 68 65 20 63 6f  | : Return the co|
00001080  6e 74 65 6e 74 73 20 6f  66 20 61 6e 79 20 73 74  |ntents of any st|
00001090  72 69 6e 67 20 73 79 73  74 65 6d 20 76 61 72 0d  |ring system var.|
000010a0  06 a4 1b dd a4 73 79 73  74 65 6d 76 61 72 28 56  |.....systemvar(V|
000010b0  61 72 24 29 3a ea 20 6c  65 6e 0d 06 ae 32 c8 99  |ar$):. len...2..|
000010c0  20 22 58 4f 53 5f 52 65  61 64 56 61 72 56 61 6c  | "XOS_ReadVarVal|
000010d0  22 2c 56 61 72 24 2c 62  75 66 66 65 72 25 2c 32  |",Var$,buffer%,2|
000010e0  35 35 2c 30 2c 33 b8 2c  2c 6c 65 6e 0d 06 b8 1c  |55,0,3.,,len....|
000010f0  62 75 66 66 65 72 25 3f  6c 65 6e 3d 31 33 3a 3d  |buffer%?len=13:=|
00001100  24 62 75 66 66 65 72 25  0d 06 c2 05 3a 0d 06 cc  |$buffer%....:...|
00001110  37 f4 20 2a 2a 2a 2a 2a  2a 2a 2a 20 53 74 72 69  |7. ******** Stri|
00001120  6e 67 20 6d 61 6e 69 70  75 6c 61 74 69 6f 6e 20  |ng manipulation |
00001130  72 6f 75 74 69 6e 65 73  20 2a 2a 2a 2a 2a 2a 2a  |routines *******|
00001140  2a 2a 2a 2a 0d 06 d6 05  3a 0d 06 e0 38 f4 20 46  |****....:...8. F|
00001150  4e 73 74 72 69 6e 67 30  20 3a 20 52 65 74 75 72  |Nstring0 : Retur|
00001160  6e 20 30 2d 74 65 72 6d  69 6e 61 74 65 64 20 73  |n 0-terminated s|
00001170  74 72 69 6e 67 20 61 74  20 6c 6f 63 61 74 69 6f  |tring at locatio|
00001180  6e 0d 06 ea 22 dd a4 73  74 72 69 6e 67 30 28 61  |n..."..string0(a|
00001190  25 29 3a ea 20 61 24 3a  e7 20 61 25 3d 30 20 8c  |%):. a$:. a%=0 .|
000011a0  3d 22 22 0d 06 f4 2c c8  95 3f 61 25 3e 33 31 20  |=""...,..?a%>31 |
000011b0  80 a9 28 61 24 29 3c 32  35 35 3a 61 24 3d 61 24  |..(a$)<255:a$=a$|
000011c0  2b bd 3f 61 25 3a 61 25  3d 61 25 2b 31 3a ce 0d  |+.?a%:a%=a%+1:..|
000011d0  06 fe 07 3d 61 24 0d 07  08 05 3a 0d 07 12 37 f4  |...=a$....:...7.|
000011e0  20 46 4e 6c 6f 77 65 72  20 20 20 20 20 20 20 3a  | FNlower       :|
000011f0  20 52 65 74 75 72 6e 20  67 69 76 65 6e 20 73 74  | Return given st|
00001200  72 69 6e 67 20 69 6e 20  6c 6f 77 65 72 20 63 61  |ring in lower ca|
00001210  73 65 0d 07 1c 37 f4 20  46 4e 75 70 70 65 72 20  |se...7. FNupper |
00001220  20 20 20 20 20 20 3a 20  52 65 74 75 72 6e 20 67  |      : Return g|
00001230  69 76 65 6e 20 73 74 72  69 6e 67 20 69 6e 20 75  |iven string in u|
00001240  70 70 65 72 20 63 61 73  65 0d 07 26 38 f4 20 46  |pper case..&8. F|
00001250  4e 74 69 64 79 20 20 20  20 20 20 20 20 3a 20 52  |Ntidy        : R|
00001260  65 74 75 72 6e 20 67 69  76 65 6e 20 73 74 72 69  |eturn given stri|
00001270  6e 67 20 69 6e 20 74 69  64 79 20 66 6f 72 6d 61  |ng in tidy forma|
00001280  74 0d 07 30 40 f4 20 46  4e 73 74 72 69 70 73 70  |t..0@. FNstripsp|
00001290  61 63 65 73 20 3a 20 52  65 6d 6f 76 65 20 73 70  |aces : Remove sp|
000012a0  61 63 65 73 20 66 72 6f  6d 20 73 74 61 72 74 20  |aces from start |
000012b0  61 6e 64 20 65 6e 64 20  6f 66 20 73 74 72 69 6e  |and end of strin|
000012c0  67 0d 07 3a 19 dd a4 6c  6f 77 65 72 28 61 24 29  |g..:...lower(a$)|
000012d0  3a ea 20 63 24 2c 62 24  2c 49 0d 07 44 0e e3 49  |:. c$,b$,I..D..I|
000012e0  3d 31 b8 a9 28 61 24 29  0d 07 4e 0f 63 24 3d c1  |=1..(a$)..N.c$=.|
000012f0  61 24 2c 49 2c 31 29 0d  07 58 24 e7 20 63 24 3e  |a$,I,1)..X$. c$>|
00001300  3d 22 41 22 80 63 24 3c  3d 22 5a 22 8c 63 24 3d  |="A".c$<="Z".c$=|
00001310  bd 28 97 28 63 24 29 2b  33 32 29 0d 07 62 10 62  |.(.(c$)+32)..b.b|
00001320  24 2b 3d 63 24 3a ed 3a  3d 62 24 0d 07 6c 19 dd  |$+=c$:.:=b$..l..|
00001330  a4 75 70 70 65 72 28 61  24 29 3a ea 20 63 24 2c  |.upper(a$):. c$,|
00001340  62 24 2c 49 0d 07 76 0e  e3 49 3d 31 b8 a9 28 61  |b$,I..v..I=1..(a|
00001350  24 29 0d 07 80 0f 63 24  3d c1 61 24 2c 49 2c 31  |$)....c$=.a$,I,1|
00001360  29 0d 07 8a 24 e7 20 63  24 3e 3d 22 61 22 80 63  |)...$. c$>="a".c|
00001370  24 3c 3d 22 7a 22 8c 63  24 3d bd 28 97 28 63 24  |$<="z".c$=.(.(c$|
00001380  29 2d 33 32 29 0d 07 94  10 62 24 2b 3d 63 24 3a  |)-32)....b$+=c$:|
00001390  ed 3a 3d 62 24 0d 07 9e  1c dd a4 74 69 64 79 28  |.:=b$......tidy(|
000013a0  61 24 29 3a ea 20 63 61  70 2c 62 24 2c 49 2c 63  |a$):. cap,b$,I,c|
000013b0  24 0d 07 a8 09 63 61 70  3d b9 0d 07 b2 0e e3 49  |$....cap=......I|
000013c0  3d 31 b8 a9 28 61 24 29  0d 07 bc 32 20 62 24 3d  |=1..(a$)...2 b$=|
000013d0  c1 61 24 2c 49 2c 31 29  3a e7 20 62 24 3e 3d 22  |.a$,I,1):. b$>="|
000013e0  61 22 80 62 24 3c 3d 22  7a 22 20 8c 62 24 3d bd  |a".b$<="z" .b$=.|
000013f0  28 97 28 62 24 29 2d 33  32 29 0d 07 c6 23 20 e7  |(.(b$)-32)...# .|
00001400  20 28 62 24 3c 22 41 22  20 84 62 24 3e 22 5a 22  | (b$<"A" .b$>"Z"|
00001410  29 20 80 20 62 24 3c 3e  22 27 22 20 8c 0d 07 d0  |) . b$<>"'" ....|
00001420  0b 20 20 63 61 70 3d b9  0d 07 da 06 20 cc 0d 07  |.  cap=..... ...|
00001430  e4 2e 20 20 e7 20 63 61  70 3d a3 20 80 20 62 24  |..  . cap=. . b$|
00001440  3c 3e 22 27 22 20 8c 62  24 3d bd 28 97 28 62 24  |<>"'" .b$=.(.(b$|
00001450  29 2b 33 32 29 20 8b 63  61 70 3d a3 0d 07 ee 0d  |)+32) .cap=.....|
00001460  20 cd 3a 63 24 2b 3d 62  24 0d 07 f8 09 ed 3a 3d  | .:c$+=b$.....:=|
00001470  63 24 0d 08 02 15 dd a4  73 74 72 69 70 73 70 61  |c$......stripspa|
00001480  63 65 73 28 66 24 29 0d  08 0c 1d c8 95 20 c2 66  |ces(f$)...... .f|
00001490  24 2c 31 29 3d 22 20 22  20 84 20 c2 66 24 2c 31  |$,1)=" " . .f$,1|
000014a0  29 3d bd 39 0d 08 16 0c  20 66 24 3d c0 66 24 29  |)=.9.... f$=.f$)|
000014b0  0d 08 20 05 ce 0d 08 2a  1d c8 95 20 c0 66 24 2c  |.. ....*... .f$,|
000014c0  31 29 3d 22 20 22 20 84  20 c0 66 24 2c 31 29 3d  |1)=" " . .f$,1)=|
000014d0  bd 39 0d 08 34 0e 20 66  24 3d c1 66 24 2c 32 29  |.9..4. f$=.f$,2)|
000014e0  0d 08 3e 05 ce 0d 08 48  07 3d 66 24 0d 08 52 05  |..>....H.=f$..R.|
000014f0  3a 0d 08 5c 32 f4 20 46  4e 6c 65 61 66 6e 61 6d  |:..\2. FNleafnam|
00001500  65 20 3a 20 52 65 74 75  72 6e 20 74 68 65 20 6c  |e : Return the l|
00001510  65 61 66 6e 61 6d 65 20  6f 66 20 74 68 65 20 66  |eafname of the f|
00001520  69 6c 65 0d 08 66 3b f4  20 46 4e 70 61 74 68 6e  |ile..f;. FNpathn|
00001530  61 6d 65 20 3a 20 52 65  74 75 72 6e 20 74 68 65  |ame : Return the|
00001540  20 64 69 72 65 63 74 6f  72 79 20 63 6f 6e 74 61  | directory conta|
00001550  69 6e 69 6e 67 20 74 68  65 20 66 69 6c 65 0d 08  |ining the file..|
00001560  70 18 dd 20 a4 6c 65 61  66 6e 61 6d 65 28 66 24  |p.. .leafname(f$|
00001570  29 3a ea 20 72 24 0d 08  7a 24 e7 20 a7 66 24 2c  |):. r$..z$. .f$,|
00001580  22 3a 22 29 3e 30 20 8c  66 24 3d c1 66 24 2c a7  |":")>0 .f$=.f$,.|
00001590  66 24 2c 22 3a 22 29 2b  31 29 0d 08 84 11 c8 8e  |f$,":")+1)......|
000015a0  20 a7 66 24 2c 22 2e 22  29 20 ca 0d 08 8e 12 20  | .f$,".") ..... |
000015b0  c9 20 30 20 20 20 20 3a  72 24 3d 66 24 0d 08 98  |. 0    :r$=f$...|
000015c0  29 20 7f 20 3a 72 24 3d  a4 6c 65 61 66 6e 61 6d  |) . :r$=.leafnam|
000015d0  65 28 c2 66 24 2c a9 28  66 24 29 2d a7 66 24 2c  |e(.f$,.(f$)-.f$,|
000015e0  22 2e 22 29 29 29 0d 08  a2 05 cb 0d 08 ac 07 3d  |"."))).........=|
000015f0  72 24 0d 08 b6 13 dd 20  a4 70 61 74 68 6e 61 6d  |r$..... .pathnam|
00001600  65 28 66 24 29 0d 08 c0  4e e7 20 a7 66 24 2c 22  |e(f$)...N. .f$,"|
00001610  3a 22 29 3e 30 20 80 20  a7 66 24 2c 22 2e 22 29  |:")>0 . .f$,".")|
00001620  3d 30 20 8c 3d c0 66 24  2c a7 66 24 2c 22 3a 22  |=0 .=.f$,.f$,":"|
00001630  29 29 20 8b e7 20 a7 66  24 2c 22 3a 22 29 3d 30  |)) .. .f$,":")=0|
00001640  20 80 20 a7 66 24 2c 22  2e 22 29 3d 30 20 8c 3d  | . .f$,".")=0 .=|
00001650  22 40 22 0d 08 ca 22 3d  c0 66 24 2c a9 28 66 24  |"@"..."=.f$,.(f$|
00001660  29 2d a9 28 a4 6c 65 61  66 6e 61 6d 65 28 66 24  |)-.(.leafname(f$|
00001670  29 29 2d 31 29 0d ff                              |))-1)..|
00001677