home *** CD-ROM | disk | FTP | other *** search
- /* 00010000
- * Name: GOPSRVMB REXX 00020000
- * CMS Gopher Server menu builder pipeline stage 00030000
- * Based on the older GOPHERDM REXX stage from 2.3. 00040000
- * Author: Rick Troth, Rice University, Information Systems 00050000
- * Date: 1993-Jan-15 00060000
- */ 00070000
- 00080000
- /* 00090000
- * Copyright 1993 Richard M. Troth. This software was developed 00100000
- * with resources provided by Rice University and is intended 00110000
- * to serve Rice's user community. Rice has benefitted greatly 00120000
- * from the free distribution of software, therefore distribution 00130000
- * of unmodified copies of this material is not restricted. 00140000
- * You may change your own copy as needed. Neither Rice 00150000
- * University nor any of its employees or students shall be held 00160000
- * liable for damages resulting from the use of this software. 00170000
- */ 00180000
- 00190000
- uc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 00200000
- lc = "abcdefghijklmnopqrstuvwxyz" 00210000
- 00220000
- /* sync with input */ 00230000
- 'PEEKTO' 00240000
- If rc ^= 0 Then Exit rc * (rc ^= 12) 00250000
- 00260000
- /* experience shows that sometimes GLOBALV SELECT * 00270000
- * doesn't work unless you explicitly sync with PEEKTO */ 00280000
- Address "COMMAND" 'GLOBALV SELECT GOPHERD GET HOST PORT PATH MENU' 00290000
- localhost = host 00300000
- localport = port 00310000
- localpath = path 00320000
- Say "Global PATH =" path 00330000
- 00340000
- Do Forever 00350000
- 00360000
- 'PEEKTO RECORD' 00370000
- If rc ^= 0 Then Leave 00380000
- 00390000
- key = Left(record,1) 00400000
- Select /* key */ 00410000
- When key = "*" Then nop 00420000
- When Strip(record) = "" Then nop 00430000
- When key = " " Then Call FILELIST 00440000
- Otherwise Call PREFAB 00450000
- End /* Select key */ 00460000
- If rc ^= 0 Then Leave 00470000
- 00480000
- 'READTO' 00490000
- If rc ^= 0 Then Leave 00500000
- 00510000
- End /* Do For */ 00520000
- 00530000
- Exit rc * (rc ^= 12) 00540000
- 00550000
- 00560000
- 00570000
- /* ------------------------------------------------------------ FILELIST00580000
- * We're apparently reading a plain FILELIST or LISTFILE output. 00590000
- */ 00600000
- FILELIST: 00610000
- 00620000
- q1 = Index(record,"'") 00630000
- q2 = Index(record,'"') 00640000
- Select 00650000
- When q1 = 0 & q2 = 0 Then 00660000
- Parse Var record fn ft fm fp '05'x name '05'x type '05'x . 00670000
- When q1 = 0 Then 00680000
- Parse Var record fn ft fm fp '"'name'"' type . 00690000
- When q2 = 0 Then 00700000
- Parse Var record fn ft fm fp "'"name"'" type . 00710000
- When q1 > q2 Then 00720000
- Parse Var record fn ft fm fp '"'name'"' type . 00730000
- When q2 > 0 Then 00740000
- Parse Var record fn ft fm fp "'"name"'" type . 00750000
- End /* Select */ 00760000
- 00770000
- If ft = "" Then ft = "*" 00780000
- If fm = "" Then fm = "*" 00790000
- If ft = "GOPHER" | ft = "GOPLINK" Then Do 00800000
- /* read gopher link information */ 00810000
- 'CALLPIPE <' fn ft fm '| GOPSRVGL | *:' 00820000
- Return 00830000
- End 00840000
- 00850000
- /* this is for Yossie: hide filemode zero */ 00860000
- If Length(fm) > 1 Then If Substr(fm,2,1) = '0' Then Return 00870000
- 00880000
- fp = Strip(fp) 00890000
- If fp = "" Then Do 00900000
- If Index(fn ft, '*') > 0 | , 00910000
- ft = "FILELIST" Then fp = Translate(fn,lc,uc) 00920000
- Else fp = Translate(fn||'.'||ft,lc,uc) 00930000
- End /* If .. Do */ 00940000
- 00950000
- If name = "" Then name = fp /* default name is relative path */ 00960000
- fp = Translate(fp,"%","/") /* no slashes in partial path! */ 00970000
- If type = "" Then type = gtype(ft) 00980000
- host = localhost 00990000
- port = localport 01000000
- path = type || localpath || '/' || fp 01010000
- 01020000
- /* read overrides from the NAMES file, if any */ 01030000
- If menu ^= "" Then Call GOVER 01040000
- 01050000
- 'OUTPUT' type || name || '05'x || , 01060000
- /* type */ path || '05'x || , 01070000
- host || '05'x || port 01080000
- 01090000
- Return 01100000
- 01110000
- 01120000
- 01130000
- /* -------------------------------------------------------------- PREFAB01140000
- * Preceeding stage has supplied some of the parameters. (thank you) 01150000
- */ 01160000
- PREFAB: 01170000
- 01180000
- Parse Var record name '05'x path '05'x host '05'x port '05'x rest 01190000
- Parse Var path 1 type 2 path 01200000
- path = type || localpath || '/' || path 01210000
- If host = "" Then host = localhost 01220000
- If port = "" Then port = localport 01230000
- 'OUTPUT' name || '05'x || path || '05'x || , 01240000
- host || '05'x || port || '05'x || rest 01250000
- Return 01260000
- 01270000
- 01280000
- 01290000
- /* --------------------------------------------------------------- GOVER01300000
- * Read the specified NAMES file for menu data overrides, if any. 01310000
- */ 01320000
- GOVER: 01330000
- 01340000
- Address "COMMAND" 'STATE' menu 'NAMES *' 01350000
- If rc ^= 0 Then Return 01360000
- 01370000
- 'CALLPIPE COMMAND NAMEFIND :NICK' fp , 01380000
- ':TYPE :NAME :PATH :HOST :PORT (FILE' menu , 01390000
- '| VAR _TYPE | DROP | VAR _NAME | DROP | VAR _PATH | DROP' , 01400000
- '| VAR _HOST | DROP | VAR _PORT' 01410000
- If rc ^= 0 Then 01420000
- 'CALLPIPE COMMAND NAMEFIND :FN' fn ':FT' ft , 01430000
- ':TYPE :NAME :PATH :HOST :PORT (FILE' menu , 01440000
- '| VAR _TYPE | DROP | VAR _NAME | DROP | VAR _PATH | DROP' , 01450000
- '| VAR _HOST | DROP | VAR _PORT' 01460000
- If rc ^= 0 Then Return 01470000
- 01480000
- /* defaults for type, name, path, host, port * 01490000
- * are supplied by the calling routine */ 01500000
- 01510000
- If _host ^= "" Then host = _host 01520000
- If _port ^= "" Then port = _port 01530000
- If _path ^= "" Then path = _path 01540000
- If _name ^= "" Then name = _name 01550000
- If _type ^= "" Then type = _type 01560000
- 01570000
- Select 01580000
- When _host ^= "" & _port = "" Then port = 70 01590000
- When _host = "" & _port ^= "" Then host = localhost 01600000
- Otherwise nop 01610000
- End /* When Select */ 01620000
- 01630000
- If _host ^= "" | _port ^= "" Then Do 01640000
- path = _path 01650000
- type = _type 01660000
- If type = "" Then type = "1" 01670000
- End /* If .. Do */ 01680000
- Else If _type ^= "" & _path = "" Then 01690000
- path = _type || localpath || '/' || fp 01700000
- 01710000
- Return 01720000
- 01730000
- 01740000
- 01750000
- /* --------------------------------------------------------------- GTYPE01760000
- * Returns the default Gopher type character for CMS filetype specified.01770000
- */ 01780000
- GTYPE: Procedure 01790000
- Parse Arg ft 01800000
- Select /* ft */ 01810000
- When ft = "*" Then Return '1' 01820000
- When ft = "-" Then Return '1' 01830000
- When ft = "" Then Return '1' 01840000
- When ft = "FILELIST" Then Return '1' 01850000
- When ft = "GOPHER" Then Return '1' 01860000
- /* When ft = "CSO" Then Return '2' */ 01870000
- /* When ft = ? Then Return '3' */ 01880000
- /* When ft = "MAC" Then Return '4' */ 01890000
- /* When ft = "DOS" Then Return '5' */ 01900000
- When ft = "UUE" Then Return '6' 01910000
- /* When ft = "SEARCH" Then Return '7' */ 01920000
- /* When ft = "TELNET" Then Return '8' */ 01930000
- When ft = "TXT" Then Return '0' /* plain text */ 01940000
- When ft = "TEXT" Then Return '9' /* deck; not plain text */01950000
- When ft = "TXTLIB" Then Return '9' 01960000
- When Left(ft,3) = "TXT" Then Return '9' 01970000
- When ft = "CARDDUMP" Then Return '9' 01980000
- When ft = "TAR" Then Return '9' 01990000
- When ft = "EXE" Then Return '9' 02000000
- When ft = "DVI" Then Return '9' 02010000
- When ft = "TFM" Then Return '9' 02020000
- When ft = "FMT" Then Return '9' 02030000
- When ft = "ADMGDF" Then Return '9' 02040000
- When ft = "ADMSYMBL" Then Return '9' 02050000
- When ft = "SASUSER" Then Return '9' 02060000
- When ft = "SAS6USER" Then Return '9' 02070000
- When ft = "SND" Then Return 's' 02080000
- /* When ft = "EPS" Then Return 'p' */ 02090000
- /* When ft = "PS" Then Return 'p' */ 02100000
- When ft = "MODULE" Then Return 'v' 02110000
- When ft = "LOADLIB" Then Return 'v' 02120000
- When ft = "XRX" Then Return 'v' 02130000
- When ft = "GIF" Then Return 'I' 02140000
- Otherwise Return '0' 02150000
- End /* Select ft */ 02160000
- 02170000
-