Home » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared » !JFShared/Help/CGILibrary
!JFShared/Help/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/Help/CGILibrary |
Read OK: | ✔ |
File size: | 1528 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
HELP( � ����, ��� � $ DIR$� � � F����ȇړ !Root l G���ݧ �� info P F���'ԇ� ArcWebLTP ` G����N�� PROC d G���O�� FN DATA� CGILibrary routines #Parent StrongHelp:!Menu Main routines #Indent 2 #Table Columns 2 <PROCinitcgi> <PROCcgierror> <PROCcgiheader> <PROCcgiparsedata> <PROCcgidivider> <FNcgirawdata> <PROCassign> <FNcgimethodget> <FNcgiextrapath> <FNrotounixfile> <FNunixtorofile> #EndTable #Indent Routines from <WimpLib=>WimpLib:!Root> #Indent 2 #Table Columns 2 <FNstring0=>WimpLib:FNstring0> <FNlower=>WimpLib:FNlower> <FNupper=>WimpLib:FNupper> <FNtidy=>WimpLib:FNtidy> <FNstripspaces=>WimpLib:FNstripspaces> <FNsystemvar=>WimpLib:FNsystemvar> <FNleafname=>WimpLib:FNleafname> <FNpathname=>WimpLib:FNpathname> #EndTable #Indent <Information=>info> on CGILibrary DATA� CGILibrary help #Align Centre {fh3}JFShared CGILibrary v1.01{f} #Align Left The CGI Library is a Basic Library file which provides an interface to local gateway engines for web pages. This version is intended for use with Dave Thomas' Netplex. There is an <ArcWebLTP> compatible version (1.00) but this should not be used. The CGI Library is referenced by \<CGILibrary$File> and should be loaded with : {fCode}LIBRARY "\<CGILibrary$File>":PROCinitcgi{f} The JFShared application is � <Justin Fletcher=>Filetypes:Authors_JustinFletcher>, 1995 and is released into the Public Domain with the same restrictions as subsist in most PD software. This includes the fact that when distributed the entire application must remain intact. DATA ArcWebLTP {fH4}ArcWeb Local Transfer Protocol{f} Whilst ArcWeb's built in local transfer engine is very good, one of the things it cannot handle is CGI scripts. These are simply programs which can react to input from FORM's or supply different graphics. Although most CGI files are scripts, or C programs, on unix systems it is possible on an Archimedes to execute BASIC files under CGI - much more fun than csh scripts, and almost as good as writing Perl. ArcWebLTP is my implementation of a CGI and standard fetch protocol, and allows you to specify paths as ltp://$.www.server/users/gerph/auadd.htm or ltp://$.www.server/cgi-bin/userbin/gerph/scripts/CGItest (the paths I'm currently using to test this program \<grin>). CGI means Common Gateway Interface, by the way... DIR$� � @ F������ٔ initcgi � F������ٵ cgierror � F�������� cgiheader d F����c�٨ cgiparsedata F���Ƞ��� assign � F���� ڐ cgidivider DATA� PROCinitcgi #Parent !Root Initialises CGI library variables. Call this routine at the start of any program that uses the CGILibrary file. This also installs an error handler which should return a useful message to the requesting agent. This routine also sets the variable {/}scriptdir${/} to point to the directory the script was run from, as described by the system variable RISCOS_SCRIPT_DIR.DATA� PROCcgierror(error$,line) #Parent !Root => {/}error${/} error message to pass to user agent {/}line{/} line of error, or -1 for user errors Notify the user of the error. DATA� PROCcgiheader(type$,ext$) #Parent !Root => {/}type${/} MIME base type {/}ext${/} type extension Return the type header to the agent - the most useful are text/html, text/plain, image/gif and image/jpeg. DATA� PROCcgiparsedata #Parent !Root Parse the CGI data passed, whether GET or POST requested. The data is returned in string variables with the names given by the poster (geter) in capitals prefixed by an underscore, eg _PERSONNAME$. As these will be unset if the variables are not supplied by the agent, it is probably easier if you assign some value to those variables you wish to use before calling PROCcgiparsedata. DATA� PROCassign(var$,val$) #Parent !Root => {/}var${/} variable to assign {/}val${/} value to assign to it Assigns a string value to a variable. Usage: {fCode}PROCassign("dullvar$","Boring"){f} DATA� PROCcgidivider(divider$) #Parent !Root => {/}divider${/} new field divider character Changes the field divider from it's default of &.DIR$� � 4 F���Ϧ�ٌ cgimethodget � F����<�ٙ unixtorofile \ F���H�ٙ rotounixfile � F���<N�َ cgirawdata � F���,�ڞ cgiextrapath DATA� FNcgimethodget #Parent !Root \<= TRUE if the request was made as a GET, as opposed to a POST. Check what type of request was made. DATA� FNunixtorofile(file$) #Parent !Root => {/}file${/} unix style filename <= RiscOS form of given filename Convert a unix filename to RiscOS style. DATA� FNrotounixfile(file$) #Parent !Root => {/}file${/} RiscOS style filename <= unix form of given filename Convert a RiscOS filename to unix style. DATA� FNcgirawdata #Parent !Root <= string passed to script Return the CGI data passed, whether GET or POST requested exactly as supplied. DATA� FNcgiextrapath #Parent !Root <= unix style suffix to the pathname specified If you request a file from the protocol which is completed before the end of the path string, eg {fCode}ltp://$.www.server/cgi-bin/imagemap/gerph/acorn/map.map{f} where cgi-bin/imagemap is the actual file to execute, then the remainder of the path, (/ onwards) will be passed on to the script and is retrievable by this function.
00000000 48 45 4c 50 28 00 00 00 fa 00 00 00 ff ff ff ff |HELP(...........| 00000010 2c 00 00 00 00 fd ff ff 00 00 00 00 a4 00 00 00 |,...............| 00000020 00 01 00 00 00 00 00 00 24 00 00 00 44 49 52 24 |........$...DIR$| 00000030 ac 00 00 00 ac 00 00 00 d8 00 00 00 46 fd ff ff |............F...| 00000040 f7 c8 87 da 93 02 00 00 13 00 00 00 00 00 00 00 |................| 00000050 21 52 6f 6f 74 00 00 00 6c 03 00 00 47 fd ff ff |!Root...l...G...| 00000060 dd a7 00 93 e2 02 00 00 13 00 00 00 00 00 00 00 |................| 00000070 69 6e 66 6f 00 00 00 00 50 06 00 00 46 fd ff ff |info....P...F...| 00000080 27 d4 87 da 10 03 00 00 13 00 00 00 00 00 00 00 |'...............| 00000090 41 72 63 57 65 62 4c 54 50 00 00 00 60 09 00 00 |ArcWebLTP...`...| 000000a0 47 fd ff ff 97 4e 06 d7 e0 00 00 00 13 01 00 00 |G....N..........| 000000b0 00 00 00 00 50 52 4f 43 00 00 00 00 64 10 00 00 |....PROC....d...| 000000c0 47 fd ff ff 0c 4f 06 d7 d0 00 00 00 13 01 00 00 |G....O..........| 000000d0 00 00 00 00 46 4e 00 00 44 41 54 41 93 02 00 00 |....FN..DATA....| 000000e0 43 47 49 4c 69 62 72 61 72 79 20 72 6f 75 74 69 |CGILibrary routi| 000000f0 6e 65 73 0a 23 50 61 72 65 6e 74 20 53 74 72 6f |nes.#Parent Stro| 00000100 6e 67 48 65 6c 70 3a 21 4d 65 6e 75 0a 4d 61 69 |ngHelp:!Menu.Mai| 00000110 6e 20 72 6f 75 74 69 6e 65 73 0a 23 49 6e 64 65 |n routines.#Inde| 00000120 6e 74 20 32 0a 23 54 61 62 6c 65 20 43 6f 6c 75 |nt 2.#Table Colu| 00000130 6d 6e 73 20 32 0a 3c 50 52 4f 43 69 6e 69 74 63 |mns 2.<PROCinitc| 00000140 67 69 3e 0a 3c 50 52 4f 43 63 67 69 65 72 72 6f |gi>.<PROCcgierro| 00000150 72 3e 0a 3c 50 52 4f 43 63 67 69 68 65 61 64 65 |r>.<PROCcgiheade| 00000160 72 3e 0a 3c 50 52 4f 43 63 67 69 70 61 72 73 65 |r>.<PROCcgiparse| 00000170 64 61 74 61 3e 0a 3c 50 52 4f 43 63 67 69 64 69 |data>.<PROCcgidi| 00000180 76 69 64 65 72 3e 0a 3c 46 4e 63 67 69 72 61 77 |vider>.<FNcgiraw| 00000190 64 61 74 61 3e 0a 3c 50 52 4f 43 61 73 73 69 67 |data>.<PROCassig| 000001a0 6e 3e 0a 3c 46 4e 63 67 69 6d 65 74 68 6f 64 67 |n>.<FNcgimethodg| 000001b0 65 74 3e 0a 3c 46 4e 63 67 69 65 78 74 72 61 70 |et>.<FNcgiextrap| 000001c0 61 74 68 3e 0a 3c 46 4e 72 6f 74 6f 75 6e 69 78 |ath>.<FNrotounix| 000001d0 66 69 6c 65 3e 0a 3c 46 4e 75 6e 69 78 74 6f 72 |file>.<FNunixtor| 000001e0 6f 66 69 6c 65 3e 0a 23 45 6e 64 54 61 62 6c 65 |ofile>.#EndTable| 000001f0 0a 23 49 6e 64 65 6e 74 0a 0a 52 6f 75 74 69 6e |.#Indent..Routin| 00000200 65 73 20 66 72 6f 6d 20 3c 57 69 6d 70 4c 69 62 |es from <WimpLib| 00000210 3d 3e 57 69 6d 70 4c 69 62 3a 21 52 6f 6f 74 3e |=>WimpLib:!Root>| 00000220 0a 23 49 6e 64 65 6e 74 20 32 0a 23 54 61 62 6c |.#Indent 2.#Tabl| 00000230 65 20 43 6f 6c 75 6d 6e 73 20 32 0a 3c 46 4e 73 |e Columns 2.<FNs| 00000240 74 72 69 6e 67 30 3d 3e 57 69 6d 70 4c 69 62 3a |tring0=>WimpLib:| 00000250 46 4e 73 74 72 69 6e 67 30 3e 0a 3c 46 4e 6c 6f |FNstring0>.<FNlo| 00000260 77 65 72 3d 3e 57 69 6d 70 4c 69 62 3a 46 4e 6c |wer=>WimpLib:FNl| 00000270 6f 77 65 72 3e 0a 3c 46 4e 75 70 70 65 72 3d 3e |ower>.<FNupper=>| 00000280 57 69 6d 70 4c 69 62 3a 46 4e 75 70 70 65 72 3e |WimpLib:FNupper>| 00000290 0a 3c 46 4e 74 69 64 79 3d 3e 57 69 6d 70 4c 69 |.<FNtidy=>WimpLi| 000002a0 62 3a 46 4e 74 69 64 79 3e 0a 3c 46 4e 73 74 72 |b:FNtidy>.<FNstr| 000002b0 69 70 73 70 61 63 65 73 3d 3e 57 69 6d 70 4c 69 |ipspaces=>WimpLi| 000002c0 62 3a 46 4e 73 74 72 69 70 73 70 61 63 65 73 3e |b:FNstripspaces>| 000002d0 0a 3c 46 4e 73 79 73 74 65 6d 76 61 72 3d 3e 57 |.<FNsystemvar=>W| 000002e0 69 6d 70 4c 69 62 3a 46 4e 73 79 73 74 65 6d 76 |impLib:FNsystemv| 000002f0 61 72 3e 0a 3c 46 4e 6c 65 61 66 6e 61 6d 65 3d |ar>.<FNleafname=| 00000300 3e 57 69 6d 70 4c 69 62 3a 46 4e 6c 65 61 66 6e |>WimpLib:FNleafn| 00000310 61 6d 65 3e 0a 3c 46 4e 70 61 74 68 6e 61 6d 65 |ame>.<FNpathname| 00000320 3d 3e 57 69 6d 70 4c 69 62 3a 46 4e 70 61 74 68 |=>WimpLib:FNpath| 00000330 6e 61 6d 65 3e 0a 23 45 6e 64 54 61 62 6c 65 0a |name>.#EndTable.| 00000340 23 49 6e 64 65 6e 74 0a 0a 3c 49 6e 66 6f 72 6d |#Indent..<Inform| 00000350 61 74 69 6f 6e 3d 3e 69 6e 66 6f 3e 20 6f 6e 20 |ation=>info> on | 00000360 43 47 49 4c 69 62 72 61 72 79 0a 00 44 41 54 41 |CGILibrary..DATA| 00000370 e2 02 00 00 43 47 49 4c 69 62 72 61 72 79 20 68 |....CGILibrary h| 00000380 65 6c 70 0a 23 41 6c 69 67 6e 20 43 65 6e 74 72 |elp.#Align Centr| 00000390 65 0a 7b 66 68 33 7d 4a 46 53 68 61 72 65 64 20 |e.{fh3}JFShared | 000003a0 43 47 49 4c 69 62 72 61 72 79 20 76 31 2e 30 31 |CGILibrary v1.01| 000003b0 7b 66 7d 0a 23 41 6c 69 67 6e 20 4c 65 66 74 0a |{f}.#Align Left.| 000003c0 0a 54 68 65 20 43 47 49 20 4c 69 62 72 61 72 79 |.The CGI Library| 000003d0 20 69 73 20 61 20 42 61 73 69 63 20 4c 69 62 72 | is a Basic Libr| 000003e0 61 72 79 20 66 69 6c 65 20 77 68 69 63 68 20 70 |ary file which p| 000003f0 72 6f 76 69 64 65 73 20 61 6e 20 69 6e 74 65 72 |rovides an inter| 00000400 66 61 63 65 20 74 6f 20 6c 6f 63 61 6c 20 67 61 |face to local ga| 00000410 74 65 77 61 79 20 65 6e 67 69 6e 65 73 20 66 6f |teway engines fo| 00000420 72 20 77 65 62 20 70 61 67 65 73 2e 20 54 68 69 |r web pages. Thi| 00000430 73 20 76 65 72 73 69 6f 6e 20 69 73 20 69 6e 74 |s version is int| 00000440 65 6e 64 65 64 20 66 6f 72 20 75 73 65 20 77 69 |ended for use wi| 00000450 74 68 20 44 61 76 65 20 54 68 6f 6d 61 73 27 20 |th Dave Thomas' | 00000460 4e 65 74 70 6c 65 78 2e 20 54 68 65 72 65 20 69 |Netplex. There i| 00000470 73 20 61 6e 20 3c 41 72 63 57 65 62 4c 54 50 3e |s an <ArcWebLTP>| 00000480 20 63 6f 6d 70 61 74 69 62 6c 65 20 76 65 72 73 | compatible vers| 00000490 69 6f 6e 20 28 31 2e 30 30 29 20 62 75 74 20 74 |ion (1.00) but t| 000004a0 68 69 73 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 |his should not b| 000004b0 65 20 75 73 65 64 2e 0a 0a 54 68 65 20 43 47 49 |e used...The CGI| 000004c0 20 4c 69 62 72 61 72 79 20 69 73 20 72 65 66 65 | Library is refe| 000004d0 72 65 6e 63 65 64 20 62 79 20 5c 3c 43 47 49 4c |renced by \<CGIL| 000004e0 69 62 72 61 72 79 24 46 69 6c 65 3e 20 61 6e 64 |ibrary$File> and| 000004f0 20 73 68 6f 75 6c 64 20 62 65 20 6c 6f 61 64 65 | should be loade| 00000500 64 20 77 69 74 68 20 3a 0a 7b 66 43 6f 64 65 7d |d with :.{fCode}| 00000510 4c 49 42 52 41 52 59 20 22 5c 3c 43 47 49 4c 69 |LIBRARY "\<CGILi| 00000520 62 72 61 72 79 24 46 69 6c 65 3e 22 3a 50 52 4f |brary$File>":PRO| 00000530 43 69 6e 69 74 63 67 69 7b 66 7d 0a 0a 54 68 65 |Cinitcgi{f}..The| 00000540 20 4a 46 53 68 61 72 65 64 20 61 70 70 6c 69 63 | JFShared applic| 00000550 61 74 69 6f 6e 20 69 73 20 a9 20 3c 4a 75 73 74 |ation is . <Just| 00000560 69 6e 20 46 6c 65 74 63 68 65 72 3d 3e 46 69 6c |in Fletcher=>Fil| 00000570 65 74 79 70 65 73 3a 41 75 74 68 6f 72 73 5f 4a |etypes:Authors_J| 00000580 75 73 74 69 6e 46 6c 65 74 63 68 65 72 3e 2c 20 |ustinFletcher>, | 00000590 31 39 39 35 20 61 6e 64 20 69 73 20 72 65 6c 65 |1995 and is rele| 000005a0 61 73 65 64 20 69 6e 74 6f 20 74 68 65 20 50 75 |ased into the Pu| 000005b0 62 6c 69 63 20 44 6f 6d 61 69 6e 20 77 69 74 68 |blic Domain with| 000005c0 20 74 68 65 20 73 61 6d 65 20 72 65 73 74 72 69 | the same restri| 000005d0 63 74 69 6f 6e 73 20 61 73 20 73 75 62 73 69 73 |ctions as subsis| 000005e0 74 20 69 6e 20 6d 6f 73 74 20 50 44 20 73 6f 66 |t in most PD sof| 000005f0 74 77 61 72 65 2e 20 54 68 69 73 20 69 6e 63 6c |tware. This incl| 00000600 75 64 65 73 20 74 68 65 20 66 61 63 74 20 74 68 |udes the fact th| 00000610 61 74 20 77 68 65 6e 20 64 69 73 74 72 69 62 75 |at when distribu| 00000620 74 65 64 20 74 68 65 20 65 6e 74 69 72 65 20 61 |ted the entire a| 00000630 70 70 6c 69 63 61 74 69 6f 6e 20 6d 75 73 74 20 |pplication must | 00000640 72 65 6d 61 69 6e 20 69 6e 74 61 63 74 2e 00 00 |remain intact...| 00000650 44 41 54 41 10 03 00 00 41 72 63 57 65 62 4c 54 |DATA....ArcWebLT| 00000660 50 0a 7b 66 48 34 7d 41 72 63 57 65 62 20 4c 6f |P.{fH4}ArcWeb Lo| 00000670 63 61 6c 20 54 72 61 6e 73 66 65 72 20 50 72 6f |cal Transfer Pro| 00000680 74 6f 63 6f 6c 7b 66 7d 0a 57 68 69 6c 73 74 20 |tocol{f}.Whilst | 00000690 41 72 63 57 65 62 27 73 20 62 75 69 6c 74 20 69 |ArcWeb's built i| 000006a0 6e 20 6c 6f 63 61 6c 20 74 72 61 6e 73 66 65 72 |n local transfer| 000006b0 20 65 6e 67 69 6e 65 20 69 73 20 76 65 72 79 20 | engine is very | 000006c0 67 6f 6f 64 2c 20 6f 6e 65 20 6f 66 20 74 68 65 |good, one of the| 000006d0 20 74 68 69 6e 67 73 20 69 74 20 63 61 6e 6e 6f | things it canno| 000006e0 74 20 68 61 6e 64 6c 65 20 69 73 20 43 47 49 20 |t handle is CGI | 000006f0 73 63 72 69 70 74 73 2e 20 54 68 65 73 65 20 61 |scripts. These a| 00000700 72 65 20 73 69 6d 70 6c 79 20 70 72 6f 67 72 61 |re simply progra| 00000710 6d 73 20 77 68 69 63 68 20 63 61 6e 20 72 65 61 |ms which can rea| 00000720 63 74 20 74 6f 20 69 6e 70 75 74 20 66 72 6f 6d |ct to input from| 00000730 20 46 4f 52 4d 27 73 20 6f 72 20 73 75 70 70 6c | FORM's or suppl| 00000740 79 20 64 69 66 66 65 72 65 6e 74 20 67 72 61 70 |y different grap| 00000750 68 69 63 73 2e 20 41 6c 74 68 6f 75 67 68 20 6d |hics. Although m| 00000760 6f 73 74 20 43 47 49 20 66 69 6c 65 73 20 61 72 |ost CGI files ar| 00000770 65 20 73 63 72 69 70 74 73 2c 20 6f 72 20 43 20 |e scripts, or C | 00000780 70 72 6f 67 72 61 6d 73 2c 20 6f 6e 20 75 6e 69 |programs, on uni| 00000790 78 20 73 79 73 74 65 6d 73 20 69 74 20 69 73 20 |x systems it is | 000007a0 70 6f 73 73 69 62 6c 65 20 6f 6e 20 61 6e 20 41 |possible on an A| 000007b0 72 63 68 69 6d 65 64 65 73 20 74 6f 20 65 78 65 |rchimedes to exe| 000007c0 63 75 74 65 20 42 41 53 49 43 20 66 69 6c 65 73 |cute BASIC files| 000007d0 20 75 6e 64 65 72 20 43 47 49 20 2d 20 6d 75 63 | under CGI - muc| 000007e0 68 20 6d 6f 72 65 20 66 75 6e 20 74 68 61 6e 20 |h more fun than | 000007f0 63 73 68 20 73 63 72 69 70 74 73 2c 20 61 6e 64 |csh scripts, and| 00000800 20 61 6c 6d 6f 73 74 20 61 73 20 67 6f 6f 64 20 | almost as good | 00000810 61 73 20 77 72 69 74 69 6e 67 20 50 65 72 6c 2e |as writing Perl.| 00000820 0a 0a 41 72 63 57 65 62 4c 54 50 20 69 73 20 6d |..ArcWebLTP is m| 00000830 79 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e |y implementation| 00000840 20 6f 66 20 61 20 43 47 49 20 61 6e 64 20 73 74 | of a CGI and st| 00000850 61 6e 64 61 72 64 20 66 65 74 63 68 20 70 72 6f |andard fetch pro| 00000860 74 6f 63 6f 6c 2c 20 61 6e 64 20 61 6c 6c 6f 77 |tocol, and allow| 00000870 73 20 79 6f 75 20 74 6f 20 73 70 65 63 69 66 79 |s you to specify| 00000880 20 70 61 74 68 73 20 61 73 20 6c 74 70 3a 2f 2f | paths as ltp://| 00000890 24 2e 77 77 77 2e 73 65 72 76 65 72 2f 75 73 65 |$.www.server/use| 000008a0 72 73 2f 67 65 72 70 68 2f 61 75 61 64 64 2e 68 |rs/gerph/auadd.h| 000008b0 74 6d 20 6f 72 20 6c 74 70 3a 2f 2f 24 2e 77 77 |tm or ltp://$.ww| 000008c0 77 2e 73 65 72 76 65 72 2f 63 67 69 2d 62 69 6e |w.server/cgi-bin| 000008d0 2f 75 73 65 72 62 69 6e 2f 67 65 72 70 68 2f 73 |/userbin/gerph/s| 000008e0 63 72 69 70 74 73 2f 43 47 49 74 65 73 74 20 28 |cripts/CGItest (| 000008f0 74 68 65 20 70 61 74 68 73 20 49 27 6d 20 63 75 |the paths I'm cu| 00000900 72 72 65 6e 74 6c 79 20 75 73 69 6e 67 20 74 6f |rrently using to| 00000910 20 74 65 73 74 20 74 68 69 73 20 70 72 6f 67 72 | test this progr| 00000920 61 6d 20 5c 3c 67 72 69 6e 3e 29 2e 0a 0a 43 47 |am \<grin>)...CG| 00000930 49 20 6d 65 61 6e 73 20 43 6f 6d 6d 6f 6e 20 47 |I means Common G| 00000940 61 74 65 77 61 79 20 49 6e 74 65 72 66 61 63 65 |ateway Interface| 00000950 2c 20 62 79 20 74 68 65 20 77 61 79 2e 2e 2e 0a |, by the way....| 00000960 44 49 52 24 e0 00 00 00 e0 00 00 00 40 0a 00 00 |DIR$........@...| 00000970 46 ff ff ff 8b b4 ae d9 94 01 00 00 13 00 00 00 |F...............| 00000980 00 00 00 00 69 6e 69 74 63 67 69 00 d4 0b 00 00 |....initcgi.....| 00000990 46 ff ff ff 80 bd 99 d9 b5 00 00 00 13 00 00 00 |F...............| 000009a0 00 00 00 00 63 67 69 65 72 72 6f 72 00 00 00 00 |....cgierror....| 000009b0 8c 0c 00 00 46 ff ff ff c0 9c 9a d9 d6 00 00 00 |....F...........| 000009c0 13 00 00 00 00 00 00 00 63 67 69 68 65 61 64 65 |........cgiheade| 000009d0 72 00 00 00 64 0d 00 00 46 ff ff ff 88 63 9b d9 |r...d...F....c..| 000009e0 a8 01 00 00 13 00 00 00 00 00 00 00 63 67 69 70 |............cgip| 000009f0 61 72 73 65 64 61 74 61 00 00 00 00 0c 0f 00 00 |arsedata........| 00000a00 46 ff ff ff c8 a0 9c d9 c8 00 00 00 13 00 00 00 |F...............| 00000a10 00 00 00 00 61 73 73 69 67 6e 00 00 d4 0f 00 00 |....assign......| 00000a20 46 ff ff ff 05 a1 0d da 90 00 00 00 13 00 00 00 |F...............| 00000a30 00 00 00 00 63 67 69 64 69 76 69 64 65 72 00 00 |....cgidivider..| 00000a40 44 41 54 41 94 01 00 00 50 52 4f 43 69 6e 69 74 |DATA....PROCinit| 00000a50 63 67 69 0a 23 50 61 72 65 6e 74 20 21 52 6f 6f |cgi.#Parent !Roo| 00000a60 74 0a 49 6e 69 74 69 61 6c 69 73 65 73 20 43 47 |t.Initialises CG| 00000a70 49 20 6c 69 62 72 61 72 79 20 76 61 72 69 61 62 |I library variab| 00000a80 6c 65 73 2e 0a 0a 43 61 6c 6c 20 74 68 69 73 20 |les...Call this | 00000a90 72 6f 75 74 69 6e 65 20 61 74 20 74 68 65 20 73 |routine at the s| 00000aa0 74 61 72 74 20 6f 66 20 61 6e 79 20 70 72 6f 67 |tart of any prog| 00000ab0 72 61 6d 20 74 68 61 74 20 75 73 65 73 20 74 68 |ram that uses th| 00000ac0 65 20 43 47 49 4c 69 62 72 61 72 79 20 66 69 6c |e CGILibrary fil| 00000ad0 65 2e 20 54 68 69 73 20 61 6c 73 6f 20 69 6e 73 |e. This also ins| 00000ae0 74 61 6c 6c 73 20 61 6e 20 65 72 72 6f 72 20 68 |talls an error h| 00000af0 61 6e 64 6c 65 72 20 77 68 69 63 68 20 73 68 6f |andler which sho| 00000b00 75 6c 64 20 72 65 74 75 72 6e 20 61 20 75 73 65 |uld return a use| 00000b10 66 75 6c 20 6d 65 73 73 61 67 65 20 74 6f 20 74 |ful message to t| 00000b20 68 65 20 72 65 71 75 65 73 74 69 6e 67 20 61 67 |he requesting ag| 00000b30 65 6e 74 2e 0a 0a 54 68 69 73 20 72 6f 75 74 69 |ent...This routi| 00000b40 6e 65 20 61 6c 73 6f 20 73 65 74 73 20 74 68 65 |ne also sets the| 00000b50 20 76 61 72 69 61 62 6c 65 20 7b 2f 7d 73 63 72 | variable {/}scr| 00000b60 69 70 74 64 69 72 24 7b 2f 7d 20 74 6f 20 70 6f |iptdir${/} to po| 00000b70 69 6e 74 20 74 6f 20 74 68 65 20 64 69 72 65 63 |int to the direc| 00000b80 74 6f 72 79 20 74 68 65 20 73 63 72 69 70 74 20 |tory the script | 00000b90 77 61 73 20 72 75 6e 20 66 72 6f 6d 2c 20 61 73 |was run from, as| 00000ba0 20 64 65 73 63 72 69 62 65 64 20 62 79 20 74 68 | described by th| 00000bb0 65 20 73 79 73 74 65 6d 20 76 61 72 69 61 62 6c |e system variabl| 00000bc0 65 20 52 49 53 43 4f 53 5f 53 43 52 49 50 54 5f |e RISCOS_SCRIPT_| 00000bd0 44 49 52 2e 44 41 54 41 b5 00 00 00 50 52 4f 43 |DIR.DATA....PROC| 00000be0 63 67 69 65 72 72 6f 72 28 65 72 72 6f 72 24 2c |cgierror(error$,| 00000bf0 6c 69 6e 65 29 0a 23 50 61 72 65 6e 74 20 21 52 |line).#Parent !R| 00000c00 6f 6f 74 0a 3d 3e 09 7b 2f 7d 65 72 72 6f 72 24 |oot.=>.{/}error$| 00000c10 7b 2f 7d 09 65 72 72 6f 72 20 6d 65 73 73 61 67 |{/}.error messag| 00000c20 65 20 74 6f 20 70 61 73 73 20 74 6f 20 75 73 65 |e to pass to use| 00000c30 72 20 61 67 65 6e 74 0a 09 7b 2f 7d 6c 69 6e 65 |r agent..{/}line| 00000c40 7b 2f 7d 09 6c 69 6e 65 20 6f 66 20 65 72 72 6f |{/}.line of erro| 00000c50 72 2c 20 6f 72 20 2d 31 20 66 6f 72 20 75 73 65 |r, or -1 for use| 00000c60 72 20 65 72 72 6f 72 73 0a 09 0a 4e 6f 74 69 66 |r errors...Notif| 00000c70 79 20 74 68 65 20 75 73 65 72 20 6f 66 20 74 68 |y the user of th| 00000c80 65 20 65 72 72 6f 72 2e 0a 00 00 00 44 41 54 41 |e error.....DATA| 00000c90 d6 00 00 00 50 52 4f 43 63 67 69 68 65 61 64 65 |....PROCcgiheade| 00000ca0 72 28 74 79 70 65 24 2c 65 78 74 24 29 0a 23 50 |r(type$,ext$).#P| 00000cb0 61 72 65 6e 74 20 21 52 6f 6f 74 0a 3d 3e 09 7b |arent !Root.=>.{| 00000cc0 2f 7d 74 79 70 65 24 7b 2f 7d 09 4d 49 4d 45 20 |/}type${/}.MIME | 00000cd0 62 61 73 65 20 74 79 70 65 0a 09 7b 2f 7d 65 78 |base type..{/}ex| 00000ce0 74 24 7b 2f 7d 09 74 79 70 65 20 65 78 74 65 6e |t${/}.type exten| 00000cf0 73 69 6f 6e 0a 09 0a 52 65 74 75 72 6e 20 74 68 |sion...Return th| 00000d00 65 20 74 79 70 65 20 68 65 61 64 65 72 20 74 6f |e type header to| 00000d10 20 74 68 65 20 61 67 65 6e 74 20 2d 20 74 68 65 | the agent - the| 00000d20 20 6d 6f 73 74 20 75 73 65 66 75 6c 20 61 72 65 | most useful are| 00000d30 20 74 65 78 74 2f 68 74 6d 6c 2c 20 74 65 78 74 | text/html, text| 00000d40 2f 70 6c 61 69 6e 2c 20 69 6d 61 67 65 2f 67 69 |/plain, image/gi| 00000d50 66 20 61 6e 64 20 69 6d 61 67 65 2f 6a 70 65 67 |f and image/jpeg| 00000d60 2e 0a 00 00 44 41 54 41 a8 01 00 00 50 52 4f 43 |....DATA....PROC| 00000d70 63 67 69 70 61 72 73 65 64 61 74 61 0a 23 50 61 |cgiparsedata.#Pa| 00000d80 72 65 6e 74 20 21 52 6f 6f 74 0a 50 61 72 73 65 |rent !Root.Parse| 00000d90 20 74 68 65 20 43 47 49 20 64 61 74 61 20 70 61 | the CGI data pa| 00000da0 73 73 65 64 2c 20 77 68 65 74 68 65 72 20 47 45 |ssed, whether GE| 00000db0 54 20 6f 72 20 50 4f 53 54 20 72 65 71 75 65 73 |T or POST reques| 00000dc0 74 65 64 2e 0a 0a 54 68 65 20 64 61 74 61 20 69 |ted...The data i| 00000dd0 73 20 72 65 74 75 72 6e 65 64 20 69 6e 20 73 74 |s returned in st| 00000de0 72 69 6e 67 20 76 61 72 69 61 62 6c 65 73 20 77 |ring variables w| 00000df0 69 74 68 20 74 68 65 20 6e 61 6d 65 73 20 67 69 |ith the names gi| 00000e00 76 65 6e 20 62 79 20 74 68 65 20 70 6f 73 74 65 |ven by the poste| 00000e10 72 20 28 67 65 74 65 72 29 20 69 6e 20 63 61 70 |r (geter) in cap| 00000e20 69 74 61 6c 73 20 70 72 65 66 69 78 65 64 20 62 |itals prefixed b| 00000e30 79 20 61 6e 20 75 6e 64 65 72 73 63 6f 72 65 2c |y an underscore,| 00000e40 20 65 67 20 5f 50 45 52 53 4f 4e 4e 41 4d 45 24 | eg _PERSONNAME$| 00000e50 2e 20 41 73 20 74 68 65 73 65 20 77 69 6c 6c 20 |. As these will | 00000e60 62 65 20 75 6e 73 65 74 20 69 66 20 74 68 65 20 |be unset if the | 00000e70 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 6e 6f |variables are no| 00000e80 74 20 73 75 70 70 6c 69 65 64 20 62 79 20 74 68 |t supplied by th| 00000e90 65 20 61 67 65 6e 74 2c 20 69 74 20 69 73 20 70 |e agent, it is p| 00000ea0 72 6f 62 61 62 6c 79 20 65 61 73 69 65 72 20 69 |robably easier i| 00000eb0 66 20 79 6f 75 20 61 73 73 69 67 6e 20 73 6f 6d |f you assign som| 00000ec0 65 20 76 61 6c 75 65 20 74 6f 20 74 68 6f 73 65 |e value to those| 00000ed0 20 76 61 72 69 61 62 6c 65 73 20 79 6f 75 20 77 | variables you w| 00000ee0 69 73 68 20 74 6f 20 75 73 65 20 62 65 66 6f 72 |ish to use befor| 00000ef0 65 20 63 61 6c 6c 69 6e 67 20 50 52 4f 43 63 67 |e calling PROCcg| 00000f00 69 70 61 72 73 65 64 61 74 61 2e 0a 44 41 54 41 |iparsedata..DATA| 00000f10 c8 00 00 00 50 52 4f 43 61 73 73 69 67 6e 28 76 |....PROCassign(v| 00000f20 61 72 24 2c 76 61 6c 24 29 0a 23 50 61 72 65 6e |ar$,val$).#Paren| 00000f30 74 20 21 52 6f 6f 74 0a 3d 3e 09 7b 2f 7d 76 61 |t !Root.=>.{/}va| 00000f40 72 24 7b 2f 7d 09 76 61 72 69 61 62 6c 65 20 74 |r${/}.variable t| 00000f50 6f 20 61 73 73 69 67 6e 0a 09 7b 2f 7d 76 61 6c |o assign..{/}val| 00000f60 24 7b 2f 7d 09 76 61 6c 75 65 20 74 6f 20 61 73 |${/}.value to as| 00000f70 73 69 67 6e 20 74 6f 20 69 74 0a 0a 41 73 73 69 |sign to it..Assi| 00000f80 67 6e 73 20 61 20 73 74 72 69 6e 67 20 76 61 6c |gns a string val| 00000f90 75 65 20 74 6f 20 61 20 76 61 72 69 61 62 6c 65 |ue to a variable| 00000fa0 2e 0a 0a 55 73 61 67 65 3a 20 7b 66 43 6f 64 65 |...Usage: {fCode| 00000fb0 7d 50 52 4f 43 61 73 73 69 67 6e 28 22 64 75 6c |}PROCassign("dul| 00000fc0 6c 76 61 72 24 22 2c 22 42 6f 72 69 6e 67 22 29 |lvar$","Boring")| 00000fd0 7b 66 7d 0a 44 41 54 41 90 00 00 00 50 52 4f 43 |{f}.DATA....PROC| 00000fe0 63 67 69 64 69 76 69 64 65 72 28 64 69 76 69 64 |cgidivider(divid| 00000ff0 65 72 24 29 0a 23 50 61 72 65 6e 74 20 21 52 6f |er$).#Parent !Ro| 00001000 6f 74 0a 3d 3e 09 7b 2f 7d 64 69 76 69 64 65 72 |ot.=>.{/}divider| 00001010 24 7b 2f 7d 09 6e 65 77 20 66 69 65 6c 64 20 64 |${/}.new field d| 00001020 69 76 69 64 65 72 20 63 68 61 72 61 63 74 65 72 |ivider character| 00001030 0a 09 0a 43 68 61 6e 67 65 73 20 74 68 65 20 66 |...Changes the f| 00001040 69 65 6c 64 20 64 69 76 69 64 65 72 20 66 72 6f |ield divider fro| 00001050 6d 20 69 74 27 73 20 64 65 66 61 75 6c 74 20 6f |m it's default o| 00001060 66 20 26 2e 44 49 52 24 d0 00 00 00 d0 00 00 00 |f &.DIR$........| 00001070 34 11 00 00 46 ff ff ff cf a6 98 d9 8c 00 00 00 |4...F...........| 00001080 13 00 00 00 00 00 00 00 63 67 69 6d 65 74 68 6f |........cgimetho| 00001090 64 67 65 74 00 00 00 00 c0 11 00 00 46 ff ff ff |dget........F...| 000010a0 ec 3c b1 d9 99 00 00 00 13 00 00 00 00 00 00 00 |.<..............| 000010b0 75 6e 69 78 74 6f 72 6f 66 69 6c 65 00 00 00 00 |unixtorofile....| 000010c0 5c 12 00 00 46 ff ff ff 08 48 b1 d9 99 00 00 00 |\...F....H......| 000010d0 13 00 00 00 00 00 00 00 72 6f 74 6f 75 6e 69 78 |........rotounix| 000010e0 66 69 6c 65 00 00 00 00 f8 12 00 00 46 ff ff ff |file........F...| 000010f0 3c 4e ce d9 8e 00 00 00 13 00 00 00 00 00 00 00 |<N..............| 00001100 63 67 69 72 61 77 64 61 74 61 00 00 88 13 00 00 |cgirawdata......| 00001110 46 ff ff ff 2c 14 88 da 9e 01 00 00 13 00 00 00 |F...,...........| 00001120 00 00 00 00 63 67 69 65 78 74 72 61 70 61 74 68 |....cgiextrapath| 00001130 00 00 00 00 44 41 54 41 8c 00 00 00 46 4e 63 67 |....DATA....FNcg| 00001140 69 6d 65 74 68 6f 64 67 65 74 0a 23 50 61 72 65 |imethodget.#Pare| 00001150 6e 74 20 21 52 6f 6f 74 0a 5c 3c 3d 09 54 52 55 |nt !Root.\<=.TRU| 00001160 45 20 69 66 20 74 68 65 20 72 65 71 75 65 73 74 |E if the request| 00001170 20 77 61 73 20 6d 61 64 65 20 61 73 20 61 20 47 | was made as a G| 00001180 45 54 2c 20 61 73 20 6f 70 70 6f 73 65 64 20 74 |ET, as opposed t| 00001190 6f 20 61 20 50 4f 53 54 2e 0a 0a 43 68 65 63 6b |o a POST...Check| 000011a0 20 77 68 61 74 20 74 79 70 65 20 6f 66 20 72 65 | what type of re| 000011b0 71 75 65 73 74 20 77 61 73 20 6d 61 64 65 2e 0a |quest was made..| 000011c0 44 41 54 41 99 00 00 00 46 4e 75 6e 69 78 74 6f |DATA....FNunixto| 000011d0 72 6f 66 69 6c 65 28 66 69 6c 65 24 29 0a 23 50 |rofile(file$).#P| 000011e0 61 72 65 6e 74 20 21 52 6f 6f 74 0a 3d 3e 09 7b |arent !Root.=>.{| 000011f0 2f 7d 66 69 6c 65 24 7b 2f 7d 09 75 6e 69 78 20 |/}file${/}.unix | 00001200 73 74 79 6c 65 20 66 69 6c 65 6e 61 6d 65 0a 3c |style filename.<| 00001210 3d 09 52 69 73 63 4f 53 20 66 6f 72 6d 20 6f 66 |=.RiscOS form of| 00001220 20 67 69 76 65 6e 20 66 69 6c 65 6e 61 6d 65 0a | given filename.| 00001230 0a 43 6f 6e 76 65 72 74 20 61 20 75 6e 69 78 20 |.Convert a unix | 00001240 66 69 6c 65 6e 61 6d 65 20 74 6f 20 52 69 73 63 |filename to Risc| 00001250 4f 53 20 73 74 79 6c 65 2e 00 00 00 44 41 54 41 |OS style....DATA| 00001260 99 00 00 00 46 4e 72 6f 74 6f 75 6e 69 78 66 69 |....FNrotounixfi| 00001270 6c 65 28 66 69 6c 65 24 29 0a 23 50 61 72 65 6e |le(file$).#Paren| 00001280 74 20 21 52 6f 6f 74 0a 3d 3e 09 7b 2f 7d 66 69 |t !Root.=>.{/}fi| 00001290 6c 65 24 7b 2f 7d 09 52 69 73 63 4f 53 20 73 74 |le${/}.RiscOS st| 000012a0 79 6c 65 20 66 69 6c 65 6e 61 6d 65 0a 3c 3d 09 |yle filename.<=.| 000012b0 75 6e 69 78 20 66 6f 72 6d 20 6f 66 20 67 69 76 |unix form of giv| 000012c0 65 6e 20 66 69 6c 65 6e 61 6d 65 0a 0a 43 6f 6e |en filename..Con| 000012d0 76 65 72 74 20 61 20 52 69 73 63 4f 53 20 66 69 |vert a RiscOS fi| 000012e0 6c 65 6e 61 6d 65 20 74 6f 20 75 6e 69 78 20 73 |lename to unix s| 000012f0 74 79 6c 65 2e 00 00 00 44 41 54 41 8e 00 00 00 |tyle....DATA....| 00001300 46 4e 63 67 69 72 61 77 64 61 74 61 0a 23 50 61 |FNcgirawdata.#Pa| 00001310 72 65 6e 74 20 21 52 6f 6f 74 0a 3c 3d 09 73 74 |rent !Root.<=.st| 00001320 72 69 6e 67 20 70 61 73 73 65 64 20 74 6f 20 73 |ring passed to s| 00001330 63 72 69 70 74 0a 0a 52 65 74 75 72 6e 20 74 68 |cript..Return th| 00001340 65 20 43 47 49 20 64 61 74 61 20 70 61 73 73 65 |e CGI data passe| 00001350 64 2c 20 77 68 65 74 68 65 72 20 47 45 54 20 6f |d, whether GET o| 00001360 72 20 50 4f 53 54 20 72 65 71 75 65 73 74 65 64 |r POST requested| 00001370 20 65 78 61 63 74 6c 79 20 61 73 20 73 75 70 70 | exactly as supp| 00001380 6c 69 65 64 2e 0a 00 00 44 41 54 41 9e 01 00 00 |lied....DATA....| 00001390 46 4e 63 67 69 65 78 74 72 61 70 61 74 68 0a 23 |FNcgiextrapath.#| 000013a0 50 61 72 65 6e 74 20 21 52 6f 6f 74 0a 3c 3d 09 |Parent !Root.<=.| 000013b0 75 6e 69 78 20 73 74 79 6c 65 20 73 75 66 66 69 |unix style suffi| 000013c0 78 20 74 6f 20 74 68 65 20 70 61 74 68 6e 61 6d |x to the pathnam| 000013d0 65 20 73 70 65 63 69 66 69 65 64 0a 0a 49 66 20 |e specified..If | 000013e0 79 6f 75 20 72 65 71 75 65 73 74 20 61 20 66 69 |you request a fi| 000013f0 6c 65 20 66 72 6f 6d 20 74 68 65 20 70 72 6f 74 |le from the prot| 00001400 6f 63 6f 6c 20 77 68 69 63 68 20 69 73 20 63 6f |ocol which is co| 00001410 6d 70 6c 65 74 65 64 20 62 65 66 6f 72 65 20 74 |mpleted before t| 00001420 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 70 61 |he end of the pa| 00001430 74 68 20 73 74 72 69 6e 67 2c 20 65 67 20 7b 66 |th string, eg {f| 00001440 43 6f 64 65 7d 6c 74 70 3a 2f 2f 24 2e 77 77 77 |Code}ltp://$.www| 00001450 2e 73 65 72 76 65 72 2f 63 67 69 2d 62 69 6e 2f |.server/cgi-bin/| 00001460 69 6d 61 67 65 6d 61 70 2f 67 65 72 70 68 2f 61 |imagemap/gerph/a| 00001470 63 6f 72 6e 2f 6d 61 70 2e 6d 61 70 7b 66 7d 20 |corn/map.map{f} | 00001480 77 68 65 72 65 20 63 67 69 2d 62 69 6e 2f 69 6d |where cgi-bin/im| 00001490 61 67 65 6d 61 70 20 69 73 20 74 68 65 20 61 63 |agemap is the ac| 000014a0 74 75 61 6c 20 66 69 6c 65 20 74 6f 20 65 78 65 |tual file to exe| 000014b0 63 75 74 65 2c 20 74 68 65 6e 20 74 68 65 20 72 |cute, then the r| 000014c0 65 6d 61 69 6e 64 65 72 20 6f 66 20 74 68 65 20 |emainder of the | 000014d0 70 61 74 68 2c 20 28 2f 20 6f 6e 77 61 72 64 73 |path, (/ onwards| 000014e0 29 20 77 69 6c 6c 20 62 65 20 70 61 73 73 65 64 |) will be passed| 000014f0 20 6f 6e 20 74 6f 20 74 68 65 20 73 63 72 69 70 | on to the scrip| 00001500 74 20 61 6e 64 20 69 73 20 72 65 74 72 69 65 76 |t and is retriev| 00001510 61 62 6c 65 20 62 79 20 74 68 69 73 20 66 75 6e |able by this fun| 00001520 63 74 69 6f 6e 2e 00 00 |ction...| 00001528