home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Rice_CMS / gopher24 / gopsrvgl.$rexx < prev    next >
Encoding:
Text File  |  1993-01-25  |  5.9 KB  |  76 lines

  1. /*                                                                      00010000
  2.  *        Name: GOPSRVGL REXX                                           00020000
  3.  *              read and process a GOPHER (link) file for GOPHERD       00030000
  4.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  5.  *        Date: 1993-Jan-15                                             00050000
  6.  */                                                                     00060000
  7.                                                                         00070000
  8. /*                                                                      00080000
  9.  *      Copyright 1993 Richard M. Troth.   This software was developed  00090000
  10.  *      with resources provided by Rice University and is intended      00100000
  11.  *      to serve Rice's user community.   Rice has benefitted greatly   00110000
  12.  *      from the free distribution of software,  therefore distribution 00120000
  13.  *      of unmodified copies of this material is not restricted.        00130000
  14.  *      You may change your own copy as needed.   Neither Rice          00140000
  15.  *      University nor any of its employees or students shall be held   00150000
  16.  *      liable for damages resulting from the use of this software.     00160000
  17.  */                                                                     00170000
  18.                                                                         00180000
  19. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET HOST PORT'                00190000
  20. localhost = host;   localport = port                                    00200000
  21. host = "";  port = "";  path = "";  name = "";  type = ""               00210000
  22.                                                                         00220000
  23. Do Forever                                                              00230000
  24.                                                                         00240000
  25.     'PEEKTO RECORD'                                                     00250000
  26.     If rc ^= 0 Then Leave                                               00260000
  27.                                                                         00270000
  28.     If Left(record,1) = '*' Then Call WRITELINK                         00280000
  29.     If Left(record,1) = '#' Then Call WRITELINK                         00290000
  30.     If rc ^= 0 Then Leave                                               00300000
  31.                                                                         00310000
  32.     Parse Var record var '=' val                                        00320000
  33.     Upper var; var = Strip(var)                                         00330000
  34.     Select  /*  var  */                                                 00340000
  35.         When var = "TYPE" Then type = Strip(val)                        00350000
  36.         When var = "NAME" Then name = val                               00360000
  37.         When var = "PATH" Then path = val                               00370000
  38.         When var = "HOST" Then host = Strip(val)                        00380000
  39.         When var = "PORT" Then port = Strip(val)                        00390000
  40.         Otherwise nop   /*  ignore invalid lines  */                    00400000
  41.         End  /*  Select  var  */                                        00410000
  42.                                                                         00420000
  43.     'READTO'                                                            00430000
  44.     If rc ^= 0 Then Leave                                               00440000
  45.                                                                         00450000
  46.     End  /*  Do  Forever  */                                            00460000
  47.                                                                         00470000
  48. If rc = 12 Then Call WRITELINK                                          00480000
  49.                                                                         00490000
  50. Exit rc * (rc ^= 12)                                                    00500000
  51.                                                                         00510000
  52.                                                                         00520000
  53.                                                                         00530000
  54. /* ----------------------------------------------------------- WRITELINK00540000
  55.  *  Looks like a break.  Iff we have everthing,                         00550000
  56.  *  then write this link and reset the variables to empty strings.      00560000
  57.  */                                                                     00570000
  58. WRITELINK:                                                              00580000
  59. If  name = "" | type = "" Then  Return                                  00590000
  60. If  host = ""   Then host = localhost                                   00600000
  61. If  host = "+"  Then host = localhost                                   00610000
  62. If  type = "FILE"       Then type = '0'                                 00620000
  63. If  type = "DIRECTORY"  Then type = '1'                                 00630000
  64. If  port = "" Then                                                      00640000
  65. Select  /*  type  */                                                    00650000
  66.     When  type = '2'  Then port = '105'                                 00660000
  67.     When  type = '8'  Then port = '23'                                  00670000
  68.     When  type = 'T'  Then port = '23'                                  00680000
  69.     Otherwise port = '70'                                               00690000
  70.     End  /*  Select  type  */                                           00700000
  71. 'OUTPUT' type || name || '05'x || path || '05'x ,                       00710000
  72.               || host || '05'x || port                                  00720000
  73. host = "";  port = "";  path = "";  name = "";  type = ""               00730000
  74. Return                                                                  00740000
  75.                                                                         00750000
  76.