home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / mvs / ggmvs.distrib.cntl < prev    next >
Text File  |  1993-01-26  |  819KB  |  10,114 lines

  1. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  2. //*------------------------------------------------------------------*/         
  3. //*                                                                  */         
  4. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5. //*                                                                  */         
  6. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  7. //* including the implied warranties of merchantability and fitness, */         
  8. //* are expressly denied.                                            */         
  9. //*                                                                  */         
  10. //* Provided this copyright notice is included, this software may    */         
  11. //* be freely distributed and not offered for sale.                  */         
  12. //*                                                                  */         
  13. //* Changes or modifications may be made and used only by the maker  */         
  14. //* of same, and not further distributed.  Such modifications should */         
  15. //* be mailed to the author for consideration for addition to the    */         
  16. //* software and incorporation in subsequent releases.               */         
  17. //*                                                                  */         
  18. //*------------------------------------------------------------------*/         
  19. //*                                                                             
  20. //* MVS GOPHER client                                                           
  21. //*                                                                             
  22. //* Author:  Steve Bacher <seb1525@mvs.draper.com>                              
  23. //*                                                                             
  24. //* Date:  July, 1992                                                           
  25. //*                                                                             
  26. //*--------------------------------------------------------------------         
  27. //*                                                                             
  28. //* This job creates the GOPHER distribution libraries (PDS's).                 
  29. //*                                                                             
  30. //* Run this JCL to create the PDS's, after customizing to suit.                
  31. //* (Obviously, put in a good JOB statement first.)                             
  32. //* To customize the JCL, change the defaults on the //GGLOAD PROC              
  33. //* statement to your liking, particularly the PREFIX default.                  
  34. //* You might also want to change the final qualifiers of the PDS's             
  35. //* created - to do this, find the // EXEC GGLOAD statements and                
  36. //* change the value of the TO parameter.                                       
  37. //*                                                                             
  38. //* See the $$README file (of the CNTL PDS, first in this stream)               
  39. //* for the rest of the installation instructions.                              
  40. //*                                                                             
  41. //GGLOAD  PROC CLS='*',BS='6160',U='3380',V='',                                 
  42. //             TRK1='30',TRK2='10',DIR='35',RLSE='RLSE',                        
  43. //             PREFIX='GOPHER.INSTALL.'                                         
  44. //*                                                                             
  45. //IEBUPDTE EXEC PGM=IEBUPDTE,PARM=NEW                                           
  46. //SYSPRINT DD   SYSOUT=&CLS                                                     
  47. //SYSUT2   DD   DISP=(NEW,CATLG,DELETE),DSN=&PREFIX.&TO,                        
  48. //         DCB=(RECFM=FB,LRECL=80,BLKSIZE=&BS),                                 
  49. //         SPACE=(TRK,(&TRK1,&TRK2,&DIR),&RLSE),UNIT=&U,VOL=SER=&V              
  50. //*                                                                             
  51. //         PEND                                                                 
  52. //CNTL     EXEC GGLOAD,TRK1='4',TO='CNTL'                                       
  53. //SYSIN    DD DATA,DLM='?!'                                                     
  54. ./   ADD NAME=$$README,SSI=010B0044                                             
  55.                                                                                 
  56. ------------------------------------------------------------------------        
  57.                                                                                 
  58.  Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992                  
  59.                                                                                 
  60.  MVS Gopher Server originally by Shawn Hart (Univ. of Delaware).                
  61.                                                                                 
  62.  This software is provided on an "AS IS" basis.  All warranties,                
  63.  including the implied warranties of merchantability and fitness,               
  64.  are expressly denied.                                                          
  65.                                                                                 
  66.  Provided this copyright notice is included, this software may                  
  67.  be freely distributed and not offered for sale.                                
  68.                                                                                 
  69.  Changes or modifications may be made and used only by the maker                
  70.  of same, and not further distributed.  Such modifications should               
  71.  be mailed to the author for consideration for addition to the                  
  72.  software and incorporation in subsequent releases.                             
  73.                                                                                 
  74. ------------------------------------------------------------------------        
  75.                                                                                 
  76.  MVS Gopher Client                                                              
  77.                                                                                 
  78.  Author:          Steve Bacher <seb1525@mvs.draper.com>                         
  79.                                                                                 
  80.  MVS Gopher Server                                                              
  81.                                                                                 
  82.  Author:          Shawn Hart   <shawn.hart@mvs.udel.edu>                        
  83.  Enhancements:    Steve Bacher <seb1525@mvs.draper.com>                         
  84.                                                                                 
  85. ------------------------------------------------------------------------        
  86.                                                                                 
  87.  Contents of PDS's belonging to Gopher distribution:                            
  88.                                                                                 
  89.  Member     PDS Type    Description                                             
  90.                                                                                 
  91.  $$README   CNTL        This file                                               
  92.  ACCESS     CNTL        Sample server access file                               
  93.  ALLOAD     CNTL        JCL to allocate GOPHER load library                     
  94.  COMPILEC   CNTL        JCL to compile and link C source for client             
  95.  COMPILES   CNTL        JCL to compile and link C source for server             
  96.  GOPHERD    CNTL        JCL to run the GOPHER server in batch (No TSO)          
  97.  GOPHERT    CNTL        JCL to run the GOPHER server in batch (w. TSO)          
  98.  HELP       CNTL        TSO Help for Gopher client (with XPROC support)         
  99.  HELQ       CNTL        TSO Help for Gopher client (without XPROC)              
  100.  INSTALLC   CNTL        How to install the GOPHER MVS client                    
  101.  INSTALLS   CNTL        How to install the GOPHER MVS server                    
  102.  MENU       CNTL        Initial Gopher server menu                              
  103.  GOPHER     CLIST       Exec by which users invoke the Gopher client            
  104.  NNMFIUCV   CLIST       Exec to check for multiple socket applications          
  105.  GGM...     PANEL       ISPF regular panels                                     
  106.  GG...      H           C headers for compilation                               
  107.  GG...      C           C source for compilation                                
  108.  ABOUT...   ABOUT       "About This Gopher" text                                
  109.                                                                                 
  110. --------------------------------------------------------------------            
  111.                                                                                 
  112. Where to Go from Here:                                                          
  113.                                                                                 
  114.  To install the GOPHER MVS client, read member INSTALLC.                        
  115.                                                                                 
  116.  To install the GOPHER MVS server, read member INSTALLS.                        
  117.                                                                                 
  118. Note:                                                                           
  119.                                                                                 
  120.  You may install only the client, only the server, or both the                  
  121.  client and the server.  It is purely up to what your needs are.                
  122.                                                                                 
  123. --------------------------------------------------------------------            
  124.                                                                                 
  125. Changes:                                                                        
  126.                                                                                 
  127.  10/19/92 - Improvements in initial startup and GOPHERRC customization          
  128.                                                                                 
  129. --------------------------------------------------------------------            
  130.                                                                                 
  131.  Questions?  Comments?  Suggestions?  Gripes?  Please email to...               
  132.                                                                                 
  133.  Steve Bacher      <seb@draper.com> or <seb1525@mvs.draper.com>                 
  134.                                                                                 
  135. ./   ADD NAME=ACCESS,SSI=01010008                                               
  136. !                                                                               
  137. ! Format of entries:                                                            
  138. !                                                                               
  139. ! filename (fully qualified, all uppercase, no quotes)                          
  140. ! can be "DD:DDNAME" or "EXEC:EXECNAME"                                         
  141. !                                                                               
  142. ! followed by names of hosts which are authorized to access the data.           
  143. ! If no host name list is present, all hosts are authorized                     
  144. !                                                                               
  145. ! You may specify the same file name more than once, if you need                
  146. ! more lines to put host names on.                                              
  147. !                                                                               
  148. ! Individual PDS members must be specified separately.  A PDS without           
  149. ! a member name establishes access only to the PDS directory.                   
  150. !                                                                               
  151. ! Note that the default directory MUST be in this table.                        
  152. !                                                                               
  153. ! Also note that in the case of EXECs, the EXEC must live in the                
  154. ! library allocated to GGEXEC in the Gopher server JCL.                         
  155. !                                                                               
  156. ! *** ANY DATA SET REFERENCED BY ANY EXEC IN THAT LIBRARY IS FULLY              
  157. ! *** ACCESSIBLE TO GOPHER REGARDLESS OF THIS TABLE!  USE THIS TABLE            
  158. ! *** TO GOVERN CONTROL TO THE EXEC ITSELF!!!                                   
  159.                                                                                 
  160. !                                                                               
  161. ! below is default directory spec, which MUST be in this table                  
  162. !                                                                               
  163. DD:GGGOPHER                                                                     
  164.                                                                                 
  165. EXEC:CHECKLST                     support1 support2 mvs                         
  166. EXEC:WAISDIR                                                                    
  167. EXEC:WAISLIST                                                                   
  168. EXEC:WAISSRCH                                                                   
  169.                                                                                 
  170. ANY.PUBLIC.SEQ.DS                                                               
  171. ANY.SEMI.PUBLIC.SEQ.DS            goodclient1 goodclient2                       
  172. ANY.SEMI.PUBLIC.SEQ.DS            goodclient3 goodclient4                       
  173.                                                                                 
  174. ! PDS without member name provides access to directory only                     
  175. ! All member names must be explicitly listed to be accessible.                  
  176.                                                                                 
  177. ANY.PUBLIC.PDS                                                                  
  178. ANY.PUBLIC.PDS(MEMBER1)                                                         
  179. ANY.PUBLIC.PDS(MEMBER2)                                                         
  180. ANY.PUBLIC.PDS(MEMBER3)                                                         
  181. ANY.PUBLIC.PDS(MEMBER4)                                                         
  182.                                                                                 
  183.                                                                                 
  184. ANY.SEMI.PUBLIC.PDS               goodclient1 goodclient2                       
  185. ANY.SEMI.PUBLIC.PDS               goodclient3 goodclient4                       
  186. ANY.SEMI.PUBLIC.PDS(MEMBER1)      goodclient1                                   
  187. ANY.SEMI.PUBLIC.PDS(MEMBER2)      goodclient2                                   
  188. ANY.SEMI.PUBLIC.PDS(MEMBER3)      goodclient3                                   
  189. ANY.SEMI.PUBLIC.PDS(MEMBER4)      goodclient4                                   
  190.                                                                                 
  191. ./   ADD NAME=ALLOAD,SSI=01010051                                               
  192. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  193. //*                                                                  */         
  194. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  195. //*                                                                  */         
  196. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  197. //* including the implied warranties of merchantability and fitness, */         
  198. //* are expressly denied.                                            */         
  199. //*                                                                  */         
  200. //* Provided this copyright notice is included, this software may    */         
  201. //* be freely distributed and not offered for sale.                  */         
  202. //*                                                                  */         
  203. //* Changes or modifications may be made and used only by the maker  */         
  204. //* of same, and not further distributed.  Such modifications should */         
  205. //* be mailed to the author for consideration for addition to the    */         
  206. //* software and incorporation in subsequent releases.               */         
  207. //*                                                                  */         
  208. //*                                                                             
  209. //* Allocate GOPHER load library before install                                 
  210. //*                                                                             
  211. //GGALLOC PROC BS='6233',U='3380',V='',                                         
  212. //             PRI='100',SEC='100',DIR='35'                                     
  213. //*                                                                             
  214. //IEFBR14  EXEC PGM=IEFBR14                                                     
  215. //ALLOCDD  DD   DISP=(NEW,CATLG,DELETE),DSN=&LIB,                               
  216. //         DCB=(RECFM=U,BLKSIZE=&BS),                                           
  217. //         SPACE=(&BS,(&PRI,&SEC,&DIR)),UNIT=&U,VOL=SER=&V                      
  218. //*                                                                             
  219. //         PEND                                                                 
  220. //*                                                                             
  221. //* The following step allocates the load library from which the                
  222. //* executable program will be run.  If you intend to place the                 
  223. //* executable into an existing library, you can skip this step.                
  224. //* Otherwise, the name must match the name used on the LOADLIB                 
  225. //* parameter of the GGLINK procedure in the COMPILE JCL.                       
  226. //*                                                                             
  227. //* If you want separate libraries for the client and the server,               
  228. //* just dup this step and give 'em different lib names.                        
  229. //*                                                                             
  230. //ALLOC1   EXEC GGALLOC,PRI=50,SEC=50,DIR=35,                                   
  231. //         LIB='GOPHER.LOAD'                                                    
  232. //*                                                                             
  233. ./   ADD NAME=COMPILEC                                                          
  234. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  235. //*                                                                  */         
  236. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  237. //*                                                                  */         
  238. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  239. //* including the implied warranties of merchantability and fitness, */         
  240. //* are expressly denied.                                            */         
  241. //*                                                                  */         
  242. //* Provided this copyright notice is included, this software may    */         
  243. //* be freely distributed and not offered for sale.                  */         
  244. //*                                                                  */         
  245. //* Changes or modifications may be made and used only by the maker  */         
  246. //* of same, and not further distributed.  Such modifications should */         
  247. //* be mailed to the author for consideration for addition to the    */         
  248. //* software and incorporation in subsequent releases.               */         
  249. //*                                                                  */         
  250. //*********************************************************************         
  251. //*                                                                             
  252. //* Compile some or all GOPHER C/370 sources to make the SYSLIN input           
  253. //* to the linkedit of the executable Gopher load module(s).                    
  254. //*                                                                             
  255. //GGCC   PROC MEMBER=,                                                          
  256. //            SRCLIB='GOPHER.C',                 GOPHER C source PDS            
  257. //            HDRLIB='GOPHER.H',                 GOPHER C headers PDS           
  258. //            COMMHDR='TCPIP.COMMMAC',           C/370 TCP/IP headers           
  259. //            C370HDR='SYS1.EDCHDRS',            C/370 standard headers         
  260. //            SYSMSGS='SYS1.EDCMSGS',            C/370 messages file            
  261. //            SYSMSGM='EDCMSGE',                 C/370 message member           
  262. //            VIOUNIT=VIO,                       Temporary disk unit            
  263. //            OUTCLAS='*',                          SYSOUT class                
  264. //            CPARMS='SOURCE EXPMAC NOAGGR NOXREF', Compile parameters          
  265. //            TEST=TEST                             TEST or NOTEST              
  266. //*                                                                             
  267. //CCOMP     EXEC PGM=EDCCOMP,PARM='MARGINS(1,72) &TEST &CPARMS'                 
  268. //SYSMSGS   DD DISP=SHR,DSN=&SYSMSGS(&SYSMSGM)                                  
  269. //SYSIN     DD DISP=SHR,DSN=&SRCLIB(&MEMBER)                                    
  270. //SYSLIB    DD DISP=SHR,DSN=&COMMHDR                                            
  271. //          DD DISP=SHR,DSN=&C370HDR                                            
  272. //USERLIB   DD DISP=SHR,DSN=&HDRLIB                                             
  273. //SYSLIN    DD DSN=&&LOADSET,UNIT=&VIOUNIT,DISP=(MOD,PASS),                     
  274. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  275. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  276. //SYSCPRT   DD SYSOUT=&OUTCLAS                                                  
  277. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  278. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  279. //SYSUT4    DD DSN=&&SYSUT4,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  280. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  281. //SYSUT6    DD DSN=&&SYSUT6,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  282. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  283. //SYSUT7    DD DSN=&&SYSUT7,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  284. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  285. //SYSUT8    DD DSN=&&SYSUT8,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  286. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  287. //SYSUT9    DD DSN=&&SYSUT9,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  288. //   SPACE=(32000,(30,30)),DCB=(RECFM=VB,LRECL=137,BLKSIZE=882)                 
  289. //SYSUT10   DD SYSOUT=&OUTCLAS                                                  
  290. //*                                                                             
  291. //         PEND                                                                 
  292. //*                                                                             
  293. //*********************************************************************         
  294. //*                                                                             
  295. //* Linkedit an executable Gopher load module.                                  
  296. //*                                                                             
  297. //* Note: If C/370 V1R2 or higher, and you have therefore accepted              
  298. //*       the "#define FETCH" in the GG header, you may delete                  
  299. //*       the line that includes the ISPLINK library.                           
  300. //*                                                                             
  301. //* Note: If TCP/IP V2 or higher, remove the PASCAL link libraries              
  302. //*       from the JCL and the AMPZMVSB card from the control deck.             
  303. //*                                                                             
  304. //GGLINK PROC LOADLIB='GOPHER.LOAD',             Executable load library        
  305. //            PLIBASE='SYS1.PLIBASE',            PL/1   link library            
  306. //            EDCBASE='SYS1.SEDCBASE',           C/370  link library            
  307. //            IBMBASE='SYS1.SIBMBASE',           PL/1+C common library          
  308. //            COMMTXT='TCPIP.COMMTXT',           TCP/IP link library            
  309. //            PASRUN3='SYS1.PAS.SAMPRUN3',       PASCAL link library            
  310. //            PASRUN1='SYS1.PAS.SAMPRUN1',       PASCAL link library            
  311. //            PASMSG1='SYS1.PAS.SAMPMSG1',       PASCAL link library            
  312. //            ISPLINK='ISP.V3R2M0.ISPLLIB',      ISPLINK link library           
  313. //            VIOUNIT=VIO,                       Temporary disk unit            
  314. //            OUTCLAS='*',                          SYSOUT class                
  315. //            LPARMS='LIST,LET,MAP',                Linkedit parameters         
  316. //            TEST=TEST                             TEST or NOTEST              
  317. //*                                                                             
  318. //LKED      EXEC PGM=IEWL,PARM='AMODE(31),&TEST,&LPARMS'                        
  319. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  320. //SYSLIB    DD DISP=SHR,DSN=&PLIBASE                                            
  321. //          DD DISP=SHR,DSN=&EDCBASE                                            
  322. //          DD DISP=SHR,DSN=&IBMBASE                                            
  323. //          DD DISP=SHR,DSN=&COMMTXT                                            
  324. //          DD DISP=SHR,DSN=&PASRUN3  if TCP/IP V1 only                         
  325. //          DD DISP=SHR,DSN=&PASRUN1  if TCP/IP V1 only                         
  326. //          DD DISP=SHR,DSN=&PASMSG1  if TCP/IP V1 only                         
  327. //          DD DISP=SHR,DSN=&ISPLINK  if C/370 V1R1 with #undef FETCH           
  328. //SYSLMOD   DD DISP=SHR,DSN=&LOADLIB                                            
  329. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  330. //          SPACE=(32000,(30,30))                                               
  331. //*                                                                             
  332. //         PEND                                                                 
  333. //*                                                                             
  334. //GGCLIENT EXEC GGCC,MEMBER=GGCLIENT                                            
  335. //GGMALLOC EXEC GGCC,MEMBER=GGMALLOC                                            
  336. //GGMBRIFC EXEC GGCC,MEMBER=GGMBRIFC                                            
  337. //GGMBRIFR EXEC GGCC,MEMBER=GGMBRIFR                                            
  338. //GGMCLRTX EXEC GGCC,MEMBER=GGMCLRTX                                            
  339. //GGMCONN  EXEC GGCC,MEMBER=GGMCONN                                             
  340. //GGMDFAIL EXEC GGCC,MEMBER=GGMDFAIL                                            
  341. //GGMDIR   EXEC GGCC,MEMBER=GGMDIR                                              
  342. //GGMDISC  EXEC GGCC,MEMBER=GGMDISC                                             
  343. //GGMDISPL EXEC GGCC,MEMBER=GGMDISPL                                            
  344. //GGMDUMP  EXEC GGCC,MEMBER=GGMDUMP                                             
  345. //GGMESRVR EXEC GGCC,MEMBER=GGMESRVR                                            
  346. //GGMFREEM EXEC GGCC,MEMBER=GGMFREEM                                            
  347. //GGMGETDS EXEC GGCC,MEMBER=GGMGETDS                                            
  348. //GGMGETM  EXEC GGCC,MEMBER=GGMGETM                                             
  349. //GGMGOFOR EXEC GGCC,MEMBER=GGMGOFOR                                            
  350. //GGMGSRVL EXEC GGCC,MEMBER=GGMGSRVL                                            
  351. //GGMIERR  EXEC GGCC,MEMBER=GGMIERR                                             
  352. //GGMIGET  EXEC GGCC,MEMBER=GGMIGET                                             
  353. //GGMISPF  EXEC GGCC,MEMBER=GGMISPF                                             
  354. //GGMIVGET EXEC GGCC,MEMBER=GGMIVGET                                            
  355. //GGMIVPUT EXEC GGCC,MEMBER=GGMIVPUT                                            
  356. //GGMMTFER EXEC GGCC,MEMBER=GGMMTFER                                            
  357. //GGMOUTS  EXEC GGCC,MEMBER=GGMOUTS                                             
  358. //GGMOUTTX EXEC GGCC,MEMBER=GGMOUTTX                                            
  359. //GGMPMSG  EXEC GGCC,MEMBER=GGMPMSG                                             
  360. //GGMPROC  EXEC GGCC,MEMBER=GGMPROC                                             
  361. //GGMPTX   EXEC GGCC,MEMBER=GGMPTX                                              
  362. //GGMSOCKT EXEC GGCC,MEMBER=GGMSOCKT                                            
  363. //GGMSOPT  EXEC GGCC,MEMBER=GGMSOPT                                             
  364. //GGMSSRVR EXEC GGCC,MEMBER=GGMSSRVR                                            
  365. //GGMTNET  EXEC GGCC,MEMBER=GGMTNET                                             
  366. //GGMTSO   EXEC GGCC,MEMBER=GGMTSO                                              
  367. //GGMTYPE  EXEC GGCC,MEMBER=GGMTYPE                                             
  368. //GGMUNALC EXEC GGCC,MEMBER=GGMUNALC                                            
  369. //GGMVTX   EXEC GGCC,MEMBER=GGMVTX                                              
  370. //GGMWAIS  EXEC GGCC,MEMBER=GGMWAIS                                             
  371. //GGMWHOIS EXEC GGCC,MEMBER=GGMWHOIS                                            
  372. //GGMXTX   EXEC GGCC,MEMBER=GGMXTX                                              
  373. //*                                                                             
  374. //* Link GOPHER load module. Like SMP/E, expect return code 8 when              
  375. //* doing this from scratch.  Additional one-or-two-module links                
  376. //* will just replace the corresponding parts of the load module.               
  377. //*                                                                             
  378. //GGLINK EXEC GGLINK                                                            
  379. //LKED.SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET                                
  380. //            DD *                                                              
  381.  INCLUDE SYSLMOD(GGCLIENT)            if included first time, RC = 8            
  382.  INCLUDE SYSLIB(AMPZMVSB)             include if TCP/IP V1 only                 
  383.  ENTRY   CEESTART                                                               
  384.  NAME    GGCLIENT(R)                                                            
  385. /*                                                                              
  386. ./   ADD NAME=COMPILES,SSI=01030011                                             
  387. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  388. //*                                                                  */         
  389. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  390. //*                                                                  */         
  391. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  392. //* including the implied warranties of merchantability and fitness, */         
  393. //* are expressly denied.                                            */         
  394. //*                                                                  */         
  395. //* Provided this copyright notice is included, this software may    */         
  396. //* be freely distributed and not offered for sale.                  */         
  397. //*                                                                  */         
  398. //* Changes or modifications may be made and used only by the maker  */         
  399. //* of same, and not further distributed.  Such modifications should */         
  400. //* be mailed to the author for consideration for addition to the    */         
  401. //* software and incorporation in subsequent releases.               */         
  402. //*                                                                  */         
  403. //*********************************************************************         
  404. //*                                                                             
  405. //* Compile some or all GOPHER C/370 sources to make the SYSLIN input           
  406. //* to the linkedit of the executable Gopher load module.                       
  407. //*                                                                             
  408. //GGCC   PROC MEMBER=,                                                          
  409. //            SRCLIB='GOPHER.C',                 GOPHER C source PDS            
  410. //            HDRLIB='GOPHER.H',                 GOPHER C headers PDS           
  411. //            COMMHDR='TCPIP.COMMMAC',           C/370 TCP/IP headers           
  412. //            C370HDR='SYS1.EDCHDRS',            C/370 standard headers         
  413. //            SYSMSGS='SYS1.EDCMSGS',            C/370 messages file            
  414. //            SYSMSGM='EDCMSGE',                 C/370 message member           
  415. //            VIOUNIT=VIO,                       Temporary disk unit            
  416. //            OUTCLAS='*',                          SYSOUT class                
  417. //            CPARMS='SOURCE EXPMAC NOAGGR NOXREF', Compile parameters          
  418. //            TEST=TEST                             TEST or NOTEST              
  419. //*                                                                             
  420. //CCOMP     EXEC PGM=EDCCOMP,PARM='MARGINS(1,72) &TEST &CPARMS'                 
  421. //SYSMSGS   DD DISP=SHR,DSN=&SYSMSGS(&SYSMSGM)                                  
  422. //SYSIN     DD DISP=SHR,DSN=&SRCLIB(&MEMBER)                                    
  423. //SYSLIB    DD DISP=SHR,DSN=&COMMHDR                                            
  424. //          DD DISP=SHR,DSN=&C370HDR                                            
  425. //USERLIB   DD DISP=SHR,DSN=&HDRLIB                                             
  426. //SYSLIN    DD DSN=&&LOADSET,UNIT=&VIOUNIT,DISP=(MOD,PASS),                     
  427. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  428. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  429. //SYSCPRT   DD SYSOUT=&OUTCLAS                                                  
  430. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  431. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  432. //SYSUT4    DD DSN=&&SYSUT4,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  433. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  434. //SYSUT6    DD DSN=&&SYSUT6,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  435. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  436. //SYSUT7    DD DSN=&&SYSUT7,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  437. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  438. //SYSUT8    DD DSN=&&SYSUT8,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  439. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  440. //SYSUT9    DD DSN=&&SYSUT9,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  441. //   SPACE=(32000,(30,30)),DCB=(RECFM=VB,LRECL=137,BLKSIZE=882)                 
  442. //SYSUT10   DD SYSOUT=&OUTCLAS                                                  
  443. //*                                                                             
  444. //         PEND                                                                 
  445. //*                                                                             
  446. //*********************************************************************         
  447. //*                                                                             
  448. //* Linkedit the executable Gopher load modules.                                
  449. //*                                                                             
  450. //* Note: If TCP/IP V2 or higher, remove the PASCAL link libraries              
  451. //*       from the JCL and the AMPZMVSB card from the control deck.             
  452. //*                                                                             
  453. //GGLINK PROC LOADLIB='GOPHER.LOAD',             Executable load library        
  454. //            PLIBASE='SYS1.PLIBASE',            PL/1   link library            
  455. //            EDCBASE='SYS1.SEDCBASE',           C/370  link library            
  456. //            IBMBASE='SYS1.SIBMBASE',           PL/1+C common library          
  457. //            COMMTXT='TCPIP.COMMTXT',           TCP/IP link library            
  458. //            PASRUN3='SYS1.PAS.SAMPRUN3',       PASCAL link library            
  459. //            PASRUN1='SYS1.PAS.SAMPRUN1',       PASCAL link library            
  460. //            PASMSG1='SYS1.PAS.SAMPMSG1',       PASCAL link library            
  461. //            VIOUNIT=VIO,                       Temporary disk unit            
  462. //            OUTCLAS='*',                          SYSOUT class                
  463. //            LPARMS='LIST,LET,MAP',                Linkedit parameters         
  464. //            TEST=TEST                             TEST or NOTEST              
  465. //*                                                                             
  466. //LKED      EXEC PGM=IEWL,PARM='AMODE(31),&TEST,&LPARMS'                        
  467. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  468. //SYSLIB    DD DISP=SHR,DSN=&PLIBASE                                            
  469. //          DD DISP=SHR,DSN=&EDCBASE                                            
  470. //          DD DISP=SHR,DSN=&IBMBASE                                            
  471. //          DD DISP=SHR,DSN=&COMMTXT                                            
  472. //          DD DISP=SHR,DSN=&PASRUN3  if TCP/IP V1 only                         
  473. //          DD DISP=SHR,DSN=&PASRUN1  if TCP/IP V1 only                         
  474. //          DD DISP=SHR,DSN=&PASMSG1  if TCP/IP V1 only                         
  475. //SYSLMOD   DD DISP=SHR,DSN=&LOADLIB                                            
  476. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  477. //          SPACE=(32000,(30,30))                                               
  478. //*                                                                             
  479. //         PEND                                                                 
  480. //*                                                                             
  481. //GGMALLOC EXEC GGCC,MEMBER=GGMALLOC                                            
  482. //GGMDFAIL EXEC GGCC,MEMBER=GGMDFAIL                                            
  483. //GGMUNALC EXEC GGCC,MEMBER=GGMUNALC                                            
  484. //GGMOUTS  EXEC GGCC,MEMBER=GGMOUTS                                             
  485. //GGMPROC  EXEC GGCC,MEMBER=GGMPROC                                             
  486. //GGSTASK  EXEC GGCC,MEMBER=GGSTASK                                             
  487. //*                                                                             
  488. //* Link GOPHER subtask module.  Like SMP/E, expect return code 8               
  489. //* doing this from scratch.  Additional one-or-two-module links                
  490. //* will just replace the corresponding parts of the load module.               
  491. //*                                                                             
  492. //GGLINKT EXEC GGLINK                                                           
  493. //LKED.SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET                                
  494. //            DD *                                                              
  495.  INCLUDE SYSLMOD(GGSTASK)             if included first time, RC = 8            
  496.  INCLUDE SYSLIB(AMPZMVSB)             include if TCP/IP V1 only                 
  497.  INCLUDE SYSLIB(IUCVFORC)                                                       
  498.  INCLUDE SYSLIB(EDCMTFS)                                                        
  499.  ENTRY   CEESTART                                                               
  500.  NAME    GGSTASK(R)                                                             
  501. /*                                                                              
  502. //GGMMTFER EXEC GGCC,MEMBER=GGMMTFER                                            
  503. //GGSERVER EXEC GGCC,MEMBER=GGSERVER                                            
  504. //*                                                                             
  505. //* Link GOPHER server module.  Like SMP/E, expect return code 8                
  506. //* doing this from scratch.  Additional one-or-two-module links                
  507. //* will just replace the corresponding parts of the load module.               
  508. //*                                                                             
  509. //GGLINKS EXEC GGLINK                                                           
  510. //LKED.SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET                                
  511. //            DD *                                                              
  512.  INCLUDE SYSLMOD(GGSERVER)            if included first time, RC = 8            
  513.  INCLUDE SYSLIB(AMPZMVSB)             include if TCP/IP V1 only                 
  514.  ENTRY   CEESTART                                                               
  515.  NAME    GGSERVER(R)                                                            
  516. /*                                                                              
  517. ./   ADD NAME=GOPHERD,SSI=01040016                                              
  518. //GOPHERD  PROC MODULE=GGSERVER,                                        00010000
  519. //         STEPLIB='GOPHER.LOAD',                                       00020000
  520. //         EXECLIB='GOPHER.EXEC',                                       00030000
  521. //         ACCESS='GOPHER.ACCESS',                                      00040000
  522. //         ABOUT='GOPHER.ABOUT',                                        00050000
  523. //         MENU='GOPHER.MENU'                                           00050000
  524. //*                                                                     00060000
  525. //********************************************************************* 00070000
  526. //*                                                                   * 00080000
  527. //* GOPHER daemon, by Shawn Hart (U.Del.) and Steve Bacher (D.Lab.)   * 00090000
  528. //*                                                                   * 00100000
  529. //* Straight batch (no TSO access)                                    * 00100000
  530. //*                                                                   * 00100000
  531. //********************************************************************* 00110000
  532. //*                                                                     00120000
  533. //GOPHERD  EXEC PGM=&MODULE                                             00150001
  534. //STEPLIB  DD   DISP=SHR,DSN=&STEPLIB                                   00170000
  535. //GGEXEC   DD   DISP=SHR,DSN=&EXECLIB                                   00181002
  536. //SYSTSPRT DD   UNIT=SYSVIO,SPACE=(TRK,(100,100)),RECFM=VBA,LRECL=255   00190000
  537. //SYSERR   DD   SYSOUT=*                                                00200000
  538. //SYSPRINT DD   SYSOUT=*                                                00210000
  539. //SYSTSIN  DD   DUMMY                                                   00210000
  540. //SYSIN    DD   DUMMY                                                   00210000
  541. //GGABOUT  DD   DISP=SHR,DSN=&ABOUT                                     00230000
  542. //GGACCESS DD   DISP=SHR,DSN=&ACCESS                                    00240000
  543. //GGGOPHER DD   DISP=SHR,DSN=&MENU                                      00250000
  544. ./   ADD NAME=GOPHERT,SSI=01020039                                              
  545. //GOPHERD  PROC MODULE=GGSERVER,                                        00010000
  546. //         STEPLIB='GOPHER.LOAD',                                       00020000
  547. //         EXECLIB='GOPHER.EXEC',                                       00030000
  548. //         ACCESS='GOPHER.ACCESS',                                      00040000
  549. //         ABOUT='GOPHER.ABOUT',                                        00050000
  550. //         MENU='GOPHER.MENU'                                           00050000
  551. //*                                                                     00060000
  552. //********************************************************************* 00070000
  553. //*                                                                   * 00080000
  554. //* GOPHER daemon, by Shawn Hart (U.Del.) and Steve Bacher (D.Lab.)   * 00090000
  555. //*                                                                   * 00100000
  556. //********************************************************************* 00110000
  557. //*                                                                     00120000
  558. //GOPHERD  EXEC PGM=IKJEFT01,DYNAMNBR=128,REGION=8M,                    00150001
  559. //         PARM='&MODULE'                                               00160000
  560. //STEPLIB  DD   DISP=SHR,DSN=&STEPLIB                                   00170000
  561. //GGEXEC   DD   DISP=SHR,DSN=&EXECLIB                                   00181002
  562. //SYSTSPRT DD   UNIT=SYSVIO,SPACE=(TRK,(100,100)),RECFM=VBA,LRECL=255   00190000
  563. //SYSERR   DD   SYSOUT=*                                                00200000
  564. //SYSPRINT DD   SYSOUT=*                                                00210000
  565. //SYSTSIN  DD   DUMMY                                                   00220000
  566. //SYSIN    DD   DUMMY                                                   00230000
  567. //GGABOUT  DD   DISP=SHR,DSN=&ABOUT                                     00230000
  568. //GGACCESS DD   DISP=SHR,DSN=&ACCESS                                    00240000
  569. //GGGOPHER DD   DISP=SHR,DSN=&MENU                                      00250000
  570. ./   ADD NAME=HELP,SSI=01000051                                                 
  571. )F Function -                                                                   
  572.                                                                                 
  573.  GOPHER is a distributed document delivery service, or, more generally,         
  574.  a networked information retrieval service.  It allows you to access            
  575.  numerous types of data on various hosts in a transparent fashion.              
  576.  GOPHER presents you with a hierarchical display of information sources         
  577.  which are accessed via a client/server communications link.                    
  578.                                                                                 
  579.  There are GOPHER clients for all common hardware platforms.  The MVS           
  580.  version runs as an ISPF dialog application.                                    
  581.                                                                                 
  582.  When you use the GOPHER client, information about your use of GOPHER           
  583.  is stored in a data set called GOPHERRC.  If you don't have one,               
  584.  GOPHER will create it for you.                                                 
  585.                                                                                 
  586.  For more information on customizing your GOPHER environment, get               
  587.  into Gopher and select "About This GOPHER".                                    
  588.                                                                                 
  589. )I GOPHLOC          - local GOPHER help goes in member GOPHLOC                  
  590.                                                                                 
  591. )X Syntax -                                                                     
  592.                                                                                 
  593.    %GOPHER                                                                      
  594.               LOCAL                                                             
  595.               SERVER(hostname)                                                  
  596.               PATH(pathname)                                                    
  597.               PORT(portnumber)                                                  
  598.               DESCRIPTION(text)                                                 
  599.               FORCE                                                             
  600.               DEBUG                                                             
  601.               TEST                                                              
  602.                                                                                 
  603.    Required:  none                                                              
  604.                                                                                 
  605. )O Operands -                                                                   
  606.                                                                                 
  607. ))LOCAL                                                                         
  608.                                                                                 
  609.               Specify LOCAL if you want to enter GOPHER in "serverless"         
  610.               mode - i.e. start up with your private GOPHER menu.               
  611.               Specifying LOCAL accomplishes two things:                         
  612.                                                                                 
  613.                (1) It sets the server to "-", meaning local access.             
  614.                    Therefore, you must also provide a path, either              
  615.                    via the PATH operand or via a "localmenu:" spec              
  616.                    in your GOPHERRC file.                                       
  617.                                                                                 
  618.                (2) It allows you to use GOPHER even if there are                
  619.                    other TCP/IP socket applications active elsewhere            
  620.                    in your TSO session.  However, it will not allow             
  621.                    you to connect to any GOPHER servers, even if you            
  622.                    have a local menu item that points to one.                   
  623.                                                                                 
  624.               For information on how to set up GOPHER menus, get into           
  625.               GOPHER and select "About This Gopher".                            
  626.                                                                                 
  627. ))SERVER(hostname)                                                              
  628.                                                                                 
  629.               The host name (or IP address) of a Gopher server.                 
  630.               If this is not given, GOPHER looks in your GOPHERRC               
  631.               to find what server to connect to.  If it can't find              
  632.               an appropriate specification, you will have to enter              
  633.               a server name on the startup panel.                               
  634.                                                                                 
  635.               A server name of a single minus sign (-) is a special             
  636.               case, signifying local (serverless) access to your                
  637.               own private GOPHER data.  In this case, you must tell             
  638.               GOPHER where your menu is, either via the PATH operand            
  639.               or in the GOPHERRC file.                                          
  640.                                                                                 
  641. ))PATH(pathname)                                                                
  642.                                                                                 
  643.               The path name to be passed to the Gopher server, or               
  644.               used in local access as your initial menu.  Although              
  645.               the exact interpretation of the pathname string varies            
  646.               depending on the server, both the MVS server and the              
  647.               local GOPHER access feature interpret the pathname                
  648.               as the FULLY QUALIFIED WITHOUT QUOTES name of an MVS              
  649.               data set containing a gopher menu.  For information               
  650.               about the format of a gopher menu, see operand MENU.              
  651.                                                                                 
  652. ))PORT(portnumber)                                                              
  653.                                                                                 
  654.               You should never need to specify this field unless                
  655.               someone has set up a special kind of Gopher server                
  656.               that requires a unique port number.                               
  657.                                                                                 
  658. ))DESCRIPTION(text)                                                             
  659.                                                                                 
  660.               A text string giving the heading to be displayed for              
  661.               the initial directory of Gopher goodies.  Normally                
  662.               either the Gopher server or the Gopher client will                
  663.               have a default value for this, or you can specify                 
  664.               a description of your liking in your GOPHERRC file.               
  665.                                                                                 
  666. ))FORCE                                                                         
  667.                                                                                 
  668.               GOPHER tries to determine if there is a TCP/IP socket             
  669.               application active elsewhere in your TSO environment              
  670.               before starting up, to prevent TCP/IP errors.  If it              
  671.               tells you that there is another client active but in              
  672.               truth there is none and you know it, you can use the              
  673.               FORCE keyword to make GOPHER proceed whether it finds             
  674.               this to be the case or not.                                       
  675.                                                                                 
  676.               Using the LOCAL operand is one way to avoid this entire           
  677.               scenario.  However, that won't allow you to access any            
  678.               Gopher servers on the network.                                    
  679.                                                                                 
  680. ))DEBUG                                                                         
  681.                                                                                 
  682.               Set debugging mode on.  You must preallocate a file to            
  683.               ddname GGDEBUG for this to work.  This can be allocated           
  684.               to the terminal or a log file.  When debug mode is on,            
  685.               messages describing memory allocation and deallocation            
  686.               and GOPHER queries sent are dumped to the debug file.             
  687.                                                                                 
  688. ))TEST                                                                          
  689.                                                                                 
  690.               Activate C/370 interactive test (INSPECT).  GOPHER must           
  691.               have been compiled with the TEST option for this to be            
  692.               effective.  Note that you can also issue the TEST command         
  693.               inside GOPHER to get to INSPECT, again provided that              
  694.               GOPHER was compiled with the TEST option.                         
  695.                                                                                 
  696. ./   ADD NAME=HELQ,SSI=01000025                                                 
  697. )F Function -                                                                   
  698.                                                                                 
  699.  GOPHER is a distributed document delivery service, or, more generally,         
  700.  a networked information retrieval service.  It allows you to access            
  701.  numerous types of data on various hosts in a transparent fashion.              
  702.  GOPHER presents you with a hierarchical display of information sources         
  703.  which are accessed via a client/server communications link.                    
  704.                                                                                 
  705.  There are GOPHER clients for all common hardware platforms.  The MVS           
  706.  version runs as an ISPF dialog application.                                    
  707.                                                                                 
  708.  When you use the GOPHER client, information about your use of GOPHER           
  709.  is stored in a data set called GOPHERRC.  If you don't have one,               
  710.  GOPHER will create it for you.                                                 
  711.                                                                                 
  712.  For more information on customizing your GOPHER environment, get               
  713.  into Gopher and select "About This GOPHER".                                    
  714.                                                                                 
  715. )I GOPHLOC          - local GOPHER help goes in member GOPHLOC                  
  716.                                                                                 
  717. )X Syntax -                                                                     
  718.                                                                                 
  719.    %GOPHER                                                                      
  720.               LOCAL                                                             
  721.               FORCE                                                             
  722.               DEBUG                                                             
  723.               TEST                                                              
  724.                                                                                 
  725.    Required:  none                                                              
  726.                                                                                 
  727. )O Operands -                                                                   
  728.                                                                                 
  729. ))LOCAL                                                                         
  730.                                                                                 
  731.               Specify LOCAL if you want to enter GOPHER in "serverless"         
  732.               mode - i.e. start up with your private GOPHER menu.               
  733.               Specifying LOCAL accomplishes two things:                         
  734.                                                                                 
  735.                (1) It sets the server to "-", meaning local access.             
  736.                    Therefore, you must also provide a path via a                
  737.                    "localmenu:" spec in your GOPHERRC file.                     
  738.                                                                                 
  739.                (2) It allows you to use GOPHER even if there are                
  740.                    other TCP/IP socket applications active elsewhere            
  741.                    in your TSO session.  However, it will not allow             
  742.                    you to connect to any GOPHER servers, even if you            
  743.                    have a local menu item that points to one.                   
  744.                                                                                 
  745.               For information on how to set up GOPHER menus, get into           
  746.               GOPHER and select "About This Gopher".                            
  747.                                                                                 
  748. ))FORCE                                                                         
  749.                                                                                 
  750.               GOPHER tries to determine if there is a TCP/IP socket             
  751.               application active elsewhere in your TSO environment              
  752.               before starting up, to prevent TCP/IP errors.  If it              
  753.               tells you that there is another client active but in              
  754.               truth there is none and you know it, you can use the              
  755.               FORCE keyword to make GOPHER proceed whether it finds             
  756.               this to be the case or not.                                       
  757.                                                                                 
  758.               Using the LOCAL operand is one way to avoid this entire           
  759.               scenario.  However, that won't allow you to access any            
  760.               Gopher servers on the network.                                    
  761.                                                                                 
  762. ))DEBUG                                                                         
  763.                                                                                 
  764.               Set debugging mode on.  You must preallocate a file to            
  765.               ddname GGDEBUG for this to work.  This can be allocated           
  766.               to the terminal or a log file.  When debug mode is on,            
  767.               messages describing memory allocation and deallocation            
  768.               and GOPHER queries sent are dumped to the debug file.             
  769.                                                                                 
  770. ))TEST                                                                          
  771.                                                                                 
  772.               Activate C/370 interactive test (INSPECT).  GOPHER must           
  773.               have been compiled with the TEST option for this to be            
  774.               effective.  Note that you can also issue the TEST command         
  775.               inside GOPHER to get to INSPECT, again provided that              
  776.               GOPHER was compiled with the TEST option.                         
  777.                                                                                 
  778. ./   ADD NAME=INSTALLC,SSI=01050029                                             
  779.                                                                                 
  780.  Directions for Installing the GOPHER MVS Client                                
  781.                                                                                 
  782.  Assuming the PDS's have been created:                                          
  783.                                                                                 
  784.  1. Customize the ALLOAD and COMPILEC JCL members to reflect your               
  785.  local conventions.  Note:  If you intend to place the executable into          
  786.  an existing library, you can suppress that part of the ALLOAD JCL.             
  787.  The name of the data set created must match across both members.               
  788.                                                                                 
  789.  2. Customize the GGUSER header file as shown by the comments therein.          
  790.  Note in particular the defines for your TCP/IP and your C compiler.            
  791.  There are changes to the linkedit JCL that are related to these.               
  792.                                                                                 
  793.  3.  Customize the GOPHER exec to define the names of the MVS libraries         
  794.  to contain the panel and load library members.  The load library must          
  795.  be the one specified in the ALLOAD JCL, if you are creating it anew.           
  796.  Observe the comments relating to the use of LIBDEF and ISPF APPLIDs.           
  797.                                                                                 
  798.  It is in the GOPHER exec that you will also customize the name of the          
  799.  default Gopher server.  Note that the user's GOPHERRC file gets built          
  800.  from the contents of this exec.                                                
  801.                                                                                 
  802.  Note that if you install one of the REXX execs, you must also install          
  803.  the NNMFIUCV exec in the same library.  This exec implements a rude            
  804.  check for an existing TCP/IP socket application (e.g. another GOPHER)          
  805.  in a different PIE MultiTSO session.  It prevents your users from              
  806.  crashing TCP/IP, so it is highly recommended that you make use of it.          
  807.                                                                                 
  808.  4. If you are running ISPF Version 2 or earlier, edit the GOPHER panels        
  809.  whose names begin "GGMP...".  These are popups, and will not work              
  810.  under ISPF Version 2 unless you change the )BODY line.  Remove the             
  811.  WINDOW(...) parameter from the )BODY line of each panel so that the            
  812.  line just says )BODY or )BODY EXPAND(``), as the case may be.                  
  813.                                                                                 
  814.  Now, to install:                                                               
  815.                                                                                 
  816.  5. Submit the ALLOAD JCL to allocate the load library from which the           
  817.  executable program will be run.  If you intend to place the executable         
  818.  into an existing library, you can skip this step, but you should make          
  819.  sure that there is no previous load module named GGCLIENT in the load          
  820.  library of your choice before you proceed.                                     
  821.                                                                                 
  822.  6. Submit the COMPILEC JCL to compile all the C sources and create             
  823.  the executable Gopher load module.                                             
  824.                                                                                 
  825.  The first time you run this you can expect a return code of 8 from             
  826.  the linkedit.  Like SMP/E, this is OK if the only reason is an IEW0342         
  827.  because the "INCLUDE SYSLMOD(GGCLIENT)" did not find an existing load          
  828.  module.  If you get IEW0132 (unresolved external reference) or                 
  829.  IEW0241 (ESD type definition conflict), your linkedit went awry.               
  830.  Don't use the resultant load module.  Check the libraries you                  
  831.  specified on the link step to see what went wrong.                             
  832.                                                                                 
  833.  In the future, if you have to recompile individual modules, you can use        
  834.  the same JCL to compile only those modules, and the link will include          
  835.  the new modules in the existing executable load module.                        
  836.                                                                                 
  837.  Note:  If you have defined C370V1 in the GGUSER header file, you must          
  838.  also include the system linklist load library or libraries containing          
  839.  ISPLINK, ISPEXEC and IKJEFF18 when linking.  Otherwise you may delete          
  840.  the lines from the linkedit JCL that reference them.                           
  841.                                                                                 
  842.  Note:  You need not include the PASCAL libraries or the AMPZMVSB               
  843.  module if you are using TCP/IP Version 2 or higher, in which case              
  844.  you must also define TCPIPV2 in the GGUSER headerfile.                         
  845.                                                                                 
  846.  7. Copy all the members of the panel PDS into the ISPF panel library           
  847.  specified in the GOPHER exec.                                                  
  848.                                                                                 
  849.  8. Copy one of the help members (HELP or HELQ) from the CNTL PDS into          
  850.  your local TSO HELP library under the name GOPHER.  You may also               
  851.  create an additional HELP member called GOPHLOC containing                     
  852.  information local to your site, if you wish.                                   
  853.                                                                                 
  854.  Which CNTL member should you use?  If you don't have XPROC, use HELQ.          
  855.  If you do have XPROC, use HELP.  You will have to modify your GOPHER           
  856.  clist either way.  If you don't have XPROC, you should get it,                 
  857.  because you can specify more options on Gopher if you do.  You can             
  858.  get XPROC via USC's "MVS network server" code distribution service.            
  859.  For more information about this, send an email message to                      
  860.  SERVICE@MVSA.USC.EDU - or SERVICE@USCMVSA, which will normally give            
  861.  better results if you have a BITNET (NJE) return address.                      
  862.                                                                                 
  863.  9. Create the "About This Gopher" PDS from the ABOUT PDS.  This has            
  864.  all the text users should see when they select the "About This Gopher"         
  865.  item from the MVS client.  It also contains all the documentation you          
  866.  need about setting up the client and the server, as well as creating           
  867.  menus and REXX execs for use with MVS Gopher.  You may have already            
  868.  done this as part of the server install, but it should also be                 
  869.  available from the client in "local" (serverless) mode, so that is             
  870.  why I mention it here.                                                         
  871.                                                                                 
  872. --------------------------------------------------------------------            
  873.                                                                                 
  874.  Note:  Make sure that the C/370 run time library is available,                 
  875.  either in the system link list or in the ISPLLIB concatenation,                
  876.  before attempting to run GOPHER.                                               
  877.                                                                                 
  878.  If the C/370 runtime library is not in the link list or otherwise              
  879.  available to ISPF at execution time, you may arrange for it to be              
  880.  allocated via LIBDEF in the GOPHER exec (I haven't tried this).                
  881.                                                                                 
  882. ./   ADD NAME=INSTALLS,SSI=01030048                                             
  883.                                                                                 
  884.  Directions for Installing the GOPHER MVS Server                                
  885.                                                                                 
  886.  Assuming the PDS's have been created:                                          
  887.                                                                                 
  888.  1. Customize the ALLOAD and COMPILES JCL members to reflect your               
  889.  local conventions.  Note:  If you intend to place the executable into          
  890.  an existing library, you can suppress that part of the ALLOAD JCL.             
  891.  The name of the data set created must match across both members.               
  892.                                                                                 
  893.  2. Customize the GGUSER header file as shown by the comments therein.          
  894.  Note in particular the defines for your TCP/IP and your C compiler.            
  895.  There are changes to the linkedit JCL that are related to these.               
  896.                                                                                 
  897.  Now, to install:                                                               
  898.                                                                                 
  899.  3. Submit the ALLOAD JCL to allocate the load library from which the           
  900.  executable program will be run.  If you intend to place the executable         
  901.  into an existing library, you can skip this step, but you should make          
  902.  sure that there is no previous load module named GGSERVER or GGSTASK           
  903.  in the load library of your choice before you proceed.                         
  904.                                                                                 
  905.  4. Submit the COMPILES JCL to compile all the C sources and create             
  906.  the executable Gopher load modules.                                            
  907.                                                                                 
  908.  The first time you run this you can expect return codes of 8 from              
  909.  the linkedit.  Like SMP/E, this is OK if the only reason is an IEW0342         
  910.  because the "INCLUDE SYSLMOD(...)" did not find an existing load               
  911.  module.  If you get IEW0132 (unresolved external reference) or                 
  912.  IEW0241 (ESD type definition conflict), your linkedit went awry.               
  913.  Don't use the resultant load module.  Check the libraries you                  
  914.  specified on the link step to see what went wrong.                             
  915.                                                                                 
  916.  In the future, if you have to recompile individual modules, you can use        
  917.  the same JCL to compile only those modules, and the link will include          
  918.  the new modules in the existing executable load module.                        
  919.                                                                                 
  920.  Note:  You need not include the PASCAL libraries or the AMPZMVSB               
  921.  module if you are using TCP/IP Version 2 or higher, in which case              
  922.  you must also define TCPIPV2 in the GGUSER headerfile.                         
  923.                                                                                 
  924.  5. Create the "About This Gopher" PDS from the ABOUT PDS.  This has            
  925.  all the text users should see when they select the "About This Gopher"         
  926.  item from the MVS client.  It also contains all the documentation you          
  927.  need about setting up the client and the server, as well as creating           
  928.  menus and REXX execs for use with MVS Gopher.  You may have already            
  929.  done this as part of the client install.                                       
  930.                                                                                 
  931.  6. Create your Gopher access file.  See the instructions in the                
  932.  "About This Gopher" PDS for the format.                                        
  933.                                                                                 
  934.  7. Create the MVS Gopher started task JCL from either of the samples           
  935.  given in GOPHERD and GOPHERT.  The GOPHERT is recommended so that you          
  936.  can use REXX execs that issue TSO commands, but you may not want to            
  937.  use this for security reasons.  Either way, customize liberally.               
  938.                                                                                 
  939. --------------------------------------------------------------------            
  940.                                                                                 
  941.  Note:  Make sure that the C/370 run time library is available,                 
  942.  either in the system link list or in the STEPLIB concatenation,                
  943.  before attempting to run GOPHER.                                               
  944.                                                                                 
  945. ./   ADD NAME=MENU,SSI=01010042                                                 
  946. gopher_menu                                                                     
  947.                                                                                 
  948. TYPE=FILE                                                                       
  949. NAME=About This Gopher                                                          
  950. PATH=DD:GGABOUT(ABOUT)                                                          
  951. HOST=+                                                                          
  952. END                                                                             
  953.                                                                                 
  954. TYPE=DIRECTORY                                                                  
  955. NAME=Library/Information Services                                               
  956. PATH=SYS0008.GOPHER.LIBRARY(LIBRS)                                              
  957. HOST=MVS.UDEL.EDU                                                               
  958. END                                                                             
  959.                                                                                 
  960. TYPE=TELNET                                                                     
  961. NAME=UDINFO - University of Delaware Information                                
  962. HOST=UDINFO.UDEL.EDU                                                            
  963. END                                                                             
  964.                                                                                 
  965. TYPE=DIRECTORY                                                                  
  966. NAME=Network and System Services Computer Systems                               
  967. PATH=SYS0008.GOPHER.DIR(UDTELNET)                                               
  968. HOST=MVS.UDEL.EDU                                                               
  969. END                                                                             
  970.                                                                                 
  971. TYPE=DIRECTORY                                                                  
  972. NAME=Weather Across the Country                                                 
  973. PATH=1/Weather                                                                  
  974. HOST=mermaid.micro.umn.edu                                                      
  975. PORT=150                                                                        
  976. END                                                                             
  977.                                                                                 
  978. TYPE=DIRECTORY                                                                  
  979. NAME=Other Gopher and Information Servers                                       
  980. PATH=1/Other Gopher and Information Servers                                     
  981. HOST=gopher.micro.umn.edu                                                       
  982. END                                                                             
  983.                                                                                 
  984. TYPE=DIRECTORY                                                                  
  985. NAME=How to use BITNET LISTSERV Servers                                         
  986. PATH=SYS0008.GOPHER.DIR(LISTSERV)                                               
  987. HOST=MVS.UDEL.EDU                                                               
  988. END                                                                             
  989.                                                                                 
  990. TYPE=DIRECTORY                                                                  
  991. NAME=University of Delaware Newspapers                                          
  992. PATH=SYS0008.GOPHER.DIR(PAPERS)                                                 
  993. HOST=MVS.UDEL.EDU                                                               
  994. END                                                                             
  995.                                                                                 
  996. /*                                                                              
  997. ./ ENDUP                                                                        
  998. ?!                                                                              
  999. //ABOUT    EXEC GGLOAD,TRK1='5',TO='ABOUT'                                      
  1000. //SYSIN    DD DATA,DLM='?!'                                                     
  1001. ./   ADD NAME=ABOUT,SSI=01040045                                                
  1002. gopher_menu                                                                     
  1003.                                                                                 
  1004. TYPE=FILE                                                                       
  1005. NAME=What Is Gopher?                                                            
  1006. PATH=(ABOUTW)                                                                   
  1007. HOST=+                                                                          
  1008. END                                                                             
  1009.                                                                                 
  1010. TYPE=FILE                                                                       
  1011. NAME=Gopher FAQ (Frequently Asked Questions) List                               
  1012. PATH=(FAQ)                                                                      
  1013. HOST=+                                                                          
  1014. END                                                                             
  1015.                                                                                 
  1016. TYPE=DIRECTORY                                                                  
  1017. NAME=Using The Gopher MVS Client                                                
  1018. PATH=(ABOUTC)                                                                   
  1019. HOST=+                                                                          
  1020. END                                                                             
  1021.                                                                                 
  1022. TYPE=DIRECTORY                                                                  
  1023. NAME=Administering the Gopher MVS Server                                        
  1024. PATH=(ABOUTS)                                                                   
  1025. HOST=+                                                                          
  1026. END                                                                             
  1027.                                                                                 
  1028.                                                                                 
  1029. ./   ADD NAME=ABOUTC,SSI=01030000                                               
  1030. gopher_menu                                                                     
  1031.                                                                                 
  1032. TYPE=FILE                                                                       
  1033. NAME=Overview - Using Gopher on MVS                                             
  1034. PATH=(ABOUTCO)                                                                  
  1035. HOST=+                                                                          
  1036. END                                                                             
  1037.                                                                                 
  1038. TYPE=FILE                                                                       
  1039. NAME=Directory Mode - Viewing a Gopher Directory                                
  1040. PATH=(ABOUTCD)                                                                  
  1041. HOST=+                                                                          
  1042. END                                                                             
  1043.                                                                                 
  1044. TYPE=FILE                                                                       
  1045. NAME=File Mode - Browsing a Gopher File                                         
  1046. PATH=(ABOUTCF)                                                                  
  1047. HOST=+                                                                          
  1048. END                                                                             
  1049.                                                                                 
  1050. TYPE=FILE                                                                       
  1051. NAME=Query Mode - Executing a Gopher Query                                      
  1052. PATH=(ABOUTCQ)                                                                  
  1053. HOST=+                                                                          
  1054. END                                                                             
  1055.                                                                                 
  1056. TYPE=FILE                                                                       
  1057. NAME=Extracting Gopher Text                                                     
  1058. PATH=(ABOUTCX)                                                                  
  1059. HOST=+                                                                          
  1060. END                                                                             
  1061.                                                                                 
  1062. TYPE=DIRECTORY                                                                  
  1063. NAME=Customizing Your Gopher Startup                                            
  1064. PATH=(ABOUTCS)                                                                  
  1065. HOST=+                                                                          
  1066. END                                                                             
  1067.                                                                                 
  1068.                                                                                 
  1069. ./   ADD NAME=ABOUTCD,SSI=01000031                                              
  1070. This text has not been written yet.                                             
  1071. ./   ADD NAME=ABOUTCF,SSI=01000042                                              
  1072. This text has not been written yet.                                             
  1073. ./   ADD NAME=ABOUTCO,SSI=01000013                                              
  1074. The following is modified from Allan Tuchman's XGOPHER help.                    
  1075.                                                                                 
  1076. Gopher on MVS is an ISPF dialog interface to the Gopher                         
  1077. information delivery system from the University of Minnesota.                   
  1078.                                                                                 
  1079. The initial panel asks you to specify the name of the Gopher server             
  1080. host.  Normally you leave the other input fields alone.                         
  1081.                                                                                 
  1082. You may also specify a hostname of "-", which means that you want               
  1083. to use your own private Gopher data without going through a server.             
  1084. When you do this, you must provide the path name to your private                
  1085. top-level menu (data set name, FULLY QUALIFIED, WITHOUT QUOTES).                
  1086.                                                                                 
  1087. Assuming that the top-level path points to a valid Gopher menu,                 
  1088. the initial display will show the top level directory of                        
  1089. gopher information available.  Selecting an item from this                      
  1090. list will fetch the contents of a file, subdirectory, or                        
  1091. other information.  The directory display may be updated to                     
  1092. show the new subdirectory.                                                      
  1093.                                                                                 
  1094. To select an item, type "S" in front of it and press ENTER.                     
  1095. This puts you into ISPF BROWSE mode on the text of the item.                    
  1096. You may also type "Q" in front of an item to see it in text format              
  1097. even if it is a directory.  If you have retrieved an item, you may              
  1098. type "E" in front of it to extract it into a file - but you may                 
  1099. do this more easily via the EXTract command from within BROWSE.                 
  1100.                                                                                 
  1101. Some gopher file types are not supported by the current client.                 
  1102. These will not appear on your menus.  Furthermore, you may not                  
  1103. be permitted to access some items, depending upon the server                    
  1104. and the host from which you are trying to access them.  These                   
  1105. restrictions do not apply to local mode, where you can access                   
  1106. anything that you have local permission to read.                                
  1107.                                                                                 
  1108. The Gopher MVS client is written by Steve Bacher at Draper Laboratory           
  1109. (copyright 1992).                                                               
  1110.                                                                                 
  1111. ./   ADD NAME=ABOUTCQ,SSI=01000047                                              
  1112. This text has not been written yet.                                             
  1113. ./   ADD NAME=ABOUTCS,SSI=01030002                                              
  1114. gopher_menu                                                                     
  1115.                                                                                 
  1116. Type=FILE                                                                       
  1117. Name=Customizing Your Gopher Startup                                            
  1118. Path=(ABOUTCSC)                                                                 
  1119. Host=+                                                                          
  1120. End                                                                             
  1121.                                                                                 
  1122. Type=FILE                                                                       
  1123. Name=What Happens When You Start Up Gopher                                      
  1124. Path=(ABOUTCSW)                                                                 
  1125. Host=+                                                                          
  1126. End                                                                             
  1127.                                                                                 
  1128. Type=FILE                                                                       
  1129. Name=Requesting Local (Serverless) Access                                       
  1130. Path=(ABOUTCSL)                                                                 
  1131. Host=+                                                                          
  1132. End                                                                             
  1133.                                                                                 
  1134. Type=FILE                                                                       
  1135. Name=The GOPHERRC File                                                          
  1136. Path=(ABOUTCSR)                                                                 
  1137. Host=+                                                                          
  1138. End                                                                             
  1139.                                                                                 
  1140. Type=FILE                                                                       
  1141. Name=Defining GOPHER Menus                                                      
  1142. Path=(ABOUTCSM)                                                                 
  1143. Host=+                                                                          
  1144. End                                                                             
  1145.                                                                                 
  1146. Type=FILE                                                                       
  1147. Name=REXX Exec Interface                                                        
  1148. Path=(ABOUTCSX)                                                                 
  1149. Host=+                                                                          
  1150. End                                                                             
  1151.                                                                                 
  1152. ./   ADD NAME=ABOUTCSC,SSI=01010046                                             
  1153.                                                                                 
  1154. =======================================================================         
  1155.                                                                                 
  1156.  Customizing Your Gopher Startup                                                
  1157.                                                                                 
  1158. =======================================================================         
  1159.                                                                                 
  1160.  When you use the GOPHER client, information about your use of GOPHER           
  1161.  is stored in a data set called GOPHERRC.  If you don't have one,               
  1162.  GOPHER will create it for you.                                                 
  1163.                                                                                 
  1164.  Your default startup menu will contain a single item pointing to a             
  1165.  GOPHER server on MVS, whether such a server is available or not.               
  1166.  However, you can ask GOPHER to display a different startup menu for            
  1167.  you.  This startup menu may have entries for the GOPHER server                 
  1168.  on MVS and one for your own private (local) data, which is accessed            
  1169.  without querying a server.                                                     
  1170.                                                                                 
  1171.  To get GOPHER to set up a different startup menu, you must edit the            
  1172.  GOPHERRC file.  Note that you may set up the GOPHER startup menu to            
  1173.  include a pointer to your local data - but you have to create that             
  1174.  local data in order to use it.                                                 
  1175.                                                                                 
  1176.  Editing the GOPHERRC file should be easy.  Just follow the                     
  1177.  instructions in the comments of the file itself.  For information              
  1178.  about the contents of GOPHERRC, see the HELP for operand GOPHERRC.             
  1179.                                                                                 
  1180. ./   ADD NAME=ABOUTCSL,SSI=01000056                                             
  1181.                                                                                 
  1182. =======================================================================         
  1183.                                                                                 
  1184.  Requesting Local (Serverless) Access                                           
  1185.                                                                                 
  1186. =======================================================================         
  1187.                                                                                 
  1188.  The LOCAL operand on the GOPHER command is a convenient way of                 
  1189.  requesting "local" serverless mode.  Specify LOCAL on the GOPHER               
  1190.  command if you want to enter GOPHER in "serverless" mode - i.e.                
  1191.  start up with your private GOPHER menu.  Specifying LOCAL                      
  1192.  accomplishes two things:                                                       
  1193.                                                                                 
  1194.   (1) It sets the server to "-", meaning local access.  Therefore, you          
  1195.       must also provide a path, either via the PATH operand on the              
  1196.       GOPHER command or via a "localmenu:" spec in your GOPHERRC file,          
  1197.       so that GOPHER knows where to look for your private data.  The            
  1198.       path is a data set name, FULLY QUALIFIED WITHOUT QUOTES.                  
  1199.                                                                                 
  1200.   (2) It allows you to use GOPHER even if there are other TCP/IP socket         
  1201.       applications active elsewhere in your TSO session.  However, it           
  1202.       will not allow you to connect to any GOPHER servers, even if you          
  1203.       have a local menu item that points to one.                                
  1204.                                                                                 
  1205.  If you do not specify a server and there is no specification in                
  1206.  your GOPHERRC file for one, then GOPHER will display a startup                 
  1207.  ISPF panel asking you to specify a server name and, optionally,                
  1208.  a path name.  (Don't touch the port number!)                                   
  1209. ./   ADD NAME=ABOUTCSM,SSI=01030019                                             
  1210.                                                                                 
  1211. =======================================================================         
  1212.                                                                                 
  1213.  Defining Gopher Menus                                                          
  1214.                                                                                 
  1215. =======================================================================         
  1216.                                                                                 
  1217.  This is a description of how to define GOPHER menus that can be used           
  1218.  either for your own private data or by the GOPHER server administrator         
  1219.  on MVS to define publicly accessible data.                                     
  1220.                                                                                 
  1221.  Bear in mind that the menu may be used to specify data meaningful to           
  1222.  a server other than MVS.  Therefore, the descriptions here should be           
  1223.  interpreted in two ways:                                                       
  1224.                                                                                 
  1225.  (1) how to define MVS-resident information resources                           
  1226.                                                                                 
  1227.  (2) how to request information resources from other GOPHER servers             
  1228.                                                                                 
  1229. ------------------------------------------------------------------------        
  1230.                                                                                 
  1231.  How To Define MVS-Resident Information Resources                               
  1232.                                                                                 
  1233.  The Gopher server (and the Gopher client, in "local" mode) determines          
  1234.  how to return information to the client via menus.  These menus are            
  1235.  plain MVS data sets with a particular structure.                               
  1236.                                                                                 
  1237.  An MVS gopher menu is a sequential data set or PDS member with the             
  1238.  following format:                                                              
  1239.                                                                                 
  1240.  * the first line contains the string GOPHER_MENU                               
  1241.    (in upper, lower or mixed case)                                              
  1242.                                                                                 
  1243.  * the rest of the file contains blocks of information like this:               
  1244.                                                                                 
  1245.    TYPE=type                                                                    
  1246.    NAME=name                                                                    
  1247.    PATH=path                                                                    
  1248.    HOST=host                                                                    
  1249.    PORT=port                                                                    
  1250.    END                                                                          
  1251.                                                                                 
  1252.    For compatibility with earlier versions of the MVS Gopher server,            
  1253.    the following are also accepted:                                             
  1254.                                                                                 
  1255.    DISPLAY=      is equivalent to NAME=                                         
  1256.    SELECTOR=     is equivalent to PATH=                                         
  1257.                                                                                 
  1258.    Explanations                                                                 
  1259.                                                                                 
  1260.    TYPE=type                                                                    
  1261.                                                                                 
  1262.    The type of Gopher entity (FILE, DIRECTORY, INDEX, etc.).                    
  1263.    In other words, one of the following:                                        
  1264.                                                                                 
  1265.    FILE      - the item is an MVS data set with text to be displayed.           
  1266.                The path name is the file name or a REXX exec spec.              
  1267.    DIRECTORY - the item is another Gopher directory.                            
  1268.                The path name is the file name or a REXX exec spec.              
  1269.    INDEX     - the item is a full text search item, which means that            
  1270.                the client will query the user for a search string               
  1271.                which will be passed to the server along with the                
  1272.                pathname.  For the MVS server.  it only makes sense for          
  1273.                the pathname to be a REXX exec specification.  The path          
  1274.                and the user's string are given to the host, which               
  1275.                returns a menu of selections.  See also WHOIS.                   
  1276.    TELNET    - the item is a Telnet server.                                     
  1277.                The path name is ignored.  The port number should be             
  1278.                omitted or set to 0, unless an alternate TELNET port             
  1279.                is required by the server referenced by HOST.                    
  1280.    WHOIS     - the item is a "whois" query.  This is similar to the             
  1281.                INDEX type, except that the server returns a file                
  1282.                rather than a menu.  This is not (yet) an official               
  1283.                part of the Gopher protocol, though it does appear in            
  1284.                certain (patched) versions of other implementations.             
  1285.                                                                                 
  1286.    NAME=name                                                                    
  1287.                                                                                 
  1288.    The descriptive string that will appear in the Gopher client's               
  1289.    display of menu selections for this item.  Make this as human as             
  1290.    possible.  Case is preserved.                                                
  1291.                                                                                 
  1292.    PATH=path                                                                    
  1293.                                                                                 
  1294.    The pathname to be passed to the Gopher server to retrieve the               
  1295.    item.  See below for a fuller description.                                   
  1296.                                                                                 
  1297.    HOST=host                                                                    
  1298.                                                                                 
  1299.    The name of the Gopher server host that will process the request.            
  1300.    See below for a fuller description.                                          
  1301.                                                                                 
  1302.    PORT=port                                                                    
  1303.                                                                                 
  1304.    The TCP/IP port to connect to.  For Gopher, this should always be            
  1305.    port 70 (except for a TELNET type, whose port defaults to the                
  1306.    standard TELNET port if zero or omitted).  If this is omitted, then          
  1307.    the default port number is taken.                                            
  1308.                                                                                 
  1309.    END                                                                          
  1310.                                                                                 
  1311.    Required to keep menu entries separate.                                      
  1312.                                                                                 
  1313.  Comment lines may be freely included, starting with '#' in                     
  1314.  the first column of data.                                                      
  1315.                                                                                 
  1316. More about Path Names                                                           
  1317.                                                                                 
  1318.  Note that the format of a path depends on which Gopher server is               
  1319.  going to be processing the entry, as defined by the HOST= field.               
  1320.  If the entry is going to a different Gopher server, then the                   
  1321.  pathname format depends on that server.  For example, a Unix server            
  1322.  would expect a Unix file name with a slash.                                    
  1323.                                                                                 
  1324.  A path name for the MVS Gopher may be one of the following:                    
  1325.                                                                                 
  1326.  * A fully qualified MVS data set name, without quotes, identifying             
  1327.    a sequential text data set or PDS member.  If TYPE=FILE, this is             
  1328.    text.  If TYPE=DIRECTORY, this is a gopher menu as described above.          
  1329.                                                                                 
  1330.  * A fully qualified MVS data set name, without quotes, identifying a           
  1331.    PDS (no member).  This causes the MVS Gopher server to return a              
  1332.    list of member names of the PDS in Gopher directory format.  This            
  1333.    is valid only with TYPE=DIRECTORY.  Member aliases are included in           
  1334.    the resulting list.                                                          
  1335.                                                                                 
  1336.  * A member name enclosed in parentheses.  This is treated as                   
  1337.    a full PDS member.  In other words, the MVS Gopher server will use           
  1338.    the name of the PDS in which the menu itself was found.                      
  1339.    This allows you to move PDS's full of Gopher menus around without            
  1340.    having to worry about changing all the path names.  This happens             
  1341.    only when the menu itself is a PDS member and the host is the                
  1342.    same as the local host (MVS for the server, - for local mode).               
  1343.    Specifying HOST=+ is recommended for this.                                   
  1344.                                                                                 
  1345.  * A string "DD:ddname" or "DD:ddname(member)", identifying a file by           
  1346.    MVS ddname a la C/370.  Valid with either TYPE=FILE or                       
  1347.    TYPE=DIRECTORY, so the ddname can point to text or a menu.                   
  1348.    However, if the ddname happens to be allocated to a PDS, it does             
  1349.    NOT work like a directory above - it's just illegal and will                 
  1350.    probably cause lossage.                                                      
  1351.                                                                                 
  1352.    Each member is treated as a Gopher FILE.  The NAME field is                  
  1353.    set to the member name.  If you want to do anything fancier                  
  1354.    than this, you will have to construct your own Gopher menu.                  
  1355.                                                                                 
  1356.  * A string "EXEC:execname args", which specifies the name of a                 
  1357.    REXX exec to be executed to return the data.  Valid with any                 
  1358.    and all types.  To learn more about how to make use of this                  
  1359.    feature, please go back to the "About This Gopher" tree and                  
  1360.    read up on using REXX execs with MVS Gopher.                                 
  1361.                                                                                 
  1362.    If you are using your own private GOPHER data via local access               
  1363.    and you want to run REXX execs, you must have a "localexec:"                 
  1364.    line in your GOPHERRC file identifying your REXX exec library.               
  1365.                                                                                 
  1366. More About Host Names                                                           
  1367.                                                                                 
  1368.  You may find that some Gopher servers insist on appending the                  
  1369.  network's domain name to local server hostnames.  You should check             
  1370.  with your network gurus to make sure that this will work with your             
  1371.  TCP/IP host lookup.  The MVS server will accept hostnames either               
  1372.  with or without the domain name appended - this applies to the                 
  1373.  specification of hostnames in the Gopher access table as well -                
  1374.  but other Gopher servers may not.                                              
  1375.                                                                                 
  1376. Two special cases:                                                              
  1377.                                                                                 
  1378.  A plus sign (HOST=+) means that the host is the same host as the one           
  1379.  that is looking at the directory entry - i.e. the server that is               
  1380.  serving up this menu.  The Gopher server simply plugs in its own host          
  1381.  name at that point.  This is NOT part of the Gopher protocol, but              
  1382.  merely a server hack.                                                          
  1383.                                                                                 
  1384.  A minus sign (HOST=-) means that access to this item will be in                
  1385.  "local" (serverless) mode.  This is recognized only by the MVS Gopher          
  1386.  client.  It means that the client will do the retrieval itself,                
  1387.  without asking a server to do it.                                              
  1388.                                                                                 
  1389.  The directory-processing code, when invoked in "local mode", will              
  1390.  treat HOST=+ as HOST=- since the current host is the local mode                
  1391.  operation in that case.  Therefore, using HOST=+ is recommended                
  1392.  so that one can port one's local GOPHER menus to the public server             
  1393.  at some point.                                                                 
  1394.                                                                                 
  1395.  A REXX exec that generates menus dynamically can use - as a hostname,          
  1396.  but not +.                                                                     
  1397.                                                                                 
  1398. ------------------------------------------------------------------------        
  1399.                                                                                 
  1400.  How To Request Information Resources From Other GOPHER Servers                 
  1401.                                                                                 
  1402. Rather than describe the standard format of a Gopher menu here,                 
  1403. I recommend that you go to your nearest Unix box and type                       
  1404.                                                                                 
  1405.   man gopherd                                                                   
  1406.                                                                                 
  1407. That should tell you all you need to know about Unix gopher servers.            
  1408. If your gopher server is on some other kind of machine, then go find            
  1409. the documentation for that machine's Gopher menus.                              
  1410.                                                                                 
  1411. The purpose of the above exercise is primarily to determine the format          
  1412. of a path name understood by a given Gopher server.  Once you know that,        
  1413. you can build a Gopher menu the MVS Gopher will understand, according to        
  1414. the format described in the top section.  Set the host to point to              
  1415. the other Gopher server, who will interpret the other items in the menu.        
  1416.                                                                                 
  1417. ------------------------------------------------------------------------        
  1418.                                                                                 
  1419. Dynamic Generation of GOPHER Menus                                              
  1420.                                                                                 
  1421.  If you want to be able to generate a Gopher menu dynamically,                  
  1422.  you can do this via the REXX interface.  You also must understand              
  1423.  the Gopher protocol.  A Gopher menu is really a text representation            
  1424.  of the actual protocol, which goes like this:                                  
  1425.                                                                                 
  1426.  filetype -tab- name -tab- path -tab- host -tab- port                           
  1427.                                                                                 
  1428.  where -tab- is the EBCDIC (on MVS) or ASCII (on other box) tab                 
  1429.  character, and filetype is a single character.  The filetypes                  
  1430.  supported by the MVS Gopher server are:                                        
  1431.                                                                                 
  1432.  0 - flat file                                                                  
  1433.  1 - directory                                                                  
  1434.  2 - error                                                                      
  1435.  7 - index                                                                      
  1436.  8 - TELNET                                                                     
  1437.  w - whois (experimental)                                                       
  1438.                                                                                 
  1439.  A REXX exec that wants to generate a Gopher menu must output lines             
  1440.  in this format.  For more information, go back to the Gopher tree              
  1441.  for "About This Gopher" and look up information on the REXX interface.         
  1442.                                                                                 
  1443. ./   ADD NAME=ABOUTCSR,SSI=01010039                                             
  1444.                                                                                 
  1445. =======================================================================         
  1446.                                                                                 
  1447.  The GOPHERRC File                                                              
  1448.                                                                                 
  1449. =======================================================================         
  1450.                                                                                 
  1451.  When you use the GOPHER client, you need a file called GOPHERRC                
  1452.  which stores information about your use of GOPHER.  If you don't               
  1453.  have one, GOPHER will create it for you.  The file initially                   
  1454.  contains:                                                                      
  1455.                                                                                 
  1456.     the initial path/name/host/port specification, which tells                  
  1457.     GOPHER what to display on startup.  By default this is the                  
  1458.     standard GOPHER server info on MVS.  However, you can add                   
  1459.     to your GOPHERRC a specification for local GOPHER by                        
  1460.     editing GOPHERRC and activating one of the following:                       
  1461.                                                                                 
  1462.     - the other "initial:" spec which points to your own startup menu,          
  1463.       overriding the one you'd get otherwise                                    
  1464.                                                                                 
  1465.     - the localmenu: and localexec: lines.                                      
  1466.                                                                                 
  1467.     localmenu: is equivalent to specifying an alternate initial:                
  1468.     spec of host=- (dash) and path=localmenu_name.  When you use                
  1469.     the LOCAL operand of the GOPHER command, localmenu: is what                 
  1470.     GOPHER looks for as the pathname if you don't provide one on                
  1471.     the command.                                                                
  1472.                                                                                 
  1473.     localexec: is required if you want to use your own library of               
  1474.     GOPHER rexx execs.  This is valid for LOCAL access only.                    
  1475.                                                                                 
  1476.     Some option defaults are stored in the GOPHERRC file.                       
  1477.     Note that this is not yet implemented.                                      
  1478.                                                                                 
  1479.     The GOPHER client will store bookmarks (as you create them)                 
  1480.     at the end of your GOPHERRC file.  Note that this feature                   
  1481.     is not yet implemented.                                                     
  1482.                                                                                 
  1483.     If you have a newly created GOPHERRC file, you can read the                 
  1484.     comments to guide you in customizing the file.                              
  1485. ./   ADD NAME=ABOUTCSW,SSI=01000034                                             
  1486.                                                                                 
  1487. =======================================================================         
  1488.                                                                                 
  1489.  What Happens When You Start Up GOPHER?                                         
  1490.                                                                                 
  1491. =======================================================================         
  1492.                                                                                 
  1493.  What you see when you start up GOPHER depends on what you have                 
  1494.  specified, either on the command line or in the GOPHERRC file.                 
  1495.  In general, command operands override GOPHERRC specifications.                 
  1496.                                                                                 
  1497.  GOPHER does its thing by connecting to a Gopher server somewhere               
  1498.  on your network.  If you do not specify otherwise, this server is              
  1499.  assumed to be MVS (the host where you are running this client).                
  1500.  The default GOPHERRC file specifies this as the server.                        
  1501.  The startup menu you see is the one defined by the administrator               
  1502.  of that server.                                                                
  1503.                                                                                 
  1504.  You can request a different server or a different startup menu,                
  1505.  either by modifying the GOPHERRC file or by specifying command                 
  1506.  operands.  The SERVER operand tells GOPHER to get a startup menu               
  1507.  from a different server, and the PATH operand tells GOPHER what                
  1508.  startup menu to request (the contents of the path depend on what               
  1509.  server you point to and what it's looking for, but it is typically             
  1510.  the name of a file on that system that contains a Gopher menu).                
  1511.                                                                                 
  1512.  You can also use GOPHER to access your own private data by requesting          
  1513.  "local" (serverless) mode.  A server name of a single dash "-" means           
  1514.  local access.  In this case, you must provide a path name so that              
  1515.  GOPHER knows where to look for your data.  The path name is the name           
  1516.  of a data set containing your GOPHER menu - it must be FULLY QUALIFIED         
  1517.  AND WITHOUT QUOTES.  The path name can be provided either as a command         
  1518.  operand or in the GOPHERRC file.                                               
  1519. ./   ADD NAME=ABOUTCSX,SSI=01020059                                             
  1520. =======================================================================         
  1521.                                                                                 
  1522. REXX Exec Interface                                                             
  1523.                                                                                 
  1524. =======================================================================         
  1525.                                                                                 
  1526. You can request the MVS Gopher server (or the MVS Gopher client, in             
  1527. "local" (serverless) mode) to retrieve information dynamically by               
  1528. executing a REXX exec.  To request this, you define a menu entry                
  1529. with the following PATH= field:                                                 
  1530.                                                                                 
  1531. PATH=EXEC:execname args                                                         
  1532.                                                                                 
  1533. In the case of EXEC:, the REXX exec identified by "execname" is                 
  1534. executed, along with the arguments "args" given.  For example:                  
  1535.                                                                                 
  1536. PATH=EXEC:MYEXEC ANY ARGS                                                       
  1537.                                                                                 
  1538. will cause the MYEXEC exec to be executed with "ANY ARGS" as the                
  1539. single argument string.                                                         
  1540.                                                                                 
  1541. If the TYPE is INDEX, the search string submitted by the user will be           
  1542. appended to the args separated by a blank.  The exec must be able to            
  1543. deal with this.                                                                 
  1544.                                                                                 
  1545. REXX Execs must be in a PDS allocated to DD GGEXEC.  This ddname                
  1546. needs to be allocated in the Gopher server's JCL.  For local mode,              
  1547. the GOPHER command will allocate the GGEXEC file to the REXX exec               
  1548. library specified on the "localexec:" line in your GOPHERRC file,               
  1549. if you have activated it.  Otherwise you will not be able to use                
  1550. REXX execs in local mode.                                                       
  1551.                                                                                 
  1552. Note that you do not need the /* REXX */ comment at the beginning of            
  1553. REXX execs used by gopher (though it does not hurt to include it!)              
  1554. because they are invoked by the IRXEXEC facility and not the standard           
  1555. TSO CLIST/EXEC search.                                                          
  1556.                                                                                 
  1557. Now, how does the REXX exec return data to the Gopher server?                   
  1558.                                                                                 
  1559. First of all, it depends on the TYPE that the exec is expected                  
  1560. to return, which has nothing to do with HOW the returning is done.              
  1561.                                                                                 
  1562. So, first let's talk about how the exec returns data, and then                  
  1563. about what it is expected to return.                                            
  1564.                                                                                 
  1565. How to return data                                                              
  1566.                                                                                 
  1567. The REXX exec must return data by writing it to the SYSTSPRT DD.                
  1568. Note that this is where normal TSO output goes when a REXX exec                 
  1569. is run in TSO batch.  However, since REXX execs are invoked by                  
  1570. the IRXEXEC interface by the Gopher server, to prevent dependency               
  1571. on a TSO environment, this default behavior of REXX/TSO cannot                  
  1572. be relied upon.  Therefore, if you write a REXX exec to return                  
  1573. Gopher data, you must explicitly send the output to the SYSTSPRT                
  1574. ddname.  The Gopher server makes sure that it can read this data.               
  1575.                                                                                 
  1576. A typical approach is to queue all the output to the REXX data stack,           
  1577. queue a final "" and then use EXECIO.  Be careful not to queue null             
  1578. lines in this case.  Be sure to protect the stack in case of lossage.           
  1579. Example:                                                                        
  1580.                                                                                 
  1581.  "NEWSTACK"                                                                     
  1582.  do while more_data_to_get                                                      
  1583.   some_data = get_some_data()                                                   
  1584.   if some_data = "" then queue " "                                              
  1585.   else queue some_data                                                          
  1586.  end                                                                            
  1587.  queue ""                                                                       
  1588.  "EXECIO * DISKW SYSTSPRT (FINIS)"                                              
  1589.  "DELSTACK"                                                                     
  1590.                                                                                 
  1591. You can also create a stem variable to hold the output, if you                  
  1592. want to avoid problems with null lines or nested stacks.  Example:              
  1593.                                                                                 
  1594.  do i = 1 to whatever                                                           
  1595.    foo.i = get_some_data()                                                      
  1596.  end                                                                            
  1597.  foo.0 = i                                                                      
  1598.  "EXECIO * DISKW SYSTSPRT (FINIS STEM FOO.)"                                    
  1599.                                                                                 
  1600. A downside is that if the REXX exec finds anomalous conditions                  
  1601. or executes a TSO command that barfs, standard TSO command output               
  1602. will probably get lost.  Therefore, try to use OUTTRAP to capture               
  1603. command output and test for error codes, and write all captured                 
  1604. output or error messages to SYSTSPRT in such a way as to allow                  
  1605. the client to see them (but not treat them as normal directory                  
  1606. data or whatever).                                                              
  1607.                                                                                 
  1608. A helpful hack is to use an EXECUTE exec to invoke other REXX                   
  1609. code or TSO commands that normally output via PUTLINE.  e.g.:                   
  1610.                                                                                 
  1611. /* REXX. Usage: EXECUTE exec args... */                                         
  1612.                                                                                 
  1613.  parse arg real_exec_command                                                    
  1614.  parse source sourceline                                                        
  1615.  if word(sourceline,7) = "TSO" then do                                          
  1616.   x = outtrap("LINE.")                                                          
  1617.   real_exec_command                                                             
  1618.   arc = rc                                                                      
  1619.   x = outtrap("OFF")                                                            
  1620.   "EXECIO * DISKW SYSTSPRT (FINIS STEM LINE.)"                                  
  1621.  end                                                                            
  1622.  else do                                                                        
  1623.   real_exec_command                                                             
  1624.   arc = rc                                                                      
  1625.  end                                                                            
  1626.                                                                                 
  1627.  return arc                                                                     
  1628.                                                                                 
  1629. I don't recommend this, though, because it's SLOW.                              
  1630.                                                                                 
  1631.                                                                                 
  1632. If the Gopher server is a TSO-in-batch job (i.e. EXEC PGM=IKJEFT01)             
  1633. then you can issue TSO commands from the exec.  To get the output,              
  1634. though, you need to use OUTTRAP around them.  If they issue TPUT's,             
  1635. you are SOL.  If they are PL/1 programs that write to SYSPRINT, or              
  1636. FORTRAN or assembler, etc., allocate the SYSPRINT or FT06F001 or                
  1637. whatever file to a temporary and copy the temporary to SYSTSPRT.  If            
  1638. it is a C/370 program that writes to stdout or stderr, you may be able          
  1639. to use redirection:                                                             
  1640.                                                                                 
  1641.    CALL 'THEIR.LOAD(CPROG)' 'args > DD:SYSTSPRT'                                
  1642.                                                                                 
  1643.  for stdout                                                                     
  1644.                                                                                 
  1645.    CALL 'THEIR.LOAD(CPROG)' 'args 2> DD:SYSTSPRT'                               
  1646.                                                                                 
  1647.  for stderr                                                                     
  1648.                                                                                 
  1649.  (for multiple output, use >> instead of >)                                     
  1650.                                                                                 
  1651.  If gopher server is run straight batch rather than as a TSO job, then          
  1652.  you cannot run REXX execs that require a TSO environment.                      
  1653.                                                                                 
  1654.  One more important word:  Make sure that your SYSTSPRT file has a              
  1655.  large enough LRECL to handle the REXX output.  If it is too short,             
  1656.  the REXX output will get folded.  For TYPE=DIRECTORY in particular,            
  1657.  this is disastrous.  Recommended JCL for executing the Gopher server           
  1658.  may be found elsewhere in the installation materials, or your MVS              
  1659.  system programmer has probably already installed a Gopher server in            
  1660.  'SYS1.PROCLIB' or the equivalent with the correct allocation.                  
  1661.                                                                                 
  1662. What it is expected to return                                                   
  1663.                                                                                 
  1664.  OK - now the good stuff.  This depends on the TYPE on the menu entry           
  1665.  that your exec is trying to fulfill.  Some gopher protocol basics:             
  1666.                                                                                 
  1667.  A Gopher menu is really a text representation of the actual protocol,          
  1668.  which goes like this:                                                          
  1669.                                                                                 
  1670.  filetype -tab- name -tab- path -tab- host -tab- port                           
  1671.                                                                                 
  1672.  where -tab- is the EBCDIC (on MVS) or ASCII (on other box) tab                 
  1673.  character, and filetype is a single character.  The filetypes                  
  1674.  supported by the MVS Gopher server are:                                        
  1675.                                                                                 
  1676.  0 - flat file                                                                  
  1677.  1 - directory                                                                  
  1678.  2 - error                                                                      
  1679.  7 - index                                                                      
  1680.  8 - TELNET                                                                     
  1681.  w - whois (experimental)                                                       
  1682.                                                                                 
  1683.  To generate the equivalent of a Gopher menu, you must output data              
  1684.  in the above format.  Now for the details...                                   
  1685.                                                                                 
  1686. TYPE=FILE                                                                       
  1687.                                                                                 
  1688. Just return the straight data.  Try to avoid null lines because C/370           
  1689. believes they don't exist and will throw them away.  We hate this, but          
  1690. IBM is so hard to convince of reality sometimes...  Change all null             
  1691. lines to lines containing one blank as you write them out (you need to          
  1692. do this anyway if you are queueing output on the stack for EXECIO) and          
  1693. you will have no problems.                                                      
  1694.                                                                                 
  1695. TYPE=DIRECTORY                                                                  
  1696.                                                                                 
  1697. You must return lines that fit the gopher protocol format as above.             
  1698.                                                                                 
  1699. For example, if you want to generate a Gopher menu on the fly that              
  1700. is equivalent to this:                                                          
  1701.                                                                                 
  1702. type=file                                                                       
  1703. name=This is my description                                                     
  1704. path=some.gopher.path                                                           
  1705. host=sun1.sanjuan.com                                                           
  1706. port=70                                                                         
  1707.                                                                                 
  1708. then you output a line that looks like this:                                    
  1709.                                                                                 
  1710.   0This is my description!some.gopher.path!sun1.sanjuan.com!70                  
  1711.                                                                                 
  1712. (each ! is really a tab (EBCDIC hex 05) character)                              
  1713.                                                                                 
  1714. where "0" is the type (file in this example, but would be "1" for               
  1715. type=directory, "7" for typeindex, etc.)                                        
  1716.                                                                                 
  1717. Here's the REXX code that might do this:                                        
  1718.                                                                                 
  1719. name = "This is my description"                                                 
  1720. path = "some.gopher.path"                                                       
  1721. host = "sun1.sanjuan.com"                                                       
  1722. tab  = '05'x                                                                    
  1723. port = 70                                                                       
  1724.                                                                                 
  1725. queue "0"||name||tab||path||tab||host||tab||port                                
  1726.                                                                                 
  1727. Assuming we write the queued lines to DD SYSTSPRT, as described.                
  1728.                                                                                 
  1729. Specifying the Right Host Name                                                  
  1730.                                                                                 
  1731. Most of the time you will probably want to generate a menu item                 
  1732. that points back to your MVS host, not some other host.  It may                 
  1733. even redrive your selfsame REXX exec with new arguments.  And if                
  1734. the exec was invoked in local (serverless) mode, you want the item              
  1735. to get driven in the same mode, probably.                                       
  1736.                                                                                 
  1737. The question is - what's the easiest way to identify what                       
  1738. the "same server" is?  One way is to hardcode the server name (e.g.             
  1739. "MVS.DRAPER.COM"), but this is not sufficiently general because:                
  1740.                                                                                 
  1741. (1) the server name or location may change                                      
  1742. (2) you can't distribute the exec to other Gopher users                         
  1743. (3) it won't work the same way in "local mode"                                  
  1744.                                                                                 
  1745. So, you need a way to know what the name of your selfsame host is.              
  1746. The MVS Gopher server can use HOST=+, but you can't, as that isn't              
  1747. part of the Gopher protocol.  So what do you do?                                
  1748.                                                                                 
  1749. Recommendation:  call a function hostname() to return the current               
  1750. host name.  So in the above code segment, you might have:                       
  1751.                                                                                 
  1752.  host = hostname()                                                              
  1753.                                                                                 
  1754. What is that hostname() function anyway?                                        
  1755. Well, you create it.                                                            
  1756. Take your Gopher exec library (please) and include an exec                      
  1757. called HOSTNAME, which you set up to return the name                            
  1758. of the host that you want to be the "same host".                                
  1759.                                                                                 
  1760. Note that a plus sign "+" will not work in this context.                        
  1761. The plus sign is a hack interpreted by the Gopher server                        
  1762. when it sees it on a menu.  It is *not* part of the Gopher                      
  1763. protocol and therefore cannot be sent over.                                     
  1764.                                                                                 
  1765. However, the minus sign "-" will work, as the Gopher client                     
  1766. in local mode will interpret it at the protocol level                           
  1767. (which DOES NOT IMPLY THAT IT IS A PART OF THE STANDARD                         
  1768. GOPHER PROTOCOL, PROPOSED OR OTHERWISE - THIS IS JUST A                         
  1769. LOCAL HACK MODIFICATION).                                                       
  1770.                                                                                 
  1771. Anyhow, what you ought to do is to have different Gopher                        
  1772. exec libraries for local (i.e.private) use and public                           
  1773. server use.  The public server will have a HOSTNAME member                      
  1774. that says                                                                       
  1775.                                                                                 
  1776.  return "MVS.DRAPER.COM"                                                        
  1777.                                                                                 
  1778. or whatever the name of *YOUR* gopher server host is.                           
  1779.                                                                                 
  1780. Your private exec library should have a HOSTNAME member                         
  1781. that says                                                                       
  1782.                                                                                 
  1783.   return "-"                                                                    
  1784.                                                                                 
  1785. This is the best I can come up with right now.  A future enhancement            
  1786. may be to pass the hostname as the second arg to the REXX exec using            
  1787. the IRXEXEC interface, e.g.                                                     
  1788.                                                                                 
  1789. parse arg execargs, hostname                                                    
  1790.                                                                                 
  1791. Then we could pass even more such arguments, like port, etc.                    
  1792. But that's all for now...                                                       
  1793.                                                                                 
  1794.                                                                                 
  1795. ./   ADD NAME=ABOUTCX,SSI=01000051                                              
  1796. This text has not been written yet.                                             
  1797. ./   ADD NAME=ABOUTS,SSI=01040038                                               
  1798. gopher_menu                                                                     
  1799.                                                                                 
  1800. TYPE=FILE                                                                       
  1801. NAME=Creating MVS Gopher Menus                                                  
  1802. PATH=(ABOUTCSM)                                                                 
  1803. HOST=+                                                                          
  1804. END                                                                             
  1805.                                                                                 
  1806. TYPE=FILE                                                                       
  1807. NAME=MVS Gopher Access Table                                                    
  1808. PATH=(ABOUTSA)                                                                  
  1809. HOST=+                                                                          
  1810. END                                                                             
  1811.                                                                                 
  1812. TYPE=FILE                                                                       
  1813. NAME=REXX Exec Interface                                                        
  1814. PATH=(ABOUTCSX)                                                                 
  1815. HOST=+                                                                          
  1816. END                                                                             
  1817.                                                                                 
  1818. ./   ADD NAME=ABOUTSA,SSI=01020004                                              
  1819.                                                                                 
  1820.   Format of entries in the Gopher Access Table:                                 
  1821.                                                                                 
  1822.   filename (fully qualified, all uppercase, no quotes)                          
  1823.   can be "DD:DDNAME" or "EXEC:EXECNAME"                                         
  1824.                                                                                 
  1825.   followed by names of hosts which are authorized to access the data.           
  1826.   If no host name list is present, all hosts are authorized                     
  1827.                                                                                 
  1828.   You may specify the same file name more than once, if you need                
  1829.   more lines to put host names on.                                              
  1830.                                                                                 
  1831.   Individual PDS members must be specified separately.  A PDS without           
  1832.   a member name establishes access only to the PDS directory.                   
  1833.                                                                                 
  1834.   Note that the default directory MUST be in this table.                        
  1835.                                                                                 
  1836.   Also note that in the case of EXECs, the EXEC must live in the                
  1837.   library allocated to GGEXEC in the Gopher server JCL.                         
  1838.                                                                                 
  1839.   *** ANY DATA SET REFERENCED BY ANY EXEC IN THAT LIBRARY IS FULLY              
  1840.   *** ACCESSIBLE TO GOPHER REGARDLESS OF THIS TABLE!  USE THIS TABLE            
  1841.   *** TO GOVERN CONTROL TO THE EXEC ITSELF!!!                                   
  1842.                                                                                 
  1843. ./   ADD NAME=ABOUTW,SSI=01020053                                               
  1844. What is Gopher?                                                                 
  1845.                                                                                 
  1846. For more information, read the FAQ, posted to USENET newsgroups                 
  1847. comp.infosystems.gopher and news.answers every two weeks.                       
  1848.                                                                                 
  1849. The information contained here is borrowed therefrom in large part.             
  1850.                                                                                 
  1851. Gopher is a client/server protocol for building a distributed                   
  1852. information delivery service.  While providing a delivery vehicle for           
  1853. local information, Gopher also facilitates access to other Gopher and           
  1854. information servers on the Internet.                                            
  1855.                                                                                 
  1856. Gopher servers and clients can be obtained via anonymous ftp to                 
  1857. boombox.micro.umn.edu.  Look in the directory /pub/gopher.                      
  1858.                                                                                 
  1859.      There are clients for the following systems.  For the latest               
  1860.      directory information, see the FAQ.                                        
  1861.                                                                                 
  1862.       Unix Curses & Emacs                                                       
  1863.       Xwindows                                                                  
  1864.       Macintosh Hypercard                                                       
  1865.       Macintosh Application                                                     
  1866.       DOS w/Clarkson Driver                                                     
  1867.       NeXTstep                                                                  
  1868.       VM/CMS                                                                    
  1869.       VMS                                                                       
  1870.       MVS                                                                       
  1871.                                                                                 
  1872.      There are also a number of public telnet login sites available.            
  1873.      See the FAQ for more information.                                          
  1874.                                                                                 
  1875.      There are servers for the following systems.  For the latest               
  1876.      directory information, see the FAQ.                                        
  1877.                                                                                 
  1878.        Unix                                                                     
  1879.        VMS                                                                      
  1880.        Macintosh                                                                
  1881.        VM/CMS                                                                   
  1882.        MVS                                                                      
  1883.                                                                                 
  1884.                                                                                 
  1885. Papers and articles describing Gopher:                                          
  1886.                                                                                 
  1887.      _The_Internet_Gopher_, "ConneXions", July 1992, Interop.                   
  1888.                                                                                 
  1889.      _Exploring_Internet_GopherSpace_ "The Internet Society News", v1n2 1992,   
  1890.                                                                                 
  1891.      _The_Internet_Gopher_Protocol_, Proceedings of the Twenty-Third            
  1892.           IETF, CNRI, Section 5.3                                               
  1893.                                                                                 
  1894.      _Internet_Gopher_, Proceedings of Canadian Networking '92                  
  1895.                                                                                 
  1896.      _The_Internet_Gopher_, INTERNET: Getting Started, SRI                      
  1897.           International, Section 10.5.5                                         
  1898.                                                                                 
  1899.      _Tools_help_Internet_users_discover_on-line_treasures, Computerworld,      
  1900.           July 20, 1992                                                         
  1901.                                                                                 
  1902.      Gopher will also be in two forthcoming O'Reilly Books:                     
  1903.      "Administrating TCP/IP, and The Whole Internet"                            
  1904.                                                                                 
  1905. ./   ADD NAME=FAQ,SSI=01010032                                                  
  1906. Xref: news.draper.com comp.infosystems.gopher:119 news.answers:1134             
  1907. From: gopher@boombox.micro.umn.edu (UofMN Gopher Team)                          
  1908. Newsgroups: comp.infosystems.gopher,news.answers                                
  1909. Subject: Gopher (comp.infosystems.gopher) Frequently Asked Questions (FAQ)      
  1910. Summary: Common Questions and Answers about the Internet Gopher, a              
  1911.         client/server protocol for making a world wide information              
  1912.         service, with many implementations.                                     
  1913. Date: 15 Aug 92 02:56:59 GMT                                                    
  1914. Sender: news@news2.cis.umn.edu (Usenet News Administration)                     
  1915. Followup-To: comp.infosystems.gopher                                            
  1916. Organization: University of Minnesota                                           
  1917.                                                                                 
  1918. Archive-name: gopher-faq                                                        
  1919. Last-modified: 1992/08/14                                                       
  1920.                                                                                 
  1921. Common Questions and Answers about the Internet Gopher, a                       
  1922. client/server protocol for making a world wide information service,             
  1923. with many implementations.  Posted to comp.infosystems.gopher and               
  1924. news.answers every two weeks.                                                   
  1925.                                                                                 
  1926. -------------------------------------------------------------------             
  1927. Q0:  What is Gopher?                                                            
  1928.                                                                                 
  1929. A0:  The Internet Gopher client/server provides a distributed                   
  1930.      information delivery system around which a world/campus-wide               
  1931.      information system (CWIS) can readily be constructed.   While              
  1932.      providing a delivery vehicle for local information,  Gopher                
  1933.      facilitates access to other Gopher and information servers                 
  1934.      throughout the world.                                                      
  1935.                                                                                 
  1936. -------------------------------------------------------------------             
  1937. Q1:  Where can I get gopher?                                                    
  1938.                                                                                 
  1939. A1:  via anonymous ftp to boombox.micro.umn.edu.  Look in the directory         
  1940.      /pub/gopher                                                                
  1941.                                                                                 
  1942. --------------------------------------------------------------------            
  1943. Q2:  What do I need to access gopher?                                           
  1944.                                                                                 
  1945. A2:  You will need a gopher "client" program that runs on your local PC         
  1946.      or workstation                                                             
  1947.                                                                                 
  1948.      There are clients for the following systems.  The directory                
  1949.      following the name is the location of the client on the anonymous          
  1950.      ftp site boombox.micro.umn.edu (134.84.132.2) in the directory             
  1951.      /pub/gopher.                                                               
  1952.                                                                                 
  1953.       Unix Curses & Emacs   :  /pub/gopher/Unix/gopher1.02.tar.Z                
  1954.       Xwindows              :  /pub/gopher/Unix/xgopher1.1a.tar.Z               
  1955.       Macintosh Hypercard   :  /pub/gopher/Mac_client/                          
  1956.       Macintosh Application :  /pub/gopher/Mac_client/                          
  1957.       DOS w/Clarkson Driver :  /pub/gopher/PC_client/                           
  1958.       NeXTstep              :  /pub/gopher/NeXT/                                
  1959.       VM/CMS                :  /pub/gopher/Rice_CMS/ or /pub/gopher/Vienna_CMS/ 
  1960.       VMS                   :  /pub/gopher/VMS/                                 
  1961.                                                                                 
  1962.      There are also a number of public telnet login sites available.            
  1963.      The University of Minnesota operates one on the machine                    
  1964.      "consultant.micro.umn.edu" (134.84.132.4) See Q3 for more                  
  1965.      information about this.  It is recommended that you run the client         
  1966.      software instead of logging into the public telnet login sites.  A         
  1967.      client uses the custom features of the local machine (mouse,               
  1968.      scroll bars, etc.)  A local client is also faster.                         
  1969.                                                                                 
  1970. ---------------------------------------------------------------------           
  1971. Q3:  Where are there publicly available logins for gopher.                      
  1972.                                                                                 
  1973. A3:  Here is a short list, use the site closest to you to minimize              
  1974.      network lag.                                                               
  1975.                                                                                 
  1976.      Hostname                  IP#              Login   Area                    
  1977.      ------------------------- ---------------  ------  -------------           
  1978.      consultant.micro.umn.edu  134.84.132.4     gopher  North America           
  1979.      gopher.uiuc.edu           128.174.33.160   gopher  North America           
  1980.      gopher.uwp.edu            131.210.1.4      gopher  North America           
  1981.      panda.uiowa.edu           128.255.40.201   panda   North America           
  1982.      info.anu.edu.au           150.203.84.20    info    Australia               
  1983.      gopher.chalmers.se        129.16.221.40    gopher  Sweden                  
  1984.                                                                                 
  1985.      It is recommended that you run the client software instead of              
  1986.      logging into the public telnet login sites.  A client uses the             
  1987.      custom features of the local machine (mouse, scroll bars, etc.)  A         
  1988.      local client is also faster.                                               
  1989.                                                                                 
  1990. ---------------------------------------------------------------------           
  1991. Q4:  How can I add to the information in gopher?                                
  1992.                                                                                 
  1993. A4:  You can do this by running a gopher server.  Servers are available         
  1994.      for a number of systems.  Use anonymous ftp to                             
  1995.      boombox.micro.umn.edu (134.84.132.2) and look in /pub/gopher.  The         
  1996.      following servers are available there:                                     
  1997.                                                                                 
  1998.        Unix      : /pub/gopher/Unix/gopherxx.tar.Z                              
  1999.        VMS       : /pub/gopher/VMS/                                             
  2000.        Macintosh : /pub/gopher/Mac_server/                                      
  2001.        VM/CMS    : /pub/gopher/Rice_CMS/ or /pub/gopher/Vienna_CMS/             
  2002.        MVS       : /pub/gopher/mvs/                                             
  2003.                                                                                 
  2004.      When you have your server ready you can publish it to the world by         
  2005.      sending e-mail to the maintainters of the "Other gophers" list:            
  2006.                                                                                 
  2007.        gopher@boombox.micro.umn.edu                                             
  2008.                                                                                 
  2009. ---------------------------------------------------------------------           
  2010. Q5:  Who Develops Gopher Software?                                              
  2011.                                                                                 
  2012. A5:  Gopher was originally developed in April 1991 by the University            
  2013.      of Minnesota Microcomputer, Workstation, Networks Center to help           
  2014.      our campus find answers to their computer questions.                       
  2015.                                                                                 
  2016.      It has since grown into a full-fledged World Wide Information              
  2017.      System used by a large number of sites in the world.                       
  2018.                                                                                 
  2019.      Many people have contributed to the project, too numerous to               
  2020.      count.                                                                     
  2021.                                                                                 
  2022.      The people behind the much of the gopher software can be reached           
  2023.      via e-mail at gopher@boombox.micro.umn.edu, or via paper mail:             
  2024.                                                                                 
  2025.       Internet Gopher Developers                                                
  2026.       100 Union St. SE #132                                                     
  2027.       Minneapolis, MN 55455  USA                                                
  2028.                                                                                 
  2029. ---------------------------------------------------------------------           
  2030. Q6:  How can I set up a "CSO" phone book server?  Where is the software?        
  2031.                                                                                 
  2032. A6:  CSO phone book servers are also known as "qi" servers.  The                
  2033.      software implementation can be gotten via anonymous ftp from               
  2034.      uxc.cso.uiuc.edu (128.174.5.50) as /pub/qi.tar.Z.  You may also            
  2035.      see this referred to as "ph", which is what most of the clients            
  2036.      are called.                                                                
  2037.                                                                                 
  2038.      There is also an archive of the mailing list for qi/ph software on         
  2039.      the same machine.  It's in /pub/info-ph.archive.                           
  2040.                                                                                 
  2041.      This software is supported by Steve Dorner <s-dorner@uiuc.edu>             
  2042.      Contact him for more information.                                          
  2043.                                                                                 
  2044. -------------------------------------------------------------------             
  2045. Q7:  Why can't I access the University of Minnesota's UPI news?                 
  2046.                                                                                 
  2047. A7:  The University of Minnesota has a site license for UPI news, we            
  2048.      are not allowed to distribute it off of our campus.  We get our            
  2049.      UPI news from Clarinet.  For more information about getting UPI            
  2050.      news send mail to info@clarinet.com.  For information about                
  2051.      setting up your own gopher-UPI server search the gopher-news               
  2052.      archive for UPI.                                                           
  2053.                                                                                 
  2054. -------------------------------------------------------------------             
  2055. Q9:  What are the type characters for the different Gopher Objects?             
  2056.                                                                                 
  2057. A9:  Normal IDs.                                                                
  2058.                                                                                 
  2059.      0       Item is a file                                                     
  2060.      1       Item is a directory                                                
  2061.      2       Item is a CSO (qi) phone-book server                               
  2062.      3       Error                                                              
  2063.      4       Item is a BinHexed Macintosh file.                                 
  2064.      5       Item is DOS binary archive of some sort.                           
  2065.      6       Item is a UNIX uuencoded file.                                     
  2066.      7       Item is an Index-Search server.                                    
  2067.      8       Item points to a text-based telnet session.                        
  2068.      9       Item is a binary file!  Client must read until the connection      
  2069.                  closes.  Beware.                                               
  2070.      T       TN3270 connection.                                                 
  2071.                                                                                 
  2072.      Experimental IDs.                                                          
  2073.                                                                                 
  2074.      s       Sound type.  Data stream is a mulaw sound.                         
  2075.      M       MIME type.  Item contains MIME data.                               
  2076.      h       html type.                                                         
  2077.      I       Image type.                                                        
  2078.      i       "inline" text type.                                                
  2079.                                                                                 
  2080. -------------------------------------------------------------------             
  2081. Q10: When I do full-text searches I always get every document back, Why?        
  2082.                                                                                 
  2083. A10: This is a problem occasionally encountered with Unix full-text             
  2084.      indexes.  It is caused by setting up the link incorrectly to a             
  2085.      gindexd port.                                                              
  2086.                                                                                 
  2087.      The Path= field should be *blank* when pointing to a gindexd               
  2088.      index.                                                                     
  2089.                                                                                 
  2090.      Otherwise the client will send the path to the gindexd daemon,             
  2091.      which interprets everything as a keyword.  This path is                    
  2092.      likely to contain a pathname that is common to all of the indexed          
  2093.      files.  Thus a search generates hits on everything.                        
  2094.                                                                                 
  2095. -------------------------------------------------------------------             
  2096. Q11: When I try to build the UNIX software I get an error from make:            
  2097.      "Must be a separator on rules line #. Stop"  Why?                          
  2098.                                                                                 
  2099. A11: This is a problem with older makes that don't understand the "include"     
  2100.      keyword.  One easy way to cope with this problem is compiling GNU          
  2101.      make, which does understand the include keyword.                           
  2102.                                                                                 
  2103.      If this is too difficult, remove the line:                                 
  2104.                                                                                 
  2105.       include Makefile.config                                                   
  2106.                                                                                 
  2107.      from all the Makefiles and paste in a copy of Makefile.config at           
  2108.      the top of each Makefile.                                                  
  2109. -------------------------------------------------------------------             
  2110. Q12: What is the relationship between Gopher and (WAIS, WWW, ftp)?              
  2111.                                                                                 
  2112. A12: Gopher is intimately intertwined with these two other systems.             
  2113.      As shipped the Unix gopher server has the capability to:                   
  2114.                                                                                 
  2115.        - Search local WAIS indices.                                             
  2116.        - Query remote WAIS servers and funnel the results to gopher             
  2117.          clients.                                                               
  2118.        - Query remote ftp sites and funnel the results to gopher                
  2119.          clients.                                                               
  2120.        - Be queried by WWW (World Wide Web) clients (either using               
  2121.          built in gopher querying or using native http querying.                
  2122.                                                                                 
  2123. -------------------------------------------------------------------             
  2124. Q13: Are papers or articles describing gopher available?                        
  2125.                                                                                 
  2126. A13: Yes.  Here are some references:                                            
  2127.                                                                                 
  2128.      _The_Internet_Gopher_, "ConneXions", July 1992, Interop.                   
  2129.                                                                                 
  2130.      _Exploring_Internet_GopherSpace_ "The Internet Society News", v1n2 1992,   
  2131.                                                                                 
  2132.      _The_Internet_Gopher_Protocol_, Proceedings of the Twenty-Third            
  2133.           IETF, CNRI, Section 5.3                                               
  2134.                                                                                 
  2135.      _Internet_Gopher_, Proceedings of Canadian Networking '92                  
  2136.                                                                                 
  2137.      _The_Internet_Gopher_, INTERNET: Getting Started, SRI                      
  2138.           International, Section 10.5.5                                         
  2139.                                                                                 
  2140.      _Tools_help_Internet_users_discover_on-line_treasures, Computerworld,      
  2141.           July 20, 1992                                                         
  2142.                                                                                 
  2143.      Gopher will also be in two forthcoming O'Reilly Books:                     
  2144.      "Administrating TCP/IP, and The Whole Internet"                            
  2145. -------------------------------------------------------------------             
  2146. Q14: On a DECstation I get the error message "/etc/svc.conf no such file        
  2147.      or directory" when running the gopherd server, why?                        
  2148.                                                                                 
  2149. A14: This is caused by the chroot() call in gopherd.  It can be easily          
  2150.      fixed by running gopherd with the -c option.                               
  2151.                                                                                 
  2152.      Alternatively you can copy /etc/svc.conf into a directory named            
  2153.      "etc" inside the gopher-data directory.                                    
  2154. -------------------------------------------------------------------             
  2155. Q15: The boolean searching terms don't work for my full-text index, why?        
  2156.                                                                                 
  2157. A15: This is probably because the searching is being provided by WAIS.          
  2158.      WAIS opts to return all documents that contain a search phrase             
  2159.      within certain limits.  WAIS searches do return the documents with         
  2160.      the highest "score" at the top, those documents will have the              
  2161.      closest relevance.                                                         
  2162. -------------------------------------------------------------------             
  2163. --                                                                              
  2164.  | Paul Lindner | lindner@boombox.micro.umn.edu   | Slipping into madness       
  2165.  |              | Computer & Information Services | is good for the sake        
  2166.  | GopherMaster | University of Minnesota         | of comparision.             
  2167. ///// / / /    /////// / / / /  /  /  /   /      //// / / / /  /  /  /   /      
  2168. ./ ENDUP                                                                        
  2169. ?!                                                                              
  2170. //C        EXEC GGLOAD,TRK1='14',TO='C'                                         
  2171. //SYSIN    DD DATA,DLM='?!'                                                     
  2172. ./   ADD NAME=GGCLIENT,SSI=01180054                                             
  2173.                                                                                 
  2174.  /********************************************************************/         
  2175.  /*                                                                  */         
  2176.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2177.  /*                                                                  */         
  2178.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2179.  /*                                                                  */         
  2180.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2181.  /* including the implied warranties of merchantability and fitness, */         
  2182.  /* are expressly denied.                                            */         
  2183.  /*                                                                  */         
  2184.  /* Provided this copyright notice is included, this software may    */         
  2185.  /* be freely distributed and not offered for sale.                  */         
  2186.  /*                                                                  */         
  2187.  /* Changes or modifications may be made and used only by the maker  */         
  2188.  /* of same, and not further distributed.  Such modifications should */         
  2189.  /* be mailed to the author for consideration for addition to the    */         
  2190.  /* software and incorporation in subsequent releases.               */         
  2191.  /*                                                                  */         
  2192.  /********************************************************************/         
  2193.                                                                                 
  2194. #ifdef SASC                                                                     
  2195. #pragma  runopts(EXECOPS)                                                       
  2196. #else                                                                           
  2197. #pragma  runopts(heap(8k,8k,anywhere,))                                         
  2198. #pragma  runopts(nospie,nostae)                                                 
  2199. #endif                                                                          
  2200.                                                                                 
  2201. #pragma  csect(code,  "GG@LIENT")                                               
  2202. #pragma  csect(static,"GG$LIENT")                                               
  2203. #include "gg.h"                                                                 
  2204.                                                                                 
  2205. /*********************************************************************/         
  2206.                                                                                 
  2207. static char copyright_notice[] =                                                
  2208.    "Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992   \n\         
  2209.                                                                     \n\         
  2210.     GOPHER server due to Shawn Hart at the University of Delaware.  \n\         
  2211.                                                                     \n\         
  2212.     This software is provided on an 'AS IS' basis.  All warranties, \n\         
  2213.     including the implied warranties of merchantability and fitness,\n\         
  2214.     are expressly denied.                                           \n\         
  2215.                                                                     \n\         
  2216.     Provided this copyright notice is included, this software may   \n\         
  2217.     be freely distributed and not offered for sale.                 \n\         
  2218.                                                                     \n\         
  2219.     Changes or modifications may be made and used only by the maker \n\         
  2220.     of same, and not further distributed.  Such modifications should\n\         
  2221.     be mailed to the author for consideration for addition to the   \n\         
  2222.     software and incorporation in subsequent releases.";                        
  2223.                                                                                 
  2224. /*********************************************************************/         
  2225.                                                                                 
  2226. #ifdef I370                                                                     
  2227. char * _style = "tso:";                                                         
  2228. #endif                                                                          
  2229.                                                                                 
  2230. /*********************************************************************/         
  2231.                                                                                 
  2232. static Bool                                                                     
  2233. go_for_it(gp,ip)                                                                
  2234. struct ggcb            *gp;                                                     
  2235. struct gopherinfo      *ip;                                                     
  2236. {                                                                               
  2237.  char                   temp   [32];                                            
  2238.                                                                                 
  2239.  (void)GGMivget(gp,"GGHOST ",ip->host,sizeof(ip->host));                        
  2240.  (void)GGMivget(gp,"GGPATH ",ip->path,sizeof(ip->path));                        
  2241.  (void)GGMivget(gp,"GGDESC ",ip->desc,sizeof(ip->desc));                        
  2242.  (void)GGMivget(gp,"GGPORT ",temp    ,sizeof(temp)    );                        
  2243.  ip->type = INITIAL_TYPE;                                                       
  2244.  if (!*ip->path) strcpy(ip->path,INITIAL_PATH);                                 
  2245.  if (!*ip->host) strcpy(ip->host,INITIAL_HOST);                                 
  2246.  if (!*ip->desc) strcpy(ip->desc,INITIAL_DESC);                                 
  2247.  ip->port = atoi(temp);                                                         
  2248.  if (ip->port == 0) ip->port = INITIAL_PORT;                                    
  2249.                                                                                 
  2250.  return GGMgofor(gp,ip,FALSE);                                                  
  2251.                                                                                 
  2252. }                                                                               
  2253.                                                                                 
  2254. /*********************************************************************/         
  2255.                                                                                 
  2256. int                                                                             
  2257. main(argc,argv)                                                                 
  2258. int      argc;                                                                  
  2259. char   **argv;                                                                  
  2260.                                                                                 
  2261. {                                                                               
  2262.  struct ggcb            *gp;                                                    
  2263.  struct gopherinfo      *ip;                                                    
  2264.  char                   *p;                                                     
  2265.  int                     i;                                                     
  2266.  int                     exit_return_code;                                      
  2267.  Bool                    bypass_startup;                                        
  2268.  struct ggcb             gg;                                                    
  2269.  char                    zerrsm [25];                                           
  2270.  char                    zerrlm [73];                                           
  2271.                                                                                 
  2272.  exit_return_code = 0;                                                          
  2273.                                                                                 
  2274.  memset(&gg,0,sizeof(struct ggcb));                                             
  2275.                                                                                 
  2276.  gp = ≫                                                                      
  2277.                                                                                 
  2278.  /* set up top-level gopherinfo structure */                                    
  2279.                                                                                 
  2280.  GETMAIN(ip, struct gopherinfo, 1, "top-level gopherinfo struct");              
  2281.  if (!ip) {                                                                     
  2282.    fprintf(stderr,"Not enough memory to start up GOPHER\n");                    
  2283.    exit(16);                                                                    
  2284.  }                                                                              
  2285.                                                                                 
  2286.  memset(ip,0,sizeof(struct gopherinfo));                                        
  2287.                                                                                 
  2288.  gp->ginfo = ip;                                                                
  2289.                                                                                 
  2290.  gp->test_mode  = FALSE;                                                        
  2291.  gp->debug_mode = FALSE;                                                        
  2292.  gp->local_mode = FALSE;                                                        
  2293.  bypass_startup = FALSE;                                                        
  2294.                                                                                 
  2295.  for (i = 1; i < argc; i++) {                                                   
  2296.    p = argv[i];                                                                 
  2297.    if (*p == '-') {                                                             
  2298.      while (*++p) {                                                             
  2299.        switch (toupper(*p)) {                                                   
  2300.          case 'T':  gp->test_mode  = TRUE;    break;                            
  2301.          case 'D':  gp->debug_mode = TRUE;    break;                            
  2302.          case 'L':  gp->local_mode = TRUE;    break;                            
  2303.          case 'Q':  bypass_startup = TRUE;    break;                            
  2304.          default: fprintf(stderr,"GGMVS: Bad parameter flag %c\n", *p);         
  2305.                   exit_return_code = 8;                                         
  2306.        }                                                                        
  2307.      }                                                                          
  2308.    }                                                                            
  2309.    else {                                                                       
  2310.      fprintf(stderr,"GGMVS: Bad parameter string %s\n",p);                      
  2311.      exit_return_code = 8;                                                      
  2312.    }                                                                            
  2313.  }                                                                              
  2314.                                                                                 
  2315.  if (gp->test_mode) __ctest(NULL);                                              
  2316.                                                                                 
  2317.  if (gp->debug_mode) {                                                          
  2318.    if (!(gp->debug_file = fopen("dd:ggdebug","w"))) {                           
  2319.      perror("debug file (DD GGDEBUG)");                                         
  2320.      exit_return_code = 4;                                                      
  2321.    }                                                                            
  2322.  }                                                                              
  2323.  else gp->debug_file = NULL;                                                    
  2324.                                                                                 
  2325.  gp->thdr.first_text_line = NULL;                                               
  2326.                                                                                 
  2327.  GGMclrtx(gp,NULL);               /* Clear text       */                        
  2328.  GGMclrtx(gp,ip);                 /* Clear text       */                        
  2329.                                                                                 
  2330.  gp->g_bytes_returned = 0;                                                      
  2331.  gp->g_buf_index      = -1;                                                     
  2332.                                                                                 
  2333.  /* Determine the local path name. Done in GGMCONN when needed now */           
  2334.                                                                                 
  2335.  strcpy(gp->ggserver,"");                                                       
  2336.  gp->connected_to_server   = FALSE;                                             
  2337.  gp->closing_connection    = FALSE;                                             
  2338.  gp->reconnect_in_progress = FALSE;                                             
  2339.  gp->receiving_text        = FALSE;                                             
  2340.                                                                                 
  2341.  GETMAIN(gp->server_buf,    char,SERVER_BUF_MSGSIZE+4,"server buffer");         
  2342.  GETMAIN(gp->client_buf,    char,CLIENT_BUF_MSGSIZE+4,"client buffer");         
  2343.  GETMAIN(gp->gopher_command,char,CLIENT_BUF_MSGSIZE+4,"gopher command");        
  2344.                                                                                 
  2345. #ifdef FETCH                                                                    
  2346.                                                                                 
  2347.  gp->isplink_pointer = (int (*) ())fetch("ISPLINK");                            
  2348.  gp->ispexec_pointer = (int (*) ())fetch("ISPEXEC");                            
  2349.                                                                                 
  2350. #endif                                                                          
  2351.                                                                                 
  2352.  if (!GGMispf(gp,"CONTROL ERRORS RETURN")) exit_return_code = 20;               
  2353.                                                                                 
  2354.  else {                                                                         
  2355.                                                                                 
  2356.    exit_return_code = 0;                                                        
  2357.                                                                                 
  2358.    /* not done yet:  set up command and selection code tables */                
  2359.                                                                                 
  2360.    GGMsopt(gp,OPTION_ALL);      /* set options */                               
  2361.                                                                                 
  2362.    if (bypass_startup) {                                                        
  2363.      (void)GGMispf(gp,"VGET (GGHOST GGPATH GGDESC GGPORT) PROFILE");            
  2364.      (void)go_for_it(gp,ip);                                                    
  2365.    }                                                                            
  2366.    else {                                                                       
  2367.      (void)GGMivput(gp,"ZCMD "    ,"",-1);                                      
  2368.      while (GGMdispl(gp,"GGM     ") == 0                                        
  2369.          && !gp->quit                                                           
  2370.          && !go_for_it(gp,ip)) ;                                                
  2371.    }                                                                            
  2372.  }                                                                              
  2373.                                                                                 
  2374.  if (gp->setmsg) {                                                              
  2375.    (void)GGMivget(gp,"ZERRSM ",zerrsm, sizeof(zerrsm));                         
  2376.    (void)GGMivget(gp,"ZERRLM ",zerrlm, sizeof(zerrlm));                         
  2377.    fprintf(stderr,"%s: %s\n",zerrsm,zerrlm);                                    
  2378.    gp->setmsg = FALSE;                                                          
  2379.  }                                                                              
  2380.                                                                                 
  2381.  if (gp->connected_to_server) {                                                 
  2382.    GGMdisc(gp);                 /* disconnect from news server */               
  2383.  }                                                                              
  2384.                                                                                 
  2385.  FREEMAIN(gp->gopher_command,"gopher command");                                 
  2386.  FREEMAIN(gp->server_buf,    "server buffer");                                  
  2387.  FREEMAIN(gp->client_buf,    "client buffer");                                  
  2388.  FREEMAIN(gp->ginfo,         "top-level gopherinfo struct");                    
  2389.                                                                                 
  2390.  #define FINAL_CLOSE(A,B) \                                                     
  2391.    if (A) { \                                                                   
  2392.             if (fclose(A) < 0) fprintf(stderr,B); \                             
  2393.           }                                                                     
  2394.                                                                                 
  2395.  FINAL_CLOSE(gp->debug_file, "Error closing debug file\n");                     
  2396.                                                                                 
  2397.  exit(exit_return_code);                                                        
  2398. }                                                                               
  2399.                                                                                 
  2400. ./   ADD NAME=GGMALLOC,SSI=01030039                                             
  2401.                                                                                 
  2402.  /********************************************************************/         
  2403.  /*                                                                  */         
  2404.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2405.  /*                                                                  */         
  2406.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2407.  /*                                                                  */         
  2408.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2409.  /* including the implied warranties of merchantability and fitness, */         
  2410.  /* are expressly denied.                                            */         
  2411.  /*                                                                  */         
  2412.  /* Provided this copyright notice is included, this software may    */         
  2413.  /* be freely distributed and not offered for sale.                  */         
  2414.  /*                                                                  */         
  2415.  /* Changes or modifications may be made and used only by the maker  */         
  2416.  /* of same, and not further distributed.  Such modifications should */         
  2417.  /* be mailed to the author for consideration for addition to the    */         
  2418.  /* software and incorporation in subsequent releases.               */         
  2419.  /*                                                                  */         
  2420.  /********************************************************************/         
  2421.                                                                                 
  2422. #pragma  csect(code,  "GG@ALLOC")                                               
  2423. #pragma  csect(static,"GG$ALLOC")                                               
  2424. #include "gg.h"                                                                 
  2425.                                                                                 
  2426. /****** Allocate a data set. *****************************************/         
  2427.                                                                                 
  2428. enum data_set_type                                                              
  2429. GGMalloc(dsname,ddname,wanted_type,nitems)                                      
  2430. char                      *dsname;                                              
  2431. char                      *ddname;                                              
  2432. enum data_set_type         wanted_type;                                         
  2433. int                        nitems;                                              
  2434. {                                                                               
  2435.  int                       i;                                                   
  2436.  int                       rc;                                                  
  2437.  char                     *cp;                                                  
  2438.  enum data_set_type        return_type;                                         
  2439.  Bool                      try_new;                                             
  2440.  short                     primary_allocation   ;                               
  2441.  short                     secondary_allocation ;                               
  2442.  short                     directory_blocks     ;                               
  2443.  short                     dsorg                ;                               
  2444.  __S99parms                stuff99; /* No "struct", despite manual */           
  2445.  TEXTUNIT                 *tu [17];                                             
  2446.  TEXTUNIT                  tu_dsn;                                              
  2447.  TEXTUNIT                  tu_ddn;                                              
  2448.  TEXTUNIT                  tu_member;                                           
  2449.  TEXTUNIT                  tu_stat;                                             
  2450.  TEXTUNIT                  tu_disp;                                             
  2451.  TEXTUNIT                  tu_perm;                                             
  2452.  TEXTUNIT                  tu_rtddn;                                            
  2453.  TEXTUNIT                  tu_rtorg;                                            
  2454.  TEXTUNIT                  tu_block;                                            
  2455.  TEXTUNIT                  tu_prime;                                            
  2456.  TEXTUNIT                  tu_sec;                                              
  2457.  TEXTUNIT                  tu_dir;                                              
  2458.  TEXTUNIT                  tu_recfm;                                            
  2459.  TEXTUNIT                  tu_lrecl;                                            
  2460.  TEXTUNIT                  tu_blksz;                                            
  2461.  TEXTUNIT                  tu_dsorg;                                            
  2462.  char                     *lparp;                                               
  2463.  char                     *rparp;                                               
  2464.  char                      dsnseq [81];                                         
  2465.  char                      member [81];                                         
  2466.  char                      what_to_open[81];                                    
  2467.  FILE                     *mfile;                                               
  2468.                                                                                 
  2469.  try_new = FALSE;                                                               
  2470.                                                                                 
  2471.  memset((char *)&stuff99,0,sizeof(__S99parms));                                 
  2472.                                                                                 
  2473.  strcpy(member,"");                                                             
  2474.  strcpy(dsnseq,dsname);                                                         
  2475.  lparp = strchr(dsnseq,'(');                                                    
  2476.  rparp = strchr(dsnseq,')');                                                    
  2477.  if (lparp && rparp && (lparp < rparp) && (*(rparp+1) == '\0')) {               
  2478.    *lparp = '\0';            /* makes dsnseq the seq part only */               
  2479.    *rparp = '\0';            /* turns member into a string     */               
  2480.    strcpy(member, lparp+1);                                                     
  2481.    wanted_type = PDS;                                                           
  2482.  }                                                                              
  2483.                                                                                 
  2484.  for (;;) {                                                                     
  2485.                                                                                 
  2486.    stuff99.__S99RBLN   = 20;                                                    
  2487.    stuff99.__S99VERB   = S99VRBAL;                                              
  2488.    stuff99.__S99FLAG1  = S99NOCNV << 8;                                         
  2489.    stuff99.__S99ERROR  = 0;                                                     
  2490.    stuff99.__S99INFO   = 0;                                                     
  2491.    stuff99.__S99TXTPP  = tu;                                                    
  2492.    stuff99.__S99FLAG2  = 0;                                                     
  2493.                                                                                 
  2494.    i = 0;                                                                       
  2495.                                                                                 
  2496.    tu[i++] = &tu_dsn;                                                           
  2497.                                                                                 
  2498.    tu_dsn.key        = DALDSNAM;                                                
  2499.    tu_dsn.num        = 1;                                                       
  2500.    tu_dsn.ent.len    = strlen(dsnseq);                                          
  2501.    strcpy(tu_dsn.ent.prm,dsnseq);                                               
  2502.    for (cp=tu_dsn.ent.prm; *cp; cp++) *cp = toupper(*cp);                       
  2503.                                                                                 
  2504.    tu[i++] = &tu_stat;                                                          
  2505.                                                                                 
  2506.    tu_stat.key      = DALSTATS;                                                 
  2507.    tu_stat.num      = 1;                                                        
  2508.    tu_stat.ent.len  = 1;                                                        
  2509.    *tu_stat.ent.prm = (try_new ? NEW : SHR);                                    
  2510.                                                                                 
  2511.    tu[i++] = &tu_disp;                                                          
  2512.                                                                                 
  2513.    tu_disp.key      = DALNDISP;                                                 
  2514.    tu_disp.num      = 1;                                                        
  2515.    tu_disp.ent.len  = 1;                                                        
  2516.    *tu_disp.ent.prm = (try_new ? CATLG : KEEP);                                 
  2517.                                                                                 
  2518.    tu[i++] = &tu_rtorg;                                                         
  2519.                                                                                 
  2520.    tu_rtorg.key     = DALRTORG;                                                 
  2521.    tu_rtorg.num     = 1;                                                        
  2522.    tu_rtorg.ent.len = 2;                                                        
  2523.                                                                                 
  2524.    if (*member) {                                                               
  2525.                                                                                 
  2526.      tu[i++] = &tu_member;                                                      
  2527.                                                                                 
  2528.      tu_member.key     = DALMEMBR;                                              
  2529.      tu_member.num     = 1;                                                     
  2530.      tu_member.ent.len = strlen(member);                                        
  2531.      strcpy(tu_member.ent.prm,member);                                          
  2532.      for (cp=tu_member.ent.prm; *cp; cp++) *cp = toupper(*cp);                  
  2533.                                                                                 
  2534.    }                                                                            
  2535.                                                                                 
  2536.    if (ddname && *ddname) {                                                     
  2537.                                                                                 
  2538.      tu[i++] = &tu_ddn;                                                         
  2539.                                                                                 
  2540.      tu_ddn.key     = DALDDNAM;                                                 
  2541.      tu_ddn.num     = 1;                                                        
  2542.      tu_ddn.ent.len = strlen(ddname);                                           
  2543.      strcpy(tu_ddn.ent.prm,ddname);                                             
  2544.      for (cp=tu_ddn.ent.prm; *cp; cp++) *cp = toupper(*cp);                     
  2545.                                                                                 
  2546.      tu[i++] = &tu_perm;                                                        
  2547.                                                                                 
  2548.      tu_perm.key     = DALPERMA;                                                
  2549.      tu_perm.num     = 0;                                                       
  2550.    }                                                                            
  2551.    else {                                                                       
  2552.                                                                                 
  2553.      tu[i++] = &tu_rtddn;                                                       
  2554.                                                                                 
  2555.      tu_rtddn.key     = DALRTDDN;                                               
  2556.      tu_rtddn.num     = 1;                                                      
  2557.      tu_rtddn.ent.len = 8;                                                      
  2558.      memset(tu_rtddn.ent.prm,' ',8);                                            
  2559.                                                                                 
  2560.    }                                                                            
  2561.                                                                                 
  2562.    if (try_new) {                                                               
  2563.                                                                                 
  2564.      switch (wanted_type) {                                                     
  2565.        case PDS:                                                                
  2566.                  primary_allocation   = (short)nitems;                          
  2567.                  secondary_allocation = primary_allocation;                     
  2568.                  directory_blocks     = ((short)nitems/(12*36)+1) * 36;         
  2569.                  dsorg                = DSORG_PO;                               
  2570.                  break;                                                         
  2571.        case SEQ:                                                                
  2572.        default:                                                                 
  2573.                  primary_allocation   = (short)nitems;                          
  2574.                  secondary_allocation = primary_allocation;                     
  2575.                  directory_blocks     = 0;                                      
  2576.                  dsorg                = DSORG_PS;                               
  2577.                  break;                                                         
  2578.      }                                                                          
  2579.                                                                                 
  2580.      tu[i++] = &tu_block;                                                       
  2581.                                                                                 
  2582.      tu_block.key     = DALBLKLN;                                               
  2583.      tu_block.num     = 1;                                                      
  2584.      tu_block.ent.len = 3;                                                      
  2585.      memset(tu_block.ent.prm,0,3);                                              
  2586.      *(short *)(tu_block.ent.prm+1) = 6233;                                     
  2587.                                                                                 
  2588.      tu[i++] = &tu_prime;                                                       
  2589.                                                                                 
  2590.      tu_prime.key     = DALPRIME;                                               
  2591.      tu_prime.num     = 1;                                                      
  2592.      tu_prime.ent.len = 3;                                                      
  2593.      memset(tu_prime.ent.prm,0,3);                                              
  2594.      *(short *)(tu_prime.ent.prm+1) = primary_allocation;                       
  2595.                                                                                 
  2596.      tu[i++] = &tu_sec;                                                         
  2597.                                                                                 
  2598.      tu_sec.key     = DALSECND;                                                 
  2599.      tu_sec.num     = 1;                                                        
  2600.      tu_sec.ent.len = 3;                                                        
  2601.      memset(tu_sec.ent.prm,0,3);                                                
  2602.      *(short *)(tu_sec.ent.prm+1) = secondary_allocation;                       
  2603.                                                                                 
  2604.      tu[i++] = &tu_dir;                                                         
  2605.                                                                                 
  2606.      tu_dir.key     = DALDIR;                                                   
  2607.      tu_dir.num     = 1;                                                        
  2608.      tu_dir.ent.len = 3;                                                        
  2609.      memset(tu_dir.ent.prm,0,3);                                                
  2610.      *(short *)(tu_dir.ent.prm+1) = directory_blocks;                           
  2611.                                                                                 
  2612.      tu[i++] = &tu_recfm;                                                       
  2613.                                                                                 
  2614.      tu_recfm.key        = DALRECFM;                                            
  2615.      tu_recfm.num        = 1;                                                   
  2616.      tu_recfm.ent.len    = 1;                                                   
  2617.      *tu_recfm.ent.prm   = RECFM_VB;                                            
  2618.                                                                                 
  2619.      tu[i++] = &tu_lrecl;                                                       
  2620.                                                                                 
  2621.      tu_lrecl.key        = DALLRECL;                                            
  2622.      tu_lrecl.num        = 1;                                                   
  2623.      tu_lrecl.ent.len    = 2;                                                   
  2624.      *(short *)tu_lrecl.ent.prm   = 259;                                        
  2625.                                                                                 
  2626.      tu[i++] = &tu_blksz;                                                       
  2627.                                                                                 
  2628.      tu_blksz.key        = DALBLKSZ;                                            
  2629.      tu_blksz.num        = 1;                                                   
  2630.      tu_blksz.ent.len    = 2;                                                   
  2631.      *(short *)tu_blksz.ent.prm   = 6233;                                       
  2632.                                                                                 
  2633.      tu[i++] = &tu_dsorg;                                                       
  2634.                                                                                 
  2635.      tu_dsorg.key        = DALDSORG;                                            
  2636.      tu_dsorg.num        = 1;                                                   
  2637.      tu_dsorg.ent.len    = 2;                                                   
  2638.      *(short *)tu_dsorg.ent.prm   = dsorg;                                      
  2639.                                                                                 
  2640.    }                                                                            
  2641.                                                                                 
  2642.    tu[i] = (void *)0x80000000;                                                  
  2643.                                                                                 
  2644.    rc = svc99(&stuff99);                                                        
  2645.                                                                                 
  2646.    if (rc == 0) {                                                               
  2647.      if (!(ddname && *ddname)) {                                                
  2648.        memcpy(ddname,(char *)tu_rtddn.ent.prm,8);                               
  2649.        *(ddname+8) = ' ';                                                       
  2650.        *(strchr(ddname,' ')) = '\0';                                            
  2651.      }                                                                          
  2652.      switch (tu_rtorg.ent.prm[0]) {                                             
  2653.        case 0x40:  return_type = SEQ; break;                                    
  2654.        case 0x02:  return_type = PDS; break;                                    
  2655.        default:    return_type = UNK; break;                                    
  2656.      }                                                                          
  2657.      if (wanted_type == SEQ && return_type != SEQ) {                            
  2658.        fprintf(stderr,"%s: not a sequential data set\n",dsname);                
  2659.      }                                                                          
  2660.      if (wanted_type == PDS && return_type != PDS) {                            
  2661.        fprintf(stderr,"%s: not a partitioned data set\n",dsname);               
  2662.      }                                                                          
  2663.      if (return_type == PDS && *member) return SEQ;                             
  2664.      else return return_type;                                                   
  2665.    }                                                                            
  2666.    else if (!try_new && nitems != 0 && stuff99.__S99ERROR == 0x1708) {          
  2667.     try_new = TRUE;                                                             
  2668.     continue;                                                                   
  2669.    }                                                                            
  2670.    else {                                                                       
  2671.      GGMdfail(rc,&stuff99);                                                     
  2672.      return UNK;                                                                
  2673.    }                                                                            
  2674.  }                                                                              
  2675. }                                                                               
  2676.                                                                                 
  2677. ./   ADD NAME=GGMBRIFC,SSI=01020028                                             
  2678.                                                                                 
  2679.  /********************************************************************/         
  2680.  /*                                                                  */         
  2681.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2682.  /*                                                                  */         
  2683.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2684.  /*                                                                  */         
  2685.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2686.  /* including the implied warranties of merchantability and fitness, */         
  2687.  /* are expressly denied.                                            */         
  2688.  /*                                                                  */         
  2689.  /* Provided this copyright notice is included, this software may    */         
  2690.  /* be freely distributed and not offered for sale.                  */         
  2691.  /*                                                                  */         
  2692.  /* Changes or modifications may be made and used only by the maker  */         
  2693.  /* of same, and not further distributed.  Such modifications should */         
  2694.  /* be mailed to the author for consideration for addition to the    */         
  2695.  /* software and incorporation in subsequent releases.               */         
  2696.  /*                                                                  */         
  2697.  /********************************************************************/         
  2698.                                                                                 
  2699. #pragma  csect(code,  "GG@BRIFC")                                               
  2700. #pragma  csect(static,"GG$BRIFC")                                               
  2701. #include "gg.h"                                                                 
  2702.                                                                                 
  2703. /****** BRIF primary command function. *******************************/         
  2704.                                                                                 
  2705. int                                                                             
  2706. GGMbrifc(numptr,dialog_data_ptr)                                                
  2707. int                  *numptr;                                                   
  2708. void                 *dialog_data_ptr;                                          
  2709. {                                                                               
  2710.  Rstruc ggcb         *gp = *(Rstruc ggcb **)dialog_data_ptr;                    
  2711.  Rstruc gopherinfo   *ip = gp->ginfo;                                           
  2712.  struct gopherinfo   *ip1;                                                      
  2713.  char                 zcmd[80];                                                 
  2714.  char                 command[80];                                              
  2715.  char                 operand[80];                                              
  2716.  char                *p;                                                        
  2717.  int                  opoff;                                                    
  2718.                                                                                 
  2719.  /*                                                                             
  2720.   * For commands which are supposed to terminate the current BRIF               
  2721.   * (like NEXT and PREV), we return an invalid return code, which               
  2722.   * is documented to make BRIF itself return with a code of 16,                 
  2723.   * which we treat as a normal end.                                             
  2724.   */                                                                            
  2725.                                                                                 
  2726.  (void)GGMivget(gp,"ZCMD ",zcmd,sizeof(zcmd));                                  
  2727.  strcpy(command,"");                                                            
  2728.  strcpy(operand,"");                                                            
  2729.  if (1 <= sscanf(zcmd,"%s %n",&command,&opoff)) {                               
  2730.    for (p=command;*p;p++) *p = toupper(*p);                                     
  2731.    if ((EQUAL(command,"EXTRACT") ||  EQUAL(command,"EXT")))  {                  
  2732.      if (!ip) (void)GGMivput(gp,"GGTNUM ","",-1);                               
  2733.      gp->extract_file = NULL;                                                   
  2734.      (void)GGMispf(gp,"CONTROL DISPLAY SAVE");                                  
  2735.      (void)GGMxtx(gp,ip);                        /* Extract text */             
  2736.      (void)GGMispf(gp,"CONTROL DISPLAY RESTORE");                               
  2737.      return 0;                                                                  
  2738.    }                                                                            
  2739.    else                                                                         
  2740.    if (EQUAL(command,"PRT")) {                                                  
  2741.      (void)GGMispf(gp,"CONTROL DISPLAY SAVE");                                  
  2742.      GGMptx(gp,ip);            /* Print text */                                 
  2743.      (void)GGMispf(gp,"CONTROL DISPLAY RESTORE");                               
  2744.      return 0;                                                                  
  2745.    }                                                                            
  2746.    else                                                                         
  2747.    if (EQUAL(command,"QUIT")) {                                                 
  2748.      gp->quit = TRUE;                                                           
  2749.      return 1;                                                                  
  2750.    }                                                                            
  2751.    else {                                                                       
  2752.      ERR1(                                                                      
  2753.           "The only non-BROWSE commands available are EXTract and PRT."         
  2754.          );                                                                     
  2755.      return 12;                                                                 
  2756.    }                                                                            
  2757.  }                                                                              
  2758.                                                                                 
  2759.  return 4; /* ISPF-PDF should handle the command */                             
  2760.                                                                                 
  2761. }                                                                               
  2762.                                                                                 
  2763. ./   ADD NAME=GGMBRIFR,SSI=01000032                                             
  2764.                                                                                 
  2765.  /********************************************************************/         
  2766.  /*                                                                  */         
  2767.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2768.  /*                                                                  */         
  2769.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2770.  /*                                                                  */         
  2771.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2772.  /* including the implied warranties of merchantability and fitness, */         
  2773.  /* are expressly denied.                                            */         
  2774.  /*                                                                  */         
  2775.  /* Provided this copyright notice is included, this software may    */         
  2776.  /* be freely distributed and not offered for sale.                  */         
  2777.  /*                                                                  */         
  2778.  /* Changes or modifications may be made and used only by the maker  */         
  2779.  /* of same, and not further distributed.  Such modifications should */         
  2780.  /* be mailed to the author for consideration for addition to the    */         
  2781.  /* software and incorporation in subsequent releases.               */         
  2782.  /*                                                                  */         
  2783.  /********************************************************************/         
  2784.                                                                                 
  2785. #pragma  csect(code,  "GG@BRIFR")                                               
  2786. #pragma  csect(static,"GG$BRIFR")                                               
  2787. #include "gg.h"                                                                 
  2788.                                                                                 
  2789. /****** BRIF read function. ******************************************/         
  2790.                                                                                 
  2791. int                                                                             
  2792. GGMbrifr(dataptr,lenptr,recnoptr,dialog_data_ptr)                               
  2793. char                **dataptr;                                                  
  2794. int                  *lenptr;                                                   
  2795. int                  *recnoptr;                                                 
  2796. void                 *dialog_data_ptr;                                          
  2797. {                                                                               
  2798.  Rstruc textline     *tp;                                                       
  2799.  Rstruc ggcb         *gp;                                                       
  2800.  Rstruc texthdr      *thp;                                                      
  2801.         int           return_value;                                             
  2802.         int           current_recno;                                            
  2803.         int           i;                                                        
  2804.                                                                                 
  2805.  gp             = *(struct ggcb **)dialog_data_ptr;                             
  2806.  thp            = gp->brifp;                                                    
  2807.  current_recno  = *recnoptr;                                                    
  2808.  return_value   = 0;                                                            
  2809.  tp             = NULL;                                                         
  2810.                                                                                 
  2811.  if (current_recno == 99999999) {    /* scroll down max request */              
  2812.    tp = NULL;                                                                   
  2813.  }                                                                              
  2814.  else if (thp->current_text_line != NULL &&                                     
  2815.           current_recno == gp->brif_previous_recno+1) {                         
  2816.    tp = thp->current_text_line->next;                                           
  2817.    while (tp && tp->text_length < 0) tp = tp->next;                             
  2818.  }                                                                              
  2819.  else {                                                                         
  2820.    for (i = 0, tp = thp->first_text_line; tp; tp = tp->next) {                  
  2821.      if (tp->text_length >= 0) {                                                
  2822.        if (++i >= current_recno) break;                                         
  2823.      }                                                                          
  2824.    }                                                                            
  2825.  }                                                                              
  2826.                                                                                 
  2827.  if (tp == NULL) {                                                              
  2828.    *recnoptr = thp->text_line_count;                                            
  2829.    return_value = 8;                                                            
  2830.  }                                                                              
  2831.  else {                                                                         
  2832.    thp->current_text_line = tp;                                                 
  2833.    *dataptr = tp->tab_expanded_text;                                            
  2834.    *lenptr  = tp->tab_expanded_text_length;                                     
  2835.    return_value = 0;                                                            
  2836.  }                                                                              
  2837.                                                                                 
  2838.  gp->brif_previous_recno = current_recno;                                       
  2839.                                                                                 
  2840.  return return_value;                                                           
  2841.                                                                                 
  2842. }                                                                               
  2843.                                                                                 
  2844. ./   ADD NAME=GGMCLRTX,SSI=01000031                                             
  2845.                                                                                 
  2846.  /********************************************************************/         
  2847.  /*                                                                  */         
  2848.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2849.  /*                                                                  */         
  2850.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2851.  /*                                                                  */         
  2852.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2853.  /* including the implied warranties of merchantability and fitness, */         
  2854.  /* are expressly denied.                                            */         
  2855.  /*                                                                  */         
  2856.  /* Provided this copyright notice is included, this software may    */         
  2857.  /* be freely distributed and not offered for sale.                  */         
  2858.  /*                                                                  */         
  2859.  /* Changes or modifications may be made and used only by the maker  */         
  2860.  /* of same, and not further distributed.  Such modifications should */         
  2861.  /* be mailed to the author for consideration for addition to the    */         
  2862.  /* software and incorporation in subsequent releases.               */         
  2863.  /*                                                                  */         
  2864.  /********************************************************************/         
  2865.                                                                                 
  2866. #pragma  csect(code,  "GG@CLRTX")                                               
  2867. #pragma  csect(static,"GG$CLRTX")                                               
  2868. #include "gg.h"                                                                 
  2869.                                                                                 
  2870. /****** Clear text. **************************************************/         
  2871.                                                                                 
  2872. void                                                                            
  2873. GGMclrtx(gp,ip)                                                                 
  2874. Rstruc ggcb           *gp;                                                      
  2875. Rstruc gopherinfo     *ip;                                                      
  2876.                                                                                 
  2877. {                                                                               
  2878.  Rstruc texthdr       *thp;                                                     
  2879.  Rstruc textline      *tp1;                                                     
  2880.  Rstruc textline      *tp2;                                                     
  2881.                                                                                 
  2882.  /* If info is not specified, use main ggcb, else info's text */                
  2883.                                                                                 
  2884.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  2885.                                                                                 
  2886.  tp1=thp->first_text_line;                                                      
  2887.  while (tp1) {                                                                  
  2888.   tp2 = tp1->next;                                                              
  2889.   FREEMAIN(tp1,"text line");                                                    
  2890.   tp1 = tp2;                                                                    
  2891.  }                                                                              
  2892.                                                                                 
  2893.  thp->text_body_line    = NULL;                                                 
  2894.  thp->first_text_line   = NULL;                                                 
  2895.  thp->current_text_line = NULL;                                                 
  2896.  thp->last_text_line    = NULL;                                                 
  2897.  thp->text_line_count   = 0;                                                    
  2898.  thp->text_max_length   = 0;                                                    
  2899.  thp->text_max_tab_expanded_length   = 0;                                       
  2900.                                                                                 
  2901.  return;                                                                        
  2902.                                                                                 
  2903. }                                                                               
  2904.                                                                                 
  2905. ./   ADD NAME=GGMCONN,SSI=01080009                                              
  2906.                                                                                 
  2907.  /********************************************************************/         
  2908.  /*                                                                  */         
  2909.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2910.  /*                                                                  */         
  2911.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2912.  /*                                                                  */         
  2913.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2914.  /* including the implied warranties of merchantability and fitness, */         
  2915.  /* are expressly denied.                                            */         
  2916.  /*                                                                  */         
  2917.  /* Provided this copyright notice is included, this software may    */         
  2918.  /* be freely distributed and not offered for sale.                  */         
  2919.  /*                                                                  */         
  2920.  /* Changes or modifications may be made and used only by the maker  */         
  2921.  /* of same, and not further distributed.  Such modifications should */         
  2922.  /* be mailed to the author for consideration for addition to the    */         
  2923.  /* software and incorporation in subsequent releases.               */         
  2924.  /*                                                                  */         
  2925.  /********************************************************************/         
  2926.                                                                                 
  2927. #pragma  csect(code,  "GG@CONN ")                                               
  2928. #pragma  csect(static,"GG$CONN ")                                               
  2929. #include "gg.h"                                                                 
  2930.                                                                                 
  2931. #ifdef TCPIPV1                                                                  
  2932. #define REPORT_TCP_ERROR     /* */                                              
  2933. #endif                                                                          
  2934.                                                                                 
  2935. #ifdef TCPIPV2                                                                  
  2936. #define REPORT_TCP_ERROR     tcperror(gp->ggserver)                             
  2937. #endif                                                                          
  2938.                                                                                 
  2939. /****** Internet address formatter. **********************************/         
  2940.                                                                                 
  2941. static void                                                                     
  2942. format_ip_address(ia,is)                                                        
  2943. IPADDRESS   ia;                                                                 
  2944. char       *is;                                                                 
  2945. {                                                                               
  2946.  char *cp = (char *)&ia;                                                        
  2947.                                                                                 
  2948.  sprintf(is,"%d.%d.%d.%d",*cp,*(cp+1),*(cp+2),*(cp+3));                         
  2949.  return;                                                                        
  2950. }                                                                               
  2951.                                                                                 
  2952. /****** Get client hostname and IP address. **************************/         
  2953.                                                                                 
  2954. static Bool                                                                     
  2955. get_client_hostname(gp)                                                         
  2956. Rstruc ggcb *gp;                                                                
  2957. {                                                                               
  2958.  struct hostent    *client_hp;                                                  
  2959.  int                gethostnamerc;                                              
  2960.                                                                                 
  2961.  gethostnamerc = gethostname(gp->client_hostname,MAXHOSTNAMELEN);               
  2962.  if (gethostnamerc < 0) {                                                       
  2963.    fprintf(stderr,"GGMVS: gethostname() failed, don't know my name\n");         
  2964.    return FALSE;                                                                
  2965.  }                                                                              
  2966.                                                                                 
  2967.  client_hp = gethostbyname(gp->client_hostname);                                
  2968.  if (!client_hp) {                                                              
  2969.    fprintf(stderr,"GGMVS: gethostbyname() failed, can't get my name\n");        
  2970.    return FALSE;                                                                
  2971.  }                                                                              
  2972.                                                                                 
  2973.  strcpy(gp->ggclient,gp->client_hostname);                                      
  2974.  strcpy(gp->client_hostname, client_hp->h_name);                                
  2975.  gp->client_ip_address = *(IPADDRESS *)client_hp->h_addr;                       
  2976.                                                                                 
  2977.  return TRUE ;                                                                  
  2978.                                                                                 
  2979. }                                                                               
  2980.                                                                                 
  2981. /****** Connect to news server. **************************************/         
  2982.                                                                                 
  2983. Bool                                                                            
  2984. GGMconn(gp)                                                                     
  2985. Rstruc ggcb *gp;                                                                
  2986. {                                                                               
  2987.  char              *lp;                                                         
  2988.  char              *cp;                                                         
  2989.  struct recvstruct *R;                                                          
  2990.  struct hostent    *server_hp;                                                  
  2991.  struct sockaddr_in bindsock;       /* socket used by bind           */         
  2992.  struct sockaddr_in consock;        /* socket used by connect        */         
  2993.  int                bindsocklen;    /* size of bind socket           */         
  2994.  int                consocklen;     /* size of connect socket        */         
  2995.  int                bindrc;         /* the return code from bind     */         
  2996.  int                connrc;         /* the return code from connect  */         
  2997.  int                ip_part_1;                                                  
  2998.  int                ip_part_2;                                                  
  2999.  int                ip_part_3;                                                  
  3000.  int                ip_part_4;                                                  
  3001.  char               tempdsn[L_tmpnam];                                          
  3002.                                                                                 
  3003.  if (gp->connected_to_server) {                                                 
  3004.    GGMdisc(gp);                /* Disconnect from news server */                
  3005.  }                                                                              
  3006.                                                                                 
  3007.  gp->closing_connection = FALSE;                                                
  3008.                                                                                 
  3009.  if (!*gp->ggserver) {                                                          
  3010.    ERR1(                                                                        
  3011.   "No host server defined in Gopher menu,  Cannot make a connection."           
  3012.        );                                                                       
  3013.    return FALSE;                                                                
  3014.  }                                                                              
  3015.                                                                                 
  3016.  uppercase_in_place(gp->ggserver);                                              
  3017.                                                                                 
  3018.  /* If server is "local hack", then establish local mode,                       
  3019.   * open temporary file and return.                                             
  3020.   */                                                                            
  3021.                                                                                 
  3022.  if (!strcmp(gp->ggserver, LOCAL_HOST_FROB)) {                                  
  3023.                                                                                 
  3024.    if (gp->ginfo->port != GOPHER_PORT_NUMBER) {                                 
  3025.      ERR3("Server name %s is permitted only with port number %d.",              
  3026.           LOCAL_HOST_FROB, GOPHER_PORT_NUMBER);                                 
  3027.      return FALSE;                                                              
  3028.    }                                                                            
  3029.                                                                                 
  3030.    GETMAIN(gp->recvp,struct recvstruct, 1, "local recv struct");                
  3031.    if (!gp->recvp) {                                                            
  3032.      CRIT1("Can't get memory for local host struct");                           
  3033.      return FALSE;                                                              
  3034.    }                                                                            
  3035.    R = gp->recvp;                                                               
  3036.    memset(R,0,sizeof(struct recvstruct));                                       
  3037.                                                                                 
  3038.    if (!tmpnam(tempdsn)) {                                                      
  3039.      CRIT1("Can't create temporary file for local access");                     
  3040.      return FALSE;                                                              
  3041.    }                                                                            
  3042.                                                                                 
  3043.    /* Create temporary file for writing and reading. */                         
  3044.                                                                                 
  3045.    R->outfp = fopen(tempdsn,"w+,type=memory");                                  
  3046.    if (!R->outfp) {                                                             
  3047.      perror(tempdsn);                                                           
  3048.      CRIT1("Can't open temporary file for local access");                       
  3049.      return FALSE;                                                              
  3050.    }                                                                            
  3051.                                                                                 
  3052.    gp->connected_to_server = TRUE;                                              
  3053.    gp->time_to_go_home     = FALSE;                                             
  3054.    gp->connection_broken   = FALSE;                                             
  3055.                                                                                 
  3056.    GGMesrvr(gp);                                                                
  3057.                                                                                 
  3058.    return TRUE;                                                                 
  3059.  }                                                                              
  3060.                                                                                 
  3061.  /* Determine the local path name. Do only if making net conn. */               
  3062.                                                                                 
  3063.  if (!*gp->client_hostname) {                                                   
  3064.                                                                                 
  3065.    if (!get_client_hostname(gp)) return FALSE;                                  
  3066.                                                                                 
  3067.  }                                                                              
  3068.                                                                                 
  3069.  /* Disallow network connections if started up in local mode. */                
  3070.                                                                                 
  3071.  if (gp->local_mode) {                                                          
  3072.    ERR1("Network connections are not allowed in local mode.");                  
  3073.    return FALSE;                                                                
  3074.  }                                                                              
  3075.                                                                                 
  3076.  /* Get server name and address.  */                                            
  3077.                                                                                 
  3078.  if (strchr(gp->ggserver,'.') &&                                                
  3079.      gp->ggserver[strspn(gp->ggserver,".0123456789")] == '\0') {                
  3080.    ip_part_1 = ip_part_2 = ip_part_3 = ip_part_4 = 32767;                       
  3081.    strcpy(gp->server_hostname, gp->ggserver);                                   
  3082.    sscanf(gp->ggserver,"%d.%d.%d.%d",&ip_part_1,                                
  3083.                                      &ip_part_2,                                
  3084.                                      &ip_part_3,                                
  3085.                                      &ip_part_4);                               
  3086.    if (ip_part_1 > 255 ||                                                       
  3087.        ip_part_2 > 255 ||                                                       
  3088.        ip_part_3 > 255 ||                                                       
  3089.        ip_part_4 > 255) {                                                       
  3090.      ERR2("Syntax error in server network address: %s", gp->ggserver);          
  3091.      return FALSE;                                                              
  3092.    }                                                                            
  3093.    gp->server_ip_address = (IPADDRESS) ((ip_part_1 << 24) +                     
  3094.                                         (ip_part_2 << 16) +                     
  3095.                                         (ip_part_3 <<  8) +                     
  3096.                                         (ip_part_4      ));                     
  3097.  }                                                                              
  3098.  else {                                                                         
  3099.    server_hp = gethostbyname(gp->ggserver);                                     
  3100.    if (!server_hp) {                                                            
  3101.      ERR2(                                                                      
  3102. "Unknown host %s - gethostbyname() could not resolve the server name.",         
  3103.           gp->ggserver);                                                        
  3104.      return FALSE;                                                              
  3105.    }                                                                            
  3106.    strcpy(gp->server_hostname, server_hp->h_name);                              
  3107.    gp->server_ip_address = *(IPADDRESS *)server_hp->h_addr;                     
  3108.  }                                                                              
  3109.                                                                                 
  3110.  format_ip_address(gp->server_ip_address, gp->server_ip_addrstr);               
  3111.  format_ip_address(gp->client_ip_address, gp->client_ip_addrstr);               
  3112.                                                                                 
  3113.  (void)GGMivput(gp,"GGSERVER ",gp->ggserver,-1);                                
  3114.  (void)GGMivput(gp,"GGSERVIP ",gp->server_ip_addrstr,-1);                       
  3115.  (void)GGMivput(gp,"GGCLIENT ",gp->ggclient,-1);                                
  3116.  (void)GGMivput(gp,"GGCLIEIP ",gp->client_ip_addrstr,-1);                       
  3117.                                                                                 
  3118.  consock.sin_family       = AF_INET;                                            
  3119.  consock.sin_port         = htons(gp->ginfo->port);                             
  3120.  consock.sin_addr.s_addr  = gp->server_ip_address;                              
  3121.                                                                                 
  3122.  bindsock.sin_family      = AF_INET;                                            
  3123.  bindsock.sin_port        = 0;                                                  
  3124.  bindsock.sin_addr.s_addr = gp->client_ip_address;                              
  3125.                                                                                 
  3126.  gp->socknum = socket(AF_INET, SOCK_STREAM, 0);                                 
  3127.  if (gp->socknum < 0) {                                                         
  3128.    REPORT_TCP_ERROR;                                                            
  3129.    ERR2("TCP/IP error: socket() failed to make socket for server %s.",          
  3130.         gp->ggserver);                                                          
  3131.    return FALSE;                                                                
  3132.  }                                                                              
  3133.                                                                                 
  3134.  bindsocklen = sizeof(bindsock);                                                
  3135.  bindrc = bind(gp->socknum, &bindsock, bindsocklen);                            
  3136.  if (bindrc < 0) {                                                              
  3137.    REPORT_TCP_ERROR;                                                            
  3138.    ERR2("TCP/IP error: bind() failed to bind socket for server %s.",            
  3139.         gp->ggserver);                                                          
  3140.    return FALSE;                                                                
  3141.  }                                                                              
  3142.                                                                                 
  3143.  (void)GGMispf(gp,"CONTROL DISPLAY LOCK");                                      
  3144.  (void)GGMispf(gp,"DISPLAY PANEL(GGMLCONN)");                                   
  3145.                                                                                 
  3146.  if (gp->debug_file) {                                                          
  3147.    fprintf(gp->debug_file,                                                      
  3148.            "Client %s (%s) connecting to GOPHER server on %s (%s)\n",           
  3149.            gp->client_hostname,                                                 
  3150.            gp->client_ip_addrstr,                                               
  3151.            gp->server_hostname,                                                 
  3152.            gp->server_ip_addrstr);                                              
  3153.  }                                                                              
  3154.                                                                                 
  3155.  consocklen = sizeof(consock);                                                  
  3156.  connrc = connect(gp->socknum, &consock, consocklen);                           
  3157.                                                                                 
  3158.  if (connrc < 0) {                                                              
  3159.    REPORT_TCP_ERROR;                                                            
  3160.    ERR2("TCP/IP failure: connect() failed to connect to server %s.",            
  3161.         gp->ggserver);                                                          
  3162.    return FALSE;                                                                
  3163.  }                                                                              
  3164.                                                                                 
  3165.  gp->connected_to_server = TRUE;                                                
  3166.  gp->time_to_go_home     = FALSE;                                               
  3167.  gp->connection_broken   = FALSE;                                               
  3168.                                                                                 
  3169.  /* Clean up any stray responses from server. */                                
  3170.                                                                                 
  3171.  GGMesrvr(gp);                             /* End server read */                
  3172.                                                                                 
  3173.  return TRUE;                                                                   
  3174.                                                                                 
  3175. }                                                                               
  3176.                                                                                 
  3177. ./   ADD NAME=GGMDFAIL,SSI=01000005                                             
  3178.                                                                                 
  3179.  /********************************************************************/         
  3180.  /*                                                                  */         
  3181.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3182.  /*                                                                  */         
  3183.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3184.  /*                                                                  */         
  3185.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3186.  /* including the implied warranties of merchantability and fitness, */         
  3187.  /* are expressly denied.                                            */         
  3188.  /*                                                                  */         
  3189.  /* Provided this copyright notice is included, this software may    */         
  3190.  /* be freely distributed and not offered for sale.                  */         
  3191.  /*                                                                  */         
  3192.  /* Changes or modifications may be made and used only by the maker  */         
  3193.  /* of same, and not further distributed.  Such modifications should */         
  3194.  /* be mailed to the author for consideration for addition to the    */         
  3195.  /* software and incorporation in subsequent releases.               */         
  3196.  /*                                                                  */         
  3197.  /********************************************************************/         
  3198.                                                                                 
  3199. #pragma  csect(code,  "GG@DFAIL")                                               
  3200. #pragma  csect(static,"GG$DFAIL")                                               
  3201. #include "gg.h"                                                                 
  3202.                                                                                 
  3203. /****** Retrieve allocation failure messages. ************************/         
  3204.                                                                                 
  3205. void                                                                            
  3206. GGMdfail(rc,p99)                                                                
  3207. int            rc;                                                              
  3208. __S99parms    *p99;                                                             
  3209. {                                                                               
  3210.  int           zero = 0;                                                        
  3211.  unsigned int  dfid = 0x40320000;                                               
  3212.  struct {                                                                       
  3213.          short first_level_msg_len;                                             
  3214.          short first_level_msg_offset;                                          
  3215.          char  first_level_msg[251];                                            
  3216.          short second_level_msg_len;                                            
  3217.          short second_level_msg_offset;                                         
  3218.          char  second_level_msg[251];                                           
  3219.         }      dfbuffer;                                                        
  3220.                                                                                 
  3221.  static int (*ikjeff18_pointer)() = NULL;                                       
  3222.                                                                                 
  3223. #ifndef FETCH                                                                   
  3224.  extern int *ikjeff18();                                                        
  3225. #endif                                                                          
  3226.                                                                                 
  3227.  if (!ikjeff18_pointer) {                                                       
  3228. #ifdef FETCH                                                                    
  3229.    ikjeff18_pointer = (int (*)())fetch("IKJEFF18");                             
  3230. #else                                                                           
  3231.    ikjeff18_pointer = (int (*)())ikjeff18;                                      
  3232. #endif                                                                          
  3233.  }                                                                              
  3234.                                                                                 
  3235.  dfbuffer.first_level_msg_len = 4;                                              
  3236.  dfbuffer.second_level_msg_len = 4;                                             
  3237.                                                                                 
  3238.  if (ikjeff18_pointer) {                                                        
  3239.    if ((*ikjeff18_pointer)(p99,&rc,&zero,&dfid,&zero,&dfbuffer)) {              
  3240.      fprintf(stderr,"IKJEFF18 returned a nonzero return code\n");               
  3241.    }                                                                            
  3242.    if (dfbuffer.first_level_msg_len > 0) {                                      
  3243.      fprintf(stderr,"%*.*s\n",                                                  
  3244.                     dfbuffer.first_level_msg_len-4,                             
  3245.                     dfbuffer.first_level_msg_len-4,                             
  3246.                     dfbuffer.first_level_msg);                                  
  3247.    }                                                                            
  3248.    if (dfbuffer.second_level_msg_len > 0) {                                     
  3249.      fprintf(stderr,"%*.*s\n",                                                  
  3250.                     dfbuffer.second_level_msg_len-4,                            
  3251.                     dfbuffer.second_level_msg_len-4,                            
  3252.                     dfbuffer.second_level_msg);                                 
  3253.    }                                                                            
  3254.  }                                                                              
  3255.  else {                                                                         
  3256. #ifdef FETCH                                                                    
  3257.    fprintf(stderr,"GGMVS: Cannot fetch IKJEFF18\n");                            
  3258. #else                                                                           
  3259.    fprintf(stderr,"Cannot call IKJEFF18, not linked with GGMVS\n");             
  3260. #endif                                                                          
  3261.  }                                                                              
  3262.  return;                                                                        
  3263. }                                                                               
  3264.                                                                                 
  3265. ./   ADD NAME=GGMDIR,SSI=01280045                                               
  3266.                                                                                 
  3267.  /********************************************************************/         
  3268.  /*                                                                  */         
  3269.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3270.  /*                                                                  */         
  3271.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3272.  /*                                                                  */         
  3273.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3274.  /* including the implied warranties of merchantability and fitness, */         
  3275.  /* are expressly denied.                                            */         
  3276.  /*                                                                  */         
  3277.  /* Provided this copyright notice is included, this software may    */         
  3278.  /* be freely distributed and not offered for sale.                  */         
  3279.  /*                                                                  */         
  3280.  /* Changes or modifications may be made and used only by the maker  */         
  3281.  /* of same, and not further distributed.  Such modifications should */         
  3282.  /* be mailed to the author for consideration for addition to the    */         
  3283.  /* software and incorporation in subsequent releases.               */         
  3284.  /*                                                                  */         
  3285.  /********************************************************************/         
  3286.                                                                                 
  3287. #pragma  csect(code,  "GG@DIR  ")                                               
  3288. #pragma  csect(static,"GG$DIR  ")                                               
  3289. #include "gg.h"                                                                 
  3290.                                                                                 
  3291. /*********************************************************************/         
  3292.                                                                                 
  3293. static Bool                                                                     
  3294. valid_code(c)                                                                   
  3295. char       c;                                                                   
  3296. {                                                                               
  3297.                                                                                 
  3298.  switch (c) {                                                                   
  3299.    case GOPHER_FILE:                                                            
  3300.    case GOPHER_DIRECTORY:                                                       
  3301.    case GOPHER_TELNET:                                                          
  3302.    case GOPHER_WAIS:                                                            
  3303.    case GOPHER_WHOIS:                                                           
  3304.                            return TRUE;                                         
  3305.    default:                return FALSE;                                        
  3306.   }                                                                             
  3307.                                                                                 
  3308. }                                                                               
  3309.                                                                                 
  3310. /*********************************************************************/         
  3311.                                                                                 
  3312. static Bool                                                                     
  3313. process_s_selection(gp,ip)                                                      
  3314. Rstruc ggcb           *gp;                                                      
  3315. Rstruc gopherinfo     *ip;                                                      
  3316. {                                                                               
  3317.                                                                                 
  3318.  GGMgofor(gp,ip,FALSE);                                                         
  3319.                                                                                 
  3320.  return TRUE;                                                                   
  3321. }                                                                               
  3322.                                                                                 
  3323. /*********************************************************************/         
  3324.                                                                                 
  3325. static Bool                                                                     
  3326. process_e_selection(gp,ip)                                                      
  3327. Rstruc ggcb           *gp;                                                      
  3328. Rstruc gopherinfo     *ip;                                                      
  3329. {                                                                               
  3330.                                                                                 
  3331.  if (ip->thdr.first_text_line) {                                                
  3332.    GGMxtx(gp,ip);                                                               
  3333.    return TRUE;                                                                 
  3334.  }                                                                              
  3335.  else {                                                                         
  3336.    ERR1("Extract must be preceded by Select.");                                 
  3337.    return FALSE;                                                                
  3338.  }                                                                              
  3339. }                                                                               
  3340.                                                                                 
  3341. /*********************************************************************/         
  3342.                                                                                 
  3343. static Bool                                                                     
  3344. process_q_selection(gp,ip)                                                      
  3345. Rstruc ggcb           *gp;                                                      
  3346. Rstruc gopherinfo     *ip;                                                      
  3347. {                                                                               
  3348.                                                                                 
  3349.  GGMgofor(gp,ip,TRUE);                                                          
  3350.                                                                                 
  3351.  return TRUE;                                                                   
  3352. }                                                                               
  3353.                                                                                 
  3354. /*********************************************************************/         
  3355.                                                                                 
  3356. static Bool                                                                     
  3357. display_dynamic_area(gp,ip,infoarray,entrycount)                                
  3358. Rstruc ggcb           *gp;                                                      
  3359. Rstruc gopherinfo     *ip;                                                      
  3360. Rstruc gopherinfo     *infoarray;                                               
  3361. int                    entrycount;                                              
  3362. {                                                                               
  3363.  struct gopherinfo    *iap;                                                     
  3364.  int                   depth;                                                   
  3365.  int                   ggglvl;                                                  
  3366.  int                   dynsize;                                                 
  3367.  int                   topitem;                                                 
  3368.  int                   bottomitem;                                              
  3369.  int                   last_item_selected;                                      
  3370.  int                   dti;                                                     
  3371.  int                   gii;                                                     
  3372.  int                   l;                                                       
  3373.  int                   prc;                                                     
  3374.  int                   command_index;                                           
  3375.  int                   zscrolln;                                                
  3376.  Bool                  selection_processed_ok;                                  
  3377.  Bool                  command_processed_ok;                                    
  3378.  Bool                  is_max;                                                  
  3379.  char                 *gggdyna;                                                 
  3380.  char                 *rowp;                                                    
  3381.  char                 *cp;                                                      
  3382.  char                  gggcmd     [72];                                         
  3383.  char                  zverb       [9];                                         
  3384.  char                  zscrolla    [9];                                         
  3385.  char                  command    [COMMANDSIZE];                                
  3386.  char                  ggghead    [81];                                         
  3387.  char                  rowmessage [81];                                         
  3388.                                                                                 
  3389.  /* Get depth of dynamic area (number of rows to display on screen) */          
  3390.                                                                                 
  3391.  (void)GGMispf(gp,                                                              
  3392.        "PQUERY PANEL(GGMDIR) AREANAME(GGGDYNA) DEPTH(GGGDEPTH)");               
  3393.  if (gp->ispfrc != 0) return FALSE;                                             
  3394.  depth = GGMiget(gp,"GGGDEPTH ");                                               
  3395.                                                                                 
  3396.  /* Get storage for ISPF dynamic area variable to be constructed. */            
  3397.                                                                                 
  3398.  dynsize = 80*depth;                                                            
  3399.  GETMAIN(gggdyna, char, dynsize, "GGGDYNA buffer");                             
  3400.  if (!gggdyna) return FALSE;                                                    
  3401.                                                                                 
  3402.  /* Loop displaying the panel until END pressed. */                             
  3403.                                                                                 
  3404.  topitem = 0;                                                                   
  3405.  last_item_selected = -1;                                                       
  3406.  strcpy(gggcmd,"");                                                             
  3407.                                                                                 
  3408.  do {                                                                           
  3409.                                                                                 
  3410.  /* Fill in the dynamic area with rows, one for each gopher item. */            
  3411.                                                                                 
  3412.    memset(gggdyna,' ',dynsize);                                                 
  3413.                                                                                 
  3414.    for (dti = 0,       gii = topitem,     rowp = gggdyna;                       
  3415.         dti < depth && gii < entrycount;                                        
  3416.         dti++,         gii++,             rowp += 80) {                         
  3417.      iap = &infoarray[gii];                                                     
  3418.      rowp[ 0] = DATAIN_HIGH;             /* selection code attribute */         
  3419.      rowp[ 1] = ' ';                     /* selection code field     */         
  3420.      rowp[ 2] = DATAOUT_GREEN;           /* icon attribute           */         
  3421.      memcpy(&rowp[ 3],GGMtype(iap->type),9);                                    
  3422.      rowp[12] = DATAOUT_HIGH;            /* description attribute    */         
  3423.      l = strlen(iap->desc);                                                     
  3424.      memcpy(&rowp[13],iap->desc,l > 67 ? 67 : l);                               
  3425.    }                                                                            
  3426.                                                                                 
  3427.    if (rowp < gggdyna + dynsize) {                                              
  3428.      rowp[0] = DATAOUT_HIGH;                                                    
  3429.      memset(&rowp[1], '-',79);                                                  
  3430.    }                                                                            
  3431.                                                                                 
  3432.    bottomitem = gii - 1;                                                        
  3433.                                                                                 
  3434.    if (topitem > bottomitem) strcpy(rowmessage,"");                             
  3435.    else sprintf(rowmessage, " %d-%d of %d",                                     
  3436.                        topitem + 1, bottomitem + 1, entrycount);                
  3437.                                                                                 
  3438.    memset(ggghead,' ',79);                                                      
  3439.    ggghead[79] = '\0';                                                          
  3440.    strcpy(ggghead,"GOPHER - ");                                                 
  3441.    strncpy(ggghead+9,ip->desc,70);                                              
  3442.    *strchr(ggghead,'\0') = ' ';                                                 
  3443.    memcpy(ggghead+79-strlen(rowmessage),rowmessage,strlen(rowmessage));         
  3444.                                                                                 
  3445.    (void)GGMivput(gp,"GGGHEAD ",ggghead,79);                                    
  3446.    (void)GGMivput(gp,"GGGDYNA ",gggdyna, dynsize);                              
  3447.    (void)GGMivput(gp,"GGGCMD " ,gggcmd,  -1);                                   
  3448.                                                                                 
  3449.    prc = GGMdispl(gp,"GGMDIR  ");                                               
  3450.    if (prc > 8) break;                                                          
  3451.                                                                                 
  3452.    (void)GGMivget(gp,"GGGDYNA " , gggdyna,  dynsize);                           
  3453.    (void)GGMivget(gp,"ZVERB "   , zverb,    sizeof(zverb));                     
  3454.    (void)GGMivget(gp,"ZSCROLLA ", zscrolla, sizeof(zscrolla));                  
  3455.    zscrolln = GGMiget(gp,"ZSCROLLN ");                                          
  3456.    ggglvl   = GGMiget(gp,"GGGLVL ");                                            
  3457.    last_item_selected = -1;                                                     
  3458.                                                                                 
  3459.    /* Process selections. */                                                    
  3460.                                                                                 
  3461.    for (gii = topitem,         rowp = gggdyna;                                  
  3462.         gii <= bottomitem;                                                      
  3463.         gii++,                 rowp += 80) {                                    
  3464.      iap = &infoarray[gii];                                                     
  3465.      switch (rowp[1]) {                                                         
  3466.        case ' ':  continue;                                                     
  3467.        case 's':                                                                
  3468.        case 'S':  selection_processed_ok = process_s_selection(gp,iap);         
  3469.                   break;                                                        
  3470.        case 'e':                                                                
  3471.        case 'E':  selection_processed_ok = process_e_selection(gp,iap);         
  3472.                   break;                                                        
  3473.        case 'q':                                                                
  3474.        case 'Q':  selection_processed_ok = process_q_selection(gp,iap);         
  3475.                   break;                                                        
  3476.        default:                                                                 
  3477.         ERR1("Unknown selection code.  Type one of the listed codes.");         
  3478.                   selection_processed_ok = FALSE;                               
  3479.                   break;                                                        
  3480.      }                                                                          
  3481.      if (selection_processed_ok) last_item_selected = gii;                      
  3482.      if (gp->quit) break;                                                       
  3483.    }                                                                            
  3484.                                                                                 
  3485.    /* Process command if any. */                                                
  3486.                                                                                 
  3487.    strcpy(gggcmd,"");                                                           
  3488.                                                                                 
  3489.    (void)GGMivget(gp,"GGGCMD ",gggcmd,sizeof(gggcmd));                          
  3490.                                                                                 
  3491.    if (*gggcmd) {                                                               
  3492.                                                                                 
  3493.      memset(command,' ',COMMANDSIZE);                                           
  3494.      command_index = 0;                                                         
  3495.      for (cp = gggcmd; *cp && !isspace(*cp); cp++) {                            
  3496.        if (cp >= gggcmd+COMMANDSIZE) {                                          
  3497.          ERR1("Invalid command name.");                                         
  3498.          command_processed_ok = FALSE;                                          
  3499.        }                                                                        
  3500.        command[command_index++] = toupper(*cp);                                 
  3501.      }                                                                          
  3502.      while (*cp && isspace(*cp)) cp++;                                          
  3503.                                                                                 
  3504.      if (memcmp(command,"QUIT    ",8) == 0) {                                   
  3505.        gp->quit = TRUE;                                                         
  3506.      }                                                                          
  3507.      else {                                                                     
  3508.        ERR2("Unknown command name: %8.8s",command);                             
  3509.      }                                                                          
  3510.      command_processed_ok = FALSE;                                              
  3511.                                                                                 
  3512.      if (command_processed_ok) strcpy(gggcmd,"");                               
  3513.                                                                                 
  3514.    }                                                                            
  3515.                                                                                 
  3516.    if (gp->quit) break;                                                         
  3517.                                                                                 
  3518.    if (last_item_selected >= 0 && gp->autoscroll) {                             
  3519.      topitem = last_item_selected;                                              
  3520.    }                                                                            
  3521.                                                                                 
  3522.    /* Process scroll request if any. */                                         
  3523.                                                                                 
  3524.    is_max = EQUAL(zscrolla,"MAX");                                              
  3525.    if      (EQUAL(zverb,"DOWN")) {                                              
  3526.      if (is_max) topitem = entrycount - ggglvl;                                 
  3527.      else        topitem += zscrolln;                                           
  3528.    }                                                                            
  3529.    else if (EQUAL(zverb,"UP")) {                                                
  3530.      if (is_max) topitem = 0;                                                   
  3531.      else        topitem -= zscrolln;                                           
  3532.    }                                                                            
  3533.    else if (EQUAL(zverb,"RETURN")) {                                            
  3534.      gp->quit = TRUE;                                                           
  3535.      break;                                                                     
  3536.    }                                                                            
  3537.    if (topitem < 0)                                                             
  3538.        topitem = 0;                                                             
  3539.    if (topitem > entrycount)                                                    
  3540.        topitem = entrycount;                                                    
  3541.                                                                                 
  3542.  } while (prc == 0);                                                            
  3543.                                                                                 
  3544.  return;                                                                        
  3545.                                                                                 
  3546. }                                                                               
  3547.                                                                                 
  3548. /****** Gopher a directory. ******************************************/         
  3549.                                                                                 
  3550. Bool                                                                            
  3551. GGMdir(gp,ip,as_file)                                                           
  3552. Rstruc ggcb        *gp;                                                         
  3553. Rstruc gopherinfo  *ip;                                                         
  3554. Fool                as_file;                                                    
  3555. {                                                                               
  3556.  int                entrycount;                                                 
  3557.  int                i;                                                          
  3558.  int                copysize;                                                   
  3559.  char               typechar;                                                   
  3560.  char               savechar;                                                   
  3561.  char              *p;                                                          
  3562.  char              *q;                                                          
  3563.  char              *r;                                                          
  3564.  struct textline   *tp;                                                         
  3565.  struct gopherinfo *infoarray;                                                  
  3566.  struct gopherinfo *iap;                                                        
  3567.  char               temp[16];                                                   
  3568.                                                                                 
  3569.  if (as_file) {                                                                 
  3570.    GGMvtx(gp,ip,as_file);  /* if as a file, display text as is */               
  3571.    return TRUE;                                                                 
  3572.  }                                                                              
  3573.                                                                                 
  3574.  /* The text chain contains the data from the server, which should be           
  3575.   * in the following format:                                                    
  3576.   *                                                                             
  3577.   * nDescription^Path^foo^bar                                                   
  3578.   *                                                                             
  3579.   * where the "n" in the beginning is a digit and ^ means a tab char.           
  3580.   *                                                                             
  3581.   * Logic:                                                                      
  3582.   *                                                                             
  3583.   * Build an array of gopherinfo structs from the text records.                 
  3584.   *                                                                             
  3585.   * Display them as an ISPF dynamic area pseudotable.                           
  3586.   *                                                                             
  3587.   * Let the user select them, and run GGMgofor on each one                      
  3588.   * with a struct gopherinfo built from the contents.                           
  3589.   *                                                                             
  3590.   */                                                                            
  3591.                                                                                 
  3592.  /* Determine size of array of gopherinfo structs.  This is equal to            
  3593.   * the number of text records with a valid code in the first byte.             
  3594.   */                                                                            
  3595.                                                                                 
  3596.  entrycount = 0;                                                                
  3597.  for (tp = ip->thdr.first_text_line; tp; tp = tp->next) {                       
  3598.    if (valid_code(tp->text[0])) entrycount++;                                   
  3599.  }                                                                              
  3600.                                                                                 
  3601.  if (entrycount == 0) {                                                         
  3602.    ERR1("There seems to be no information in this directory.\n");               
  3603.    return FALSE;                                                                
  3604.  }                                                                              
  3605.                                                                                 
  3606.  /* Allocate an array of structs to hold the stuff. */                          
  3607.                                                                                 
  3608.  GETMAIN(infoarray, struct gopherinfo, entrycount,"gopherinfo array");          
  3609.                                                                                 
  3610.  if (!infoarray) {                                                              
  3611.    ERR2("Not enough memory for %d gopher directory entries\n",                  
  3612.         entrycount);                                                            
  3613.    return FALSE;                                                                
  3614.  }                                                                              
  3615.                                                                                 
  3616.  /* Build the array entries. */                                                 
  3617.                                                                                 
  3618.  iap = infoarray;                                                               
  3619.  for (tp = ip->thdr.first_text_line; tp; tp = tp->next) {                       
  3620.    typechar = tp->text[0];                                                      
  3621.    if (valid_code(typechar)) {                                                  
  3622.      r = &tp->text[tp->text_length];                                            
  3623.      savechar = *r;                                                             
  3624.      *r = '\t';                                                                 
  3625.      memset(iap,0,sizeof(struct gopherinfo));                                   
  3626.      iap->port = GOPHER_PORT_NUMBER;                                            
  3627.      iap->type = (gophertype)typechar;                                          
  3628.      p = &tp->text[1];                                                          
  3629.      q = strchr(p,'\t');                                                        
  3630.      copysize = sizeof(iap->desc)-1;                                            
  3631.      if (copysize > q-p) copysize = q-p;                                        
  3632.      memcpy(iap->desc,p,copysize);                                              
  3633.      if (q < r) {                                                               
  3634.        p = q+1;                                                                 
  3635.        q = strchr(p,'\t');                                                      
  3636.        copysize = sizeof(iap->path)-1;                                          
  3637.        if (copysize > q-p) copysize = q-p;                                      
  3638.        memcpy(iap->path,p,copysize);                                            
  3639.        if (q < r) {                                                             
  3640.          p = q+1;                                                               
  3641.          q = strchr(p,'\t');                                                    
  3642.          copysize = sizeof(iap->host)-1;                                        
  3643.          if (copysize > q-p) copysize = q-p;                                    
  3644.          memcpy(iap->host,p,copysize);                                          
  3645.          if (q < r) {                                                           
  3646.            p = q+1;                                                             
  3647.            q = strchr(p,'\t');                                                  
  3648.            memset(temp,0,sizeof(temp));                                         
  3649.            copysize = sizeof(temp)-1;                                           
  3650.            if (copysize > q-p) copysize = q-p;                                  
  3651.            memcpy(temp,p,copysize);                                             
  3652.            iap->port = atoi(temp);                                              
  3653.          }                                                                      
  3654.        }                                                                        
  3655.      }                                                                          
  3656.      *r = savechar;                                                             
  3657.      iap++;                                                                     
  3658.    }                                                                            
  3659.  }                                                                              
  3660.                                                                                 
  3661.  if (gp->debug_mode) {                                                          
  3662.    for (iap = infoarray, i = entrycount; i > 0; iap++, i--) {                   
  3663.      fprintf(gp->debug_file,"GGMdir: type = %d\n",iap->type);                   
  3664.      fprintf(gp->debug_file,"GGMdir: port = %d\n",iap->port);                   
  3665.      fprintf(gp->debug_file,"GGMdir: path = %s\n",iap->path);                   
  3666.      fprintf(gp->debug_file,"GGMdir: host = %s\n",iap->host);                   
  3667.      fprintf(gp->debug_file,"GGMdir: desc = %s\n",iap->desc);                   
  3668.      fprintf(gp->debug_file,"\n");                                              
  3669.    }                                                                            
  3670.  }                                                                              
  3671.                                                                                 
  3672.  display_dynamic_area(gp,ip,infoarray,entrycount);                              
  3673.                                                                                 
  3674.  FREEMAIN(infoarray,"gopherinfo array");                                        
  3675.                                                                                 
  3676.  return TRUE;                                                                   
  3677. }                                                                               
  3678.                                                                                 
  3679. ./   ADD NAME=GGMDISC,SSI=01050033                                              
  3680.                                                                                 
  3681.  /********************************************************************/         
  3682.  /*                                                                  */         
  3683.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3684.  /*                                                                  */         
  3685.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3686.  /*                                                                  */         
  3687.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3688.  /* including the implied warranties of merchantability and fitness, */         
  3689.  /* are expressly denied.                                            */         
  3690.  /*                                                                  */         
  3691.  /* Provided this copyright notice is included, this software may    */         
  3692.  /* be freely distributed and not offered for sale.                  */         
  3693.  /*                                                                  */         
  3694.  /* Changes or modifications may be made and used only by the maker  */         
  3695.  /* of same, and not further distributed.  Such modifications should */         
  3696.  /* be mailed to the author for consideration for addition to the    */         
  3697.  /* software and incorporation in subsequent releases.               */         
  3698.  /*                                                                  */         
  3699.  /********************************************************************/         
  3700.                                                                                 
  3701. #pragma  csect(code,  "GG@DISC ")                                               
  3702. #pragma  csect(static,"GG$DISC ")                                               
  3703. #include "gg.h"                                                                 
  3704.                                                                                 
  3705. /****** Disconnect from gopher server. ********************************/        
  3706.                                                                                 
  3707. void                                                                            
  3708. GGMdisc(gp)                                                                     
  3709. Rstruc ggcb        *gp;                                                         
  3710. {                                                                               
  3711.  int                closerc;                                                    
  3712.  struct recvstruct *R;                                                          
  3713.                                                                                 
  3714.  /* If local mode, close temporary file and return. */                          
  3715.                                                                                 
  3716.  if ((R=gp->recvp)) {                                                           
  3717.    if (R->outfp) {                                                              
  3718.      if (fclose(R->outfp) < 0) {                                                
  3719.        CRIT1("Error closing local mode temporary file");                        
  3720.      }                                                                          
  3721.      R->outfp = NULL;                                                           
  3722.    }                                                                            
  3723.                                                                                 
  3724.    gp->connected_to_server   = FALSE;                                           
  3725.                                                                                 
  3726.    FREEMAIN(gp->recvp,"local mode recv struct");                                
  3727.    gp->recvp = NULL;                                                            
  3728.    return;                                                                      
  3729.  }                                                                              
  3730.                                                                                 
  3731.  gp->reconnect_in_progress = FALSE;                                             
  3732.  gp->closing_connection    = TRUE;                                              
  3733.                                                                                 
  3734.  if (gp->connection_broken) {                                                   
  3735.    if (gp->debug_file) {                                                        
  3736.      fprintf(gp->debug_file,                                                    
  3737.   "Client %s (%s) connection with gopher server on %s (%s) was lost\n",         
  3738.           gp->client_hostname,                                                  
  3739.           gp->client_ip_addrstr,                                                
  3740.           gp->server_hostname,                                                  
  3741.           gp->server_ip_addrstr);                                               
  3742.    }                                                                            
  3743.    gp->connected_to_server   = FALSE;                                           
  3744.  }                                                                              
  3745.  else {                                                                         
  3746.                                                                                 
  3747.    /* In case of some kind of protocol error, don't let things hang. */         
  3748.                                                                                 
  3749.    GGMesrvr(gp);         /* End server read */                                  
  3750.                                                                                 
  3751.    if (gp->debug_file) {                                                        
  3752.      fprintf(gp->debug_file,                                                    
  3753.       "Client %s (%s) disconnecting from gopher server on %s (%s)\n",           
  3754.           gp->client_hostname,                                                  
  3755.           gp->client_ip_addrstr,                                                
  3756.           gp->server_hostname,                                                  
  3757.           gp->server_ip_addrstr);                                               
  3758.    }                                                                            
  3759.                                                                                 
  3760.    (void)GGMivput(gp,"GGSOLDER ",gp->server_hostname,-1);                       
  3761.    (void)GGMivput(gp,"GGSOLDIP ",gp->server_ip_addrstr,-1);                     
  3762.    (void)GGMispf(gp,"CONTROL DISPLAY LOCK");                                    
  3763.    (void)GGMispf(gp,"DISPLAY PANEL(GGMLDISC)");                                 
  3764.                                                                                 
  3765.    /* In case of some kind of protocol error, don't let things hang. */         
  3766.                                                                                 
  3767.    GGMesrvr(gp);                   /* End server read */                        
  3768.                                                                                 
  3769.    gp->connected_to_server   = FALSE;                                           
  3770.                                                                                 
  3771.    TCP_DEBUG_ON;                                                                
  3772.    closerc = close(gp->socknum);                                                
  3773.    TCP_DEBUG_OFF;                                                               
  3774.                                                                                 
  3775.    if (closerc < 0) {                                                           
  3776.      ERR2("TCP/IP error: close() failed to disconnect from server %s.",         
  3777.           gp->ggserver);                                                        
  3778.    }                                                                            
  3779.  }                                                                              
  3780.                                                                                 
  3781.  return;                                                                        
  3782. }                                                                               
  3783.                                                                                 
  3784. ./   ADD NAME=GGMDISPL,SSI=01000005                                             
  3785.                                                                                 
  3786.  /********************************************************************/         
  3787.  /*                                                                  */         
  3788.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3789.  /*                                                                  */         
  3790.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3791.  /*                                                                  */         
  3792.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3793.  /* including the implied warranties of merchantability and fitness, */         
  3794.  /* are expressly denied.                                            */         
  3795.  /*                                                                  */         
  3796.  /* Provided this copyright notice is included, this software may    */         
  3797.  /* be freely distributed and not offered for sale.                  */         
  3798.  /*                                                                  */         
  3799.  /* Changes or modifications may be made and used only by the maker  */         
  3800.  /* of same, and not further distributed.  Such modifications should */         
  3801.  /* be mailed to the author for consideration for addition to the    */         
  3802.  /* software and incorporation in subsequent releases.               */         
  3803.  /*                                                                  */         
  3804.  /********************************************************************/         
  3805.                                                                                 
  3806.  /********************************************************************/         
  3807.                                                                                 
  3808. #pragma  csect(code,  "GG@DISPL")                                               
  3809. #pragma  csect(static,"GG$DISPL")                                               
  3810. #include "gg.h"                                                                 
  3811.                                                                                 
  3812. #define VL_BIT(X) ((unsigned int)(X) | 0x80000000)                              
  3813.                                                                                 
  3814. /****** Display ISPF panel. ******************************************/         
  3815.                                                                                 
  3816. int                                                                             
  3817. GGMdispl(gp,pan8)                                                               
  3818. Rstruc ggcb    *gp;                                                             
  3819. char           *pan8;                                                           
  3820. {                                                                               
  3821.                                                                                 
  3822.  if (gp->setmsg) {                                                              
  3823.    gp->ispfrc = ISPLINK("DISPLAY ", pan8, VL_BIT("ISRZ002 "));                  
  3824.  }                                                                              
  3825.  else {                                                                         
  3826.    gp->ispfrc = ISPLINK("DISPLAY ", VL_BIT(pan8));                              
  3827.  }                                                                              
  3828.                                                                                 
  3829.  if (gp->ispfrc > 8) GGMierr(gp);   /* display ISPF error */                    
  3830.                                                                                 
  3831.  gp->setmsg = FALSE;                                                            
  3832.                                                                                 
  3833.  return gp->ispfrc;                                                             
  3834. }                                                                               
  3835.                                                                                 
  3836. ./   ADD NAME=GGMDUMP,SSI=01000036                                              
  3837.                                                                                 
  3838.  /********************************************************************/         
  3839.  /*                                                                  */         
  3840.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3841.  /*                                                                  */         
  3842.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3843.  /*                                                                  */         
  3844.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3845.  /* including the implied warranties of merchantability and fitness, */         
  3846.  /* are expressly denied.                                            */         
  3847.  /*                                                                  */         
  3848.  /* Provided this copyright notice is included, this software may    */         
  3849.  /* be freely distributed and not offered for sale.                  */         
  3850.  /*                                                                  */         
  3851.  /* Changes or modifications may be made and used only by the maker  */         
  3852.  /* of same, and not further distributed.  Such modifications should */         
  3853.  /* be mailed to the author for consideration for addition to the    */         
  3854.  /* software and incorporation in subsequent releases.               */         
  3855.  /*                                                                  */         
  3856.  /********************************************************************/         
  3857.                                                                                 
  3858. #pragma  csect(code,  "GG@DUMP ")                                               
  3859. #pragma  csect(static,"GG$DUMP ")                                               
  3860. #include "gg.h"                                                                 
  3861.                                                                                 
  3862. /****** Dump some data. **********************************************/         
  3863.                                                                                 
  3864. void                                                                            
  3865. GGMdump(struct ggcb *gp, char *label, char *p,int r)                            
  3866. {                                                                               
  3867.  int i;                                                                         
  3868.                                                                                 
  3869.  if (!gp->debug_file) return;                                                   
  3870.                                                                                 
  3871.  if (r == -2) {                                                                 
  3872.    fprintf(gp->debug_file,"%s:  %d\n",label,(int)p);                            
  3873.    return;                                                                      
  3874.  }                                                                              
  3875.                                                                                 
  3876.  if (r == -1) r = strlen(p);                                                    
  3877.                                                                                 
  3878.  fprintf(gp->debug_file,"%s:   (%d characters)\n",label,r);                     
  3879.  for (i=0;i<77;i++) fprintf(gp->debug_file,"-");                                
  3880.  fprintf(gp->debug_file,"\n");                                                  
  3881.  for (i=0;i<r;i++) {                                                            
  3882.    char c = *(p+i);                                                             
  3883.    if (isprint(c))  fprintf(gp->debug_file,"%c",c);                             
  3884.    else             fprintf(gp->debug_file,"<0x%2.2x>",c);                      
  3885.  }                                                                              
  3886.  fprintf(gp->debug_file,"\n");                                                  
  3887.  for (i=0;i<77;i++) fprintf(gp->debug_file,"-");                                
  3888.  fprintf(gp->debug_file,"\n");                                                  
  3889.                                                                                 
  3890.  return;                                                                        
  3891.                                                                                 
  3892. }                                                                               
  3893.                                                                                 
  3894. ./   ADD NAME=GGMESRVR,SSI=01020000                                             
  3895.                                                                                 
  3896.  /********************************************************************/         
  3897.  /*                                                                  */         
  3898.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3899.  /*                                                                  */         
  3900.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3901.  /*                                                                  */         
  3902.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3903.  /* including the implied warranties of merchantability and fitness, */         
  3904.  /* are expressly denied.                                            */         
  3905.  /*                                                                  */         
  3906.  /* Provided this copyright notice is included, this software may    */         
  3907.  /* be freely distributed and not offered for sale.                  */         
  3908.  /*                                                                  */         
  3909.  /* Changes or modifications may be made and used only by the maker  */         
  3910.  /* of same, and not further distributed.  Such modifications should */         
  3911.  /* be mailed to the author for consideration for addition to the    */         
  3912.  /* software and incorporation in subsequent releases.               */         
  3913.  /*                                                                  */         
  3914.  /********************************************************************/         
  3915.                                                                                 
  3916. #pragma  csect(code,  "GG@ESRVR")                                               
  3917. #pragma  csect(static,"GG$ESRVR")                                               
  3918. #include "gg.h"                                                                 
  3919.                                                                                 
  3920. /****** End server read. *********************************************/         
  3921.                                                                                 
  3922. void                                                                            
  3923. GGMesrvr(gp)                                                                    
  3924. Rstruc ggcb  *gp;                                                               
  3925. {                                                                               
  3926.  char       *lp;                                                                
  3927.  Bool        found_more_server_data = FALSE;                                    
  3928.                                                                                 
  3929.  GGMclrtx(gp,NULL);                    /* Clear text */                         
  3930.                                                                                 
  3931.  if (gp->recvp) return;                /* Skip if non-socket */                 
  3932.                                                                                 
  3933.  do {                                                                           
  3934.                                                                                 
  3935.    if (GGMgsrvl(gp,&lp)) {             /* Get server line */                    
  3936.      if (lp) {                                                                  
  3937.        found_more_server_data = TRUE;                                           
  3938.        (void)GGMouttx(gp,lp,NULL);     /* Output text line */                   
  3939.      }                                                                          
  3940.    }                                                                            
  3941.                                                                                 
  3942.  } while (lp);                                                                  
  3943.                                                                                 
  3944.  if (found_more_server_data) {                                                  
  3945.    ERR1(                                                                        
  3946. "More data was returned by the GOPHER server than GOPHER expected."             
  3947.        );                                                                       
  3948.    GGMvtx(gp,NULL,TRUE);              /* View text */                           
  3949.  }                                                                              
  3950.                                                                                 
  3951.  return;                                                                        
  3952. }                                                                               
  3953.                                                                                 
  3954. ./   ADD NAME=GGMFREEM,SSI=01000001                                             
  3955.                                                                                 
  3956.  /********************************************************************/         
  3957.  /*                                                                  */         
  3958.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3959.  /*                                                                  */         
  3960.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3961.  /*                                                                  */         
  3962.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3963.  /* including the implied warranties of merchantability and fitness, */         
  3964.  /* are expressly denied.                                            */         
  3965.  /*                                                                  */         
  3966.  /* Provided this copyright notice is included, this software may    */         
  3967.  /* be freely distributed and not offered for sale.                  */         
  3968.  /*                                                                  */         
  3969.  /* Changes or modifications may be made and used only by the maker  */         
  3970.  /* of same, and not further distributed.  Such modifications should */         
  3971.  /* be mailed to the author for consideration for addition to the    */         
  3972.  /* software and incorporation in subsequent releases.               */         
  3973.  /*                                                                  */         
  3974.  /********************************************************************/         
  3975.                                                                                 
  3976. #pragma  csect(code,  "GG@FREEM")                                               
  3977. #pragma  csect(static,"GG$FREEM")                                               
  3978. #include "gg.h"                                                                 
  3979.                                                                                 
  3980. /****** Free memory. *************************************************/         
  3981.                                                                                 
  3982. void                                                                            
  3983. GGMfreem(gp,stuff,whatfor)                                                      
  3984. Rstruc ggcb    *gp;                                                             
  3985. char           *stuff;                                                          
  3986. char           *whatfor;                                                        
  3987. {                                                                               
  3988.                                                                                 
  3989.  free(stuff);                                                                   
  3990.                                                                                 
  3991.  if (gp->debug_file) {                                                          
  3992.    fprintf(gp->debug_file,"GGMfreem: freed memory for %s\n", whatfor);          
  3993.  }                                                                              
  3994.  return;                                                                        
  3995.                                                                                 
  3996. }                                                                               
  3997.                                                                                 
  3998. ./   ADD NAME=GGMGETDS,SSI=01020011                                             
  3999.                                                                                 
  4000.  /********************************************************************/         
  4001.  /*                                                                  */         
  4002.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4003.  /*                                                                  */         
  4004.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4005.  /*                                                                  */         
  4006.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4007.  /* including the implied warranties of merchantability and fitness, */         
  4008.  /* are expressly denied.                                            */         
  4009.  /*                                                                  */         
  4010.  /* Provided this copyright notice is included, this software may    */         
  4011.  /* be freely distributed and not offered for sale.                  */         
  4012.  /*                                                                  */         
  4013.  /* Changes or modifications may be made and used only by the maker  */         
  4014.  /* of same, and not further distributed.  Such modifications should */         
  4015.  /* be mailed to the author for consideration for addition to the    */         
  4016.  /* software and incorporation in subsequent releases.               */         
  4017.  /*                                                                  */         
  4018.  /********************************************************************/         
  4019.                                                                                 
  4020.  /********************************************************************/         
  4021.                                                                                 
  4022. #pragma  csect(code,  "GG@GETDS")                                               
  4023. #pragma  csect(static,"GG$GETDS")                                               
  4024. #include "gg.h"                                                                 
  4025.                                                                                 
  4026. #define DUMMY_FILE_POINTER_FOR_PDS  (FILE *)(-1)                                
  4027.                                                                                 
  4028. /****** Prompt user for the name of a data set to extract into. ******/         
  4029.                                                                                 
  4030. FILE *                                                                          
  4031. GGMgetds(gp,ep)                                                                 
  4032. Rstruc ggcb         *gp;                                                        
  4033. Rstruc extraction   *ep;                                                        
  4034. {                                                                               
  4035.  FILE               *xfp;                                                       
  4036.  Bool                asked_for;                                                 
  4037.  char                ggexdsn[65];    /* data set name for extraction */         
  4038.  char                ggexapp [4];    /* YES or NO for append mode    */         
  4039.  char                ggextab [4];    /* YES or NO for tab expansion  */         
  4040.  char                ggexblk [4];    /* YES or NO for blank after sep*/         
  4041.  char                ggexsep[81];    /* Separator line (optional)    */         
  4042.  char                ggexan1[16];    /* From article number          */         
  4043.  char                ggexan2[16];    /* To   article number          */         
  4044.  char                ggexpmp [9];    /* PDS member name prefix       */         
  4045.  char                ddname  [9];                                               
  4046.  char                member  [9];                                               
  4047.  char                pdspec [32];                                               
  4048.  char                quoted_dsname [67];                                        
  4049.  char                formatted_number [11];                                     
  4050.                                                                                 
  4051.  /* Display panel asking for data set name into which to extract. */            
  4052.                                                                                 
  4053.  xfp = NULL;                                                                    
  4054.  asked_for = TRUE;                                                              
  4055.                                                                                 
  4056.  (void)GGMispf(gp,"ADDPOP");                                                    
  4057.                                                                                 
  4058.  while (xfp == NULL) {                                                          
  4059.                                                                                 
  4060.    /* Keep asking for a dsname until one works or END pressed. */               
  4061.                                                                                 
  4062.    if (GGMdispl(gp,ep->panelname) > 0) {                                        
  4063.      asked_for = FALSE;                                                         
  4064.      xfp = NULL;                                                                
  4065.      break;                                                                     
  4066.    }                                                                            
  4067.                                                                                 
  4068.    (void)GGMivget(gp,"GGEXDSN ",ggexdsn,sizeof(ggexdsn));                       
  4069.    (void)GGMivget(gp,"GGEXTAB ",ggextab,sizeof(ggextab));                       
  4070.    (void)GGMivget(gp,"GGEXAN1 ",ggexan1,sizeof(ggexan1));                       
  4071.    (void)GGMivget(gp,"GGEXAN2 ",ggexan2,sizeof(ggexan2));                       
  4072.    if (ep->mode == PDS) {                                                       
  4073.      (void)GGMivget(gp,"GGEXPMP ",ggexpmp,sizeof(ggexpmp));                     
  4074.    }                                                                            
  4075.    else {                                                                       
  4076.      (void)GGMivget(gp,"GGEXAPP ",ggexapp,sizeof(ggexapp));                     
  4077.      (void)GGMivget(gp,"GGEXBLK ",ggexblk,sizeof(ggexblk));                     
  4078.      (void)GGMivget(gp,"GGEXSEP ",ggexsep,sizeof(ggexsep));                     
  4079.    }                                                                            
  4080.                                                                                 
  4081.    if (ep->mode == PDS) {                                                       
  4082.                                                                                 
  4083.      ep->appending = FALSE;                                                     
  4084.      ep->blanking  = FALSE;                                                     
  4085.      strcpy(ep->separator,"");                                                  
  4086.      strcpy(ep->ddname,"");                                                     
  4087.      strcpy(ep->member_prefix,ggexpmp);                                         
  4088.                                                                                 
  4089.      /* Note: panel forces fully-qualified name to pass to allocate */          
  4090.                                                                                 
  4091.      /* check if the PDS already exists */                                      
  4092.                                                                                 
  4093.      if (ggexdsn[0] != '\'') {                                                  
  4094.        strcpy(quoted_dsname,"'");                                               
  4095.        strcat(quoted_dsname,ggexdsn);                                           
  4096.        strcat(quoted_dsname,"'");                                               
  4097.      }                                                                          
  4098.      else strcpy(quoted_dsname,ggexdsn);                                        
  4099.                                                                                 
  4100.      /* Check if PDS already exists. */                                         
  4101.                                                                                 
  4102.      if (gp->warn_overwrite) {                                                  
  4103.        xfp = fopen(quoted_dsname,"r");                                          
  4104.        if (xfp) {                                                               
  4105.          (void)fclose(xfp);                                                     
  4106.          xfp = NULL;                                                            
  4107.          if (GGMdispl(gp,"GGMPEXPW") > 0) {                                     
  4108.            WARN1("Operation cancelled, because you pressed END.");              
  4109.            break;                                                               
  4110.          }                                                                      
  4111.        }                                                                        
  4112.      }                                                                          
  4113.                                                                                 
  4114.      if (GGMalloc(ggexdsn,ep->ddname,PDS,ep->count) != PDS) {                   
  4115.        ERR2("Allocation failed for data set %s.", ggexdsn);                     
  4116.        xfp = NULL;                                                              
  4117.        continue;                                                                
  4118.      }                                                                          
  4119.      strcpy(ep->dsname,    ggexdsn);                                            
  4120.    }                                                                            
  4121.    else {                                                                       
  4122.      strcpy(ep->separator, ggexsep);                                            
  4123.      strcpy(ep->dsname,    ggexdsn);                                            
  4124.      ep->appending = (ggexapp[0] == 'Y');                                       
  4125.      ep->blanking  = (ggexblk[0] == 'Y');                                       
  4126.    }                                                                            
  4127.                                                                                 
  4128.    ep->tab_expanding = (ggextab[0] == 'Y');                                     
  4129.    if (*ggexan1) ep->from_number = atoi(ggexan1);                               
  4130.    else          ep->from_number = 0;                                           
  4131.    if (*ggexan2) ep->to_number   = atoi(ggexan2);                               
  4132.    else          ep->to_number   = INT_MAX;                                     
  4133.                                                                                 
  4134.    /* check if the dataset already exists */                                    
  4135.    /* (Wonder if this will compile.  Have fun, "cc"...) */                      
  4136.                                                                                 
  4137.    if (ep->appending ? gp->warn_append : gp->warn_overwrite) {                  
  4138.      xfp = fopen(ggexdsn,"r");                                                  
  4139.      if (xfp) {                                                                 
  4140.        (void)fclose(xfp);                                                       
  4141.        xfp = NULL;                                                              
  4142.        if (GGMdispl(gp,"GGMPEXOW") > 0) {                                       
  4143.          WARN1("Operation cancelled, because you pressed END.");                
  4144.          break;                                                                 
  4145.        }                                                                        
  4146.      }                                                                          
  4147.    }                                                                            
  4148.                                                                                 
  4149.    if (ep->mode == PDS) {                                                       
  4150.      xfp = DUMMY_FILE_POINTER_FOR_PDS;                                          
  4151.      break;                                                                     
  4152.    }                                                                            
  4153.                                                                                 
  4154.    xfp = OPEN_TEXT_FILE_FOR_WRITE_OR_APPEND(ggexdsn,ep->appending);             
  4155.                                                                                 
  4156.    if (!xfp) {                                                                  
  4157.      perror(ggexdsn);                                                           
  4158.      ERR2("Cannot open data set %s.", ep->dsname);                              
  4159.    }                                                                            
  4160.  }                                                                              
  4161.                                                                                 
  4162.  (void)GGMispf(gp,"REMPOP");                                                    
  4163.                                                                                 
  4164.  return xfp;                                                                    
  4165.                                                                                 
  4166. }                                                                               
  4167.                                                                                 
  4168. ./   ADD NAME=GGMGETM,SSI=01000052                                              
  4169.                                                                                 
  4170.  /********************************************************************/         
  4171.  /*                                                                  */         
  4172.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4173.  /*                                                                  */         
  4174.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4175.  /*                                                                  */         
  4176.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4177.  /* including the implied warranties of merchantability and fitness, */         
  4178.  /* are expressly denied.                                            */         
  4179.  /*                                                                  */         
  4180.  /* Provided this copyright notice is included, this software may    */         
  4181.  /* be freely distributed and not offered for sale.                  */         
  4182.  /*                                                                  */         
  4183.  /* Changes or modifications may be made and used only by the maker  */         
  4184.  /* of same, and not further distributed.  Such modifications should */         
  4185.  /* be mailed to the author for consideration for addition to the    */         
  4186.  /* software and incorporation in subsequent releases.               */         
  4187.  /*                                                                  */         
  4188.  /********************************************************************/         
  4189.                                                                                 
  4190. #pragma  csect(code,  "GG@GETM ")                                               
  4191. #pragma  csect(static,"GG$GETM ")                                               
  4192. #include "gg.h"                                                                 
  4193.                                                                                 
  4194. /****** Get memory. **************************************************/         
  4195.                                                                                 
  4196. void                                                                            
  4197. GGMgetm(gp,pointer,howmuch,whatfor)                                             
  4198. Rstruc ggcb    *gp;                                                             
  4199. char          **pointer;                                                        
  4200. int             howmuch;                                                        
  4201. char           *whatfor;                                                        
  4202. {                                                                               
  4203.                                                                                 
  4204.  *pointer = (char *)malloc(howmuch);                                            
  4205.                                                                                 
  4206.  if (*pointer == NULL) {                                                        
  4207.    fprintf(stderr,"GGMgetm: Cannot obtain %d bytes of memory for %s\n",         
  4208.                   howmuch,whatfor);                                             
  4209.  }                                                                              
  4210.  else if (gp->debug_file) {                                                     
  4211.    fprintf(gp->debug_file,"GGMgetm: got %d bytes of memory for %s\n",           
  4212.                            howmuch,whatfor);                                    
  4213.  }                                                                              
  4214.  return;                                                                        
  4215.                                                                                 
  4216. }                                                                               
  4217.                                                                                 
  4218. ./   ADD NAME=GGMGOFOR,SSI=01180001                                             
  4219.                                                                                 
  4220.  /********************************************************************/         
  4221.  /*                                                                  */         
  4222.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4223.  /*                                                                  */         
  4224.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4225.  /*                                                                  */         
  4226.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4227.  /* including the implied warranties of merchantability and fitness, */         
  4228.  /* are expressly denied.                                            */         
  4229.  /*                                                                  */         
  4230.  /* Provided this copyright notice is included, this software may    */         
  4231.  /* be freely distributed and not offered for sale.                  */         
  4232.  /*                                                                  */         
  4233.  /* Changes or modifications may be made and used only by the maker  */         
  4234.  /* of same, and not further distributed.  Such modifications should */         
  4235.  /* be mailed to the author for consideration for addition to the    */         
  4236.  /* software and incorporation in subsequent releases.               */         
  4237.  /*                                                                  */         
  4238.  /********************************************************************/         
  4239.                                                                                 
  4240. #pragma  csect(code,  "GG@GOFOR")                                               
  4241. #pragma  csect(static,"GG$GOFOR")                                               
  4242. #include "gg.h"                                                                 
  4243.                                                                                 
  4244. /********************************************************************/          
  4245.                                                                                 
  4246. static Bool                                                                     
  4247. connect_to_gopher_server(gp,ip)                                                 
  4248. Rstruc ggcb        *gp;                                                         
  4249. Rstruc gopherinfo  *ip;                                                         
  4250. {                                                                               
  4251.  char              *lp;                                                         
  4252.  Bool               got_some;                                                   
  4253.                                                                                 
  4254.  strcpy(gp->ggserver,ip->host);     /* Specify server to connect to */          
  4255.  strcpy(gp->gopher_command,ip->path);   /* Specify command to issue */          
  4256.  gp->ginfo = ip;                                                                
  4257.  gp->receiving_text = FALSE;                                                    
  4258.                                                                                 
  4259.  if (!GGMconn(gp)) return FALSE;   /* Connect to gopher server      */          
  4260.                                                                                 
  4261.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  4262.                                                                                 
  4263.  GGMclrtx(gp,ip);                  /* Clear text */                             
  4264.                                                                                 
  4265.  gp->receiving_text = TRUE;                                                     
  4266.                                                                                 
  4267.  got_some = FALSE;                                                              
  4268.  do {                                                                           
  4269.                                                                                 
  4270.    if (GGMgsrvl(gp,&lp))                  /* Get server line */                 
  4271.      if (lp) {                                                                  
  4272.        got_some = TRUE;                                                         
  4273.        (void)GGMouttx(gp,lp,ip);          /* Output text line */                
  4274.      }                                                                          
  4275.  } while (lp);                            /* until no more lines */             
  4276.                                                                                 
  4277.  if (!got_some) {                                                               
  4278.    WARN2("No data available from server %s.\n",gp->ggserver);                   
  4279.    return FALSE;                                                                
  4280.  }                                                                              
  4281.                                                                                 
  4282.  return TRUE;                                                                   
  4283.                                                                                 
  4284. }                                                                               
  4285.                                                                                 
  4286. /****** Gopher it. ***************************************************/         
  4287.                                                                                 
  4288. Bool                                                                            
  4289. GGMgofor(gp,ip,as_file)                                                         
  4290. Rstruc ggcb        *gp;                                                         
  4291. Rstruc gopherinfo  *ip;                                                         
  4292. Fool                as_file;                                                    
  4293. {                                                                               
  4294.  Bool               goconnect;                                                  
  4295.  Bool             (*gofun)(struct ggcb *,struct gopherinfo *,Fool);             
  4296.                                                                                 
  4297.    /* (1) send initial path string to initial host                              
  4298.     * (2) get back data from host                                               
  4299.     * (3) if it is a gopher directory, then do:                                 
  4300.     *      - display "table" of items                                           
  4301.     *      - for each item selected, call GGMgofor recursively                  
  4302.     *     else browse the file data                                             
  4303.     * (4) bye                                                                   
  4304.     */                                                                          
  4305.                                                                                 
  4306.  if (gp->debug_mode) {                                                          
  4307.    fprintf(gp->debug_file,"GGMgofor: type = %d\n",ip->type);                    
  4308.    fprintf(gp->debug_file,"GGMgofor: port = %d\n",ip->port);                    
  4309.    fprintf(gp->debug_file,"GGMgofor: path = %s\n",ip->path);                    
  4310.    fprintf(gp->debug_file,"GGMgofor: host = %s\n",ip->host);                    
  4311.    fprintf(gp->debug_file,"GGMgofor: desc = %s\n",ip->desc);                    
  4312.  }                                                                              
  4313.                                                                                 
  4314.  switch (ip->type) {                                                            
  4315.    case GOPHER_FILE:      gofun = GGMvtx;   goconnect = TRUE;  break;           
  4316.    case GOPHER_DIRECTORY: gofun = GGMdir;   goconnect = TRUE;  break;           
  4317.    case GOPHER_TELNET:    gofun = GGMtnet;  goconnect = FALSE; break;           
  4318.    case GOPHER_WAIS:      gofun = GGMwais;  goconnect = FALSE; break;           
  4319.    case GOPHER_WHOIS:     gofun = GGMwhois; goconnect = FALSE; break;           
  4320.    default:                                                                     
  4321.         ERR2("Sorry, access via %s not supported", GGMtype(ip->type));          
  4322.         return FALSE;                                                           
  4323.  }                                                                              
  4324.                                                                                 
  4325.  if (goconnect) {                                                               
  4326.    if (!connect_to_gopher_server(gp,ip)) return FALSE;                          
  4327.  }                                                                              
  4328.                                                                                 
  4329.  /* Insure no connection is active once we do the real thing. */                
  4330.                                                                                 
  4331.  if (gp->connected_to_server) {                                                 
  4332.    (void)GGMdisc(gp);              /* Disconnect from gopher server */          
  4333.  }                                                                              
  4334.                                                                                 
  4335.  return (gofun)(gp,ip,as_file);                                                 
  4336. }                                                                               
  4337.                                                                                 
  4338. ./   ADD NAME=GGMGSRVL,SSI=010F0030                                             
  4339.                                                                                 
  4340.  /********************************************************************/         
  4341.  /*                                                                  */         
  4342.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4343.  /*                                                                  */         
  4344.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4345.  /*                                                                  */         
  4346.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4347.  /* including the implied warranties of merchantability and fitness, */         
  4348.  /* are expressly denied.                                            */         
  4349.  /*                                                                  */         
  4350.  /* Provided this copyright notice is included, this software may    */         
  4351.  /* be freely distributed and not offered for sale.                  */         
  4352.  /*                                                                  */         
  4353.  /* Changes or modifications may be made and used only by the maker  */         
  4354.  /* of same, and not further distributed.  Such modifications should */         
  4355.  /* be mailed to the author for consideration for addition to the    */         
  4356.  /* software and incorporation in subsequent releases.               */         
  4357.  /*                                                                  */         
  4358.  /********************************************************************/         
  4359.                                                                                 
  4360. #pragma  csect(code,  "GG@GSRVL")                                               
  4361. #pragma  csect(static,"GG$GSRVL")                                               
  4362. #include "gg.h"                                                                 
  4363.                                                                                 
  4364. /****** Input one character from the server. *************************/         
  4365.                                                                                 
  4366. static int                                                                      
  4367. socket_getchar(gp)                                                              
  4368. Rstruc ggcb  *gp;                                                               
  4369. {                                                                               
  4370.  int         readrc;                                                            
  4371.                                                                                 
  4372.  if (gp->g_buf_index == -1 ||                                                   
  4373.      gp->g_buf_index >= gp->g_bytes_returned - 1) {                             
  4374.    gp->g_buf_index = -1;                                                        
  4375.    if (gp->dont_read) return(SOCKET_NO_MORE);                                   
  4376.    else {                                                                       
  4377.      TCP_DEBUG_ON;                                                              
  4378.      readrc = read(gp->socknum, gp->g_buf, READ_BYTES);                         
  4379.      TCP_DEBUG_OFF;                                                             
  4380.      if (readrc == -1) {                                                        
  4381.        gp->connection_broken = TRUE;                                            
  4382.        return SOCKET_GETCHAR_ERROR;                                             
  4383.      }                                                                          
  4384.      else if (readrc == 0) {                                                    
  4385.        gp->connection_broken = FALSE;                                           
  4386.        return SOCKET_READ_NOTHING;                                              
  4387.      }                                                                          
  4388.      else {                                                                     
  4389. #ifdef MVS                                                                      
  4390.        int i;                                                                   
  4391.        for (i=0;i<readrc;i++) gp->g_buf[i] = atoe(gp->g_buf[i]);                
  4392. #endif                                                                          
  4393.        gp->g_bytes_returned = readrc;                                           
  4394.      }                                                                          
  4395.    }                                                                            
  4396.  }                                                                              
  4397.  return gp->g_buf[++gp->g_buf_index];                                           
  4398. }                                                                               
  4399.                                                                                 
  4400. /****** Input one data line at a time from the server. ***************/         
  4401.                                                                                 
  4402. static enum socket_retval                                                       
  4403. socket_from_server(gp)                                                          
  4404. Rstruc ggcb *gp;                                                                
  4405. {                                                                               
  4406.  char       *s_buf;                                                             
  4407.  int         s_bytes;                                                           
  4408.  int         s_buf_index;                                                       
  4409.  int         character;                                                         
  4410.  int         previous_character;                                                
  4411.                                                                                 
  4412.  s_buf   = gp->server_buf;                                                      
  4413.  s_bytes = SERVER_BUF_MSGSIZE;                                                  
  4414.                                                                                 
  4415.  /* Get characters from the server until CRLF is reached. */                    
  4416.                                                                                 
  4417.  s_buf_index = 0;                                                               
  4418.  previous_character = -1;                                                       
  4419.  for (;;) {                                                                     
  4420.    character = socket_getchar(gp);                                              
  4421.    /*                                                                           
  4422.    if (character == LINE_FEED && previous_character == CARRIAGE_RETURN)         
  4423.       break;                                                                    
  4424.    */                                                                           
  4425.    if (character == LINE_FEED) break;                                           
  4426.    if (character == SOCKET_GETCHAR_ERROR)  return(SERVER_READ_ERROR);           
  4427.    if (character == SOCKET_NO_MORE)        return(SERVER_NO_MORE);              
  4428.    if (character == SOCKET_READ_NOTHING)   return(SERVER_READ_NOTHING);         
  4429.    previous_character = character;                                              
  4430.    if (s_buf_index >= s_bytes) {                                                
  4431.      fprintf(stderr,"Error: gp->server_buf overflowed.\n");                     
  4432.      fprintf(stderr,                                                            
  4433.              "More than %d bytes collected without CR/LF seen.\n",              
  4434.              s_bytes);                                                          
  4435.      if (gp->debug_file) {                                                      
  4436.        GGMdump(gp,"Data collected so far",gp->server_buf,s_bytes);              
  4437.      }                                                                          
  4438.      return(SERVER_BUFFER_ERROR);                                               
  4439.    }                                                                            
  4440.    if (character == '\0') {                                                     
  4441.      fprintf(stderr,                                                            
  4442. "Warning: null character found in data from server, changed to blank\n"         
  4443.             );                                                                  
  4444.      character = ' ';                                                           
  4445.    }                                                                            
  4446.    s_buf[s_buf_index++] = (unsigned char)character;                             
  4447.  }                                                                              
  4448.  s_buf[s_buf_index] = '\0';                                                     
  4449.  return(SERVER_READ_OK);                                                        
  4450. }                                                                               
  4451.                                                                                 
  4452. /****** Get server line. *********************************************/         
  4453.                                                                                 
  4454. Bool                                                                            
  4455. GGMgsrvl(gp,pointer)                                                            
  4456. Rstruc ggcb  *gp;                                                               
  4457. char        **pointer;                                                          
  4458. {                                                                               
  4459.  char              *sbufp;                                                      
  4460.  char              *p;                                                          
  4461.  int                scan_count;                                                 
  4462.  Bool               something_to_print;                                         
  4463.  struct recvstruct *R;                                                          
  4464.                                                                                 
  4465.  *pointer = NULL;                                                               
  4466.                                                                                 
  4467.  /* If local mode, read from temporary file until EOF. */                       
  4468.                                                                                 
  4469.  if ((R=gp->recvp)) {                                                           
  4470.    if (!R->outfp) {                                                             
  4471.      CRIT1("Can't read data locally, non-socket not connected\n");              
  4472.      return FALSE;                                                              
  4473.    }                                                                            
  4474.    fgets(gp->server_buf, SERVER_BUF_MSGSIZE, R->outfp);                         
  4475.    if (ferror(R->outfp)) {                                                      
  4476.      CRIT1("Error reading local non-socket data\n");                            
  4477.      gp->time_to_go_home = TRUE;                                                
  4478.      return FALSE;                                                              
  4479.    }                                                                            
  4480.    if (feof(R->outfp)) return FALSE;                                            
  4481.    if ((p=strchr(gp->server_buf,'\n'))) *p = '\0';                              
  4482.    *pointer = gp->server_buf;                                                   
  4483.    return TRUE;                                                                 
  4484.  }                                                                              
  4485.                                                                                 
  4486.  if (!gp->receiving_text) return TRUE;                                          
  4487.                                                                                 
  4488.  if (gp->server_finished_replying) gp->dont_read = TRUE;                        
  4489.                                                                                 
  4490.  switch (socket_from_server(gp)) {                                              
  4491.    case SERVER_READ_OK:      break;                                             
  4492.    case SERVER_READ_NOTHING: gp->time_to_go_home = TRUE;                        
  4493.                              break;                                             
  4494.    case SERVER_READ_ERROR:   ERR2(                                              
  4495.      "Lost server connection.  Failure reading data from server %s.",           
  4496.                                   gp->ggserver);                                
  4497.                              gp->time_to_go_home = TRUE;                        
  4498.                              break;                                             
  4499.    case SERVER_BUFFER_ERROR: ERR2(                                              
  4500.  "Read error.  No linefeed character found in data from server %s.",            
  4501.                                   gp->ggserver);                                
  4502.                              gp->time_to_go_home = TRUE;                        
  4503.                              break;                                             
  4504.    case SERVER_NO_MORE:      gp->server_has_something_pending = FALSE;          
  4505.                              break;                                             
  4506.  }                                                                              
  4507.                                                                                 
  4508.  if (gp->time_to_go_home == TRUE) return FALSE;                                 
  4509.  if (gp->dont_read == TRUE &&                                                   
  4510.      gp->server_has_something_pending == FALSE) return TRUE;                    
  4511.                                                                                 
  4512.  something_to_print = TRUE;                                                     
  4513.                                                                                 
  4514.  sbufp = gp->server_buf;                                                        
  4515.                                                                                 
  4516.  if (gp->sending_text) {                                                        
  4517.    if (*sbufp == '.') {                                                         
  4518.      switch (*(sbufp+1)) {                                                      
  4519.         case CARRIAGE_RETURN:                                                   
  4520.         case LINE_FEED:                                                         
  4521.         case '\0':                                                              
  4522.                   gp->server_finished_replying = TRUE;                          
  4523.                   something_to_print = FALSE;                                   
  4524.                   break;                                                        
  4525.         case '.':                                                               
  4526.                   break;                                                        
  4527.         default:                                                                
  4528.                   GGMdump(gp,"Warning, bad period in line from server",         
  4529.                           sbufp,strlen(sbufp));                                 
  4530.                   break;                                                        
  4531.      }                                                                          
  4532.    }                                                                            
  4533.  }                                                                              
  4534.                                                                                 
  4535.  gp->sending_text = TRUE;                                                       
  4536.                                                                                 
  4537.  if (something_to_print) {                                                      
  4538.    /* Last character of output buffer is a CR without LF. */                    
  4539.    p = sbufp + strlen(sbufp)-1;                                                 
  4540.    if (p >= sbufp) {                                                            
  4541.      if (*p == CARRIAGE_RETURN) *p = '\0';                                      
  4542.      else {                                                                     
  4543.        /* Last character of output buffer had better be a LF. */                
  4544.        if (gp->debug_file) {                                                    
  4545.          fprintf(gp->debug_file,                                                
  4546.    "Warning: No carriage return in data from server (%d bytes):\n%s\n",         
  4547.                strlen(sbufp), sbufp);                                           
  4548.        }                                                                        
  4549.        CRIT2(                                                                   
  4550. "Carriage return expected but not seen in data from server %s.",                
  4551.              gp->ggserver);                                                     
  4552.        }                                                                        
  4553.      *(p+1) = '\0';                                                             
  4554.    }                                                                            
  4555.    *pointer = sbufp;                                                            
  4556.  }                                                                              
  4557.                                                                                 
  4558.  if (gp->time_to_go_home) return FALSE;                                         
  4559.  else return TRUE;                                                              
  4560. }                                                                               
  4561.                                                                                 
  4562. ./   ADD NAME=GGMIERR,SSI=01000000                                              
  4563.                                                                                 
  4564.  /********************************************************************/         
  4565.  /*                                                                  */         
  4566.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4567.  /*                                                                  */         
  4568.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4569.  /*                                                                  */         
  4570.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4571.  /* including the implied warranties of merchantability and fitness, */         
  4572.  /* are expressly denied.                                            */         
  4573.  /*                                                                  */         
  4574.  /* Provided this copyright notice is included, this software may    */         
  4575.  /* be freely distributed and not offered for sale.                  */         
  4576.  /*                                                                  */         
  4577.  /* Changes or modifications may be made and used only by the maker  */         
  4578.  /* of same, and not further distributed.  Such modifications should */         
  4579.  /* be mailed to the author for consideration for addition to the    */         
  4580.  /* software and incorporation in subsequent releases.               */         
  4581.  /*                                                                  */         
  4582.  /********************************************************************/         
  4583.                                                                                 
  4584. #pragma  csect(code,  "GG@IERR ")                                               
  4585. #pragma  csect(static,"GG$IERR ")                                               
  4586. #include "gg.h"                                                                 
  4587.                                                                                 
  4588. /****** ISPF error handler. ******************************************/         
  4589.                                                                                 
  4590. void                                                                            
  4591. GGMierr(gp)                                                                     
  4592. Rstruc ggcb *gp;                                                                
  4593. {                                                                               
  4594.  char        errbuf[] = "DISPLAY PANEL(ISPTERM)";                               
  4595.  int         errlen;                                                            
  4596.                                                                                 
  4597.  errlen = strlen(errbuf);                                                       
  4598.  switch (ISPEXEC(&errlen,errbuf)) {                                             
  4599.    case  0:                                                                     
  4600.    case  4:                                                                     
  4601.    case  8:                                                                     
  4602.            return;                                                              
  4603.    default:                                                                     
  4604.            fprintf(stderr,                                                      
  4605. "\n*** Severe ISPF error, cannot even display ISPTERM error panel.\n");         
  4606.            fprintf(stderr,                                                      
  4607. "\n*** Return code from ISPF service is %d\n",gp->ispfrc);                      
  4608.            return;                                                              
  4609.  }                                                                              
  4610. }                                                                               
  4611.                                                                                 
  4612. ./   ADD NAME=GGMIGET,SSI=01000045                                              
  4613.                                                                                 
  4614.  /********************************************************************/         
  4615.  /*                                                                  */         
  4616.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4617.  /*                                                                  */         
  4618.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4619.  /*                                                                  */         
  4620.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4621.  /* including the implied warranties of merchantability and fitness, */         
  4622.  /* are expressly denied.                                            */         
  4623.  /*                                                                  */         
  4624.  /* Provided this copyright notice is included, this software may    */         
  4625.  /* be freely distributed and not offered for sale.                  */         
  4626.  /*                                                                  */         
  4627.  /* Changes or modifications may be made and used only by the maker  */         
  4628.  /* of same, and not further distributed.  Such modifications should */         
  4629.  /* be mailed to the author for consideration for addition to the    */         
  4630.  /* software and incorporation in subsequent releases.               */         
  4631.  /*                                                                  */         
  4632.  /********************************************************************/         
  4633.                                                                                 
  4634. #pragma  csect(code,  "GG@IGET ")                                               
  4635. #pragma  csect(static,"GG$IGET ")                                               
  4636. #include "gg.h"                                                                 
  4637.                                                                                 
  4638. /****** Retrieve the value of an ISPF variable into an integer. ******/         
  4639.                                                                                 
  4640. int                                                                             
  4641. GGMiget(gp,varname)                                                             
  4642. Rstruc ggcb *gp;                                                                
  4643. char        *varname;                                                           
  4644. {                                                                               
  4645.  char        varbuf[16];                                                        
  4646.  int         vcopy_length;                                                      
  4647.                                                                                 
  4648.  if (!strchr(varname,' ')) {                                                    
  4649.    fprintf(stderr,"GGMiget: no blank passed in var name\n");                    
  4650.    return FALSE;                                                                
  4651.  }                                                                              
  4652.                                                                                 
  4653.  vcopy_length = sizeof(varbuf);                                                 
  4654.                                                                                 
  4655.  gp->ispfrc = ISPLINK("VCOPY",varname,&vcopy_length,varbuf,"MOVE");             
  4656.  switch (gp->ispfrc) {                                                          
  4657.    case  0:                                                                     
  4658.            varbuf[vcopy_length] = '\0';                                         
  4659.            return atoi(varbuf);                                                 
  4660.    case  8:                                                                     
  4661.            return 0;                                                            
  4662.    case 16:                                                                     
  4663.            fprintf(stderr,                                                      
  4664.                    "Error: ISPF variable buffer too short to get %s\n",         
  4665.                    varname);                                                    
  4666.            return 0;                                                            
  4667.    default:                                                                     
  4668.            GGMierr(gp);   /* handle ISPF error */                               
  4669.            return 0;                                                            
  4670.  }                                                                              
  4671. }                                                                               
  4672.                                                                                 
  4673. ./   ADD NAME=GGMISPF,SSI=01000016                                              
  4674.                                                                                 
  4675.  /********************************************************************/         
  4676.  /*                                                                  */         
  4677.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4678.  /*                                                                  */         
  4679.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4680.  /*                                                                  */         
  4681.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4682.  /* including the implied warranties of merchantability and fitness, */         
  4683.  /* are expressly denied.                                            */         
  4684.  /*                                                                  */         
  4685.  /* Provided this copyright notice is included, this software may    */         
  4686.  /* be freely distributed and not offered for sale.                  */         
  4687.  /*                                                                  */         
  4688.  /* Changes or modifications may be made and used only by the maker  */         
  4689.  /* of same, and not further distributed.  Such modifications should */         
  4690.  /* be mailed to the author for consideration for addition to the    */         
  4691.  /* software and incorporation in subsequent releases.               */         
  4692.  /*                                                                  */         
  4693.  /********************************************************************/         
  4694.                                                                                 
  4695. #pragma  csect(code,  "GG@ISPF ")                                               
  4696. #pragma  csect(static,"GG$ISPF ")                                               
  4697. #include "gg.h"                                                                 
  4698.                                                                                 
  4699. /****** Call ISPF service. *******************************************/         
  4700.                                                                                 
  4701. Bool                                                                            
  4702. GGMispf(gp,ispfbuf)                                                             
  4703. Rstruc ggcb *gp;                                                                
  4704. char        *ispfbuf;                                                           
  4705. {                                                                               
  4706.  int         ispflen;                                                           
  4707.                                                                                 
  4708.  ispflen = strlen(ispfbuf);                                                     
  4709.  gp->ispfrc = ISPEXEC(&ispflen,ispfbuf);                                        
  4710.  if (gp->ispfrc > 8) {                                                          
  4711.                                                                                 
  4712.    /* Ignore ADDPOP and REMPOP errors, especially if they are due to            
  4713.       ISPF V3 not being active. */                                              
  4714.                                                                                 
  4715.    if (gp->ispfrc == 20                                                         
  4716.     && gp->debug_mode == FALSE                                                  
  4717.     && ispflen > 6                                                              
  4718.     && (memcmp(ispfbuf,"ADDPOP",6) == 0                                         
  4719.      || memcmp(ispfbuf,"REMPOP",6) == 0)) {                                     
  4720.      return TRUE;                                                               
  4721.    }                                                                            
  4722.                                                                                 
  4723.    GGMierr(gp);             /* handle ISPF error */                             
  4724.    return FALSE;                                                                
  4725.  }                                                                              
  4726.  return TRUE;                                                                   
  4727. }                                                                               
  4728.                                                                                 
  4729. ./   ADD NAME=GGMIVGET,SSI=01000024                                             
  4730.                                                                                 
  4731.  /********************************************************************/         
  4732.  /*                                                                  */         
  4733.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4734.  /*                                                                  */         
  4735.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4736.  /*                                                                  */         
  4737.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4738.  /* including the implied warranties of merchantability and fitness, */         
  4739.  /* are expressly denied.                                            */         
  4740.  /*                                                                  */         
  4741.  /* Provided this copyright notice is included, this software may    */         
  4742.  /* be freely distributed and not offered for sale.                  */         
  4743.  /*                                                                  */         
  4744.  /* Changes or modifications may be made and used only by the maker  */         
  4745.  /* of same, and not further distributed.  Such modifications should */         
  4746.  /* be mailed to the author for consideration for addition to the    */         
  4747.  /* software and incorporation in subsequent releases.               */         
  4748.  /*                                                                  */         
  4749.  /********************************************************************/         
  4750.                                                                                 
  4751. #pragma  csect(code,  "GG@IVGET")                                               
  4752. #pragma  csect(static,"GG$IVGET")                                               
  4753. #include "gg.h"                                                                 
  4754.                                                                                 
  4755. /****** Retrieve the value of an ISPF variable. **********************/         
  4756.                                                                                 
  4757. Bool                                                                            
  4758. GGMivget(gp,varname,varbuf,varbuflen)                                           
  4759. Rstruc ggcb *gp;                                                                
  4760. char        *varname;                                                           
  4761. char        *varbuf;                                                            
  4762. int          varbuflen;                                                         
  4763. {                                                                               
  4764.  int         vcopy_length;                                                      
  4765.                                                                                 
  4766.  if (!strchr(varname,' ')) {                                                    
  4767.    fprintf(stderr,"GGMivget: no blank passed in var name\n");                   
  4768.    return FALSE;                                                                
  4769.  }                                                                              
  4770.                                                                                 
  4771.  /*                                                                             
  4772.   * If varbuflen is negative, that means that the value is not to be            
  4773.   * treated as a C string, and the null character is not to be                  
  4774.   * appended to the resulting value.  This is used for hex values               
  4775.   * (like addresses) that are stored in ISPF table row variables.               
  4776.   */                                                                            
  4777.                                                                                 
  4778.  if (varbuflen < 0)  vcopy_length = -varbuflen;                                 
  4779.  else vcopy_length = varbuflen;                                                 
  4780.                                                                                 
  4781.  /* Note that on entry, vcopy_length is an integer that contains                
  4782.     the length of the buffer.  On return it is updated to the length            
  4783.     of the value returned.  Since we have to stick a null character             
  4784.     on the end of it for C, the actual buffer passed must be at least           
  4785.     one character longer than the length as defined to ISPF.                    
  4786.  */                                                                             
  4787.                                                                                 
  4788.  gp->ispfrc = ISPLINK("VCOPY",varname,&vcopy_length,varbuf,"MOVE");             
  4789.  switch (gp->ispfrc) {                                                          
  4790.    case  0:                                                                     
  4791.            if (varbuflen >= 0)                                                  
  4792.               varbuf[vcopy_length] = '\0';                                      
  4793.            return TRUE;                                                         
  4794.    case  8:                                                                     
  4795.            strcpy(varbuf,"");                                                   
  4796.            return TRUE;                                                         
  4797.    case 16:                                                                     
  4798.            fprintf(stderr,                                                      
  4799.                    "Error: ISPF variable buffer too short to get %s\n",         
  4800.                    varname);                                                    
  4801.            return FALSE;                                                        
  4802.    default:                                                                     
  4803.            GGMierr(gp);   /* handle ISPF error */                               
  4804.            return FALSE;                                                        
  4805.  }                                                                              
  4806. }                                                                               
  4807.                                                                                 
  4808. ./   ADD NAME=GGMIVPUT,SSI=01000024                                             
  4809.                                                                                 
  4810.  /********************************************************************/         
  4811.  /*                                                                  */         
  4812.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4813.  /*                                                                  */         
  4814.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4815.  /*                                                                  */         
  4816.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4817.  /* including the implied warranties of merchantability and fitness, */         
  4818.  /* are expressly denied.                                            */         
  4819.  /*                                                                  */         
  4820.  /* Provided this copyright notice is included, this software may    */         
  4821.  /* be freely distributed and not offered for sale.                  */         
  4822.  /*                                                                  */         
  4823.  /* Changes or modifications may be made and used only by the maker  */         
  4824.  /* of same, and not further distributed.  Such modifications should */         
  4825.  /* be mailed to the author for consideration for addition to the    */         
  4826.  /* software and incorporation in subsequent releases.               */         
  4827.  /*                                                                  */         
  4828.  /********************************************************************/         
  4829.                                                                                 
  4830. #pragma  csect(code,  "GG@IVPUT")                                               
  4831. #pragma  csect(static,"GG$IVPUT")                                               
  4832. #include "gg.h"                                                                 
  4833.                                                                                 
  4834. /****** Set the value of an ISPF variable. ***************************/         
  4835.                                                                                 
  4836. Bool                                                                            
  4837. GGMivput(gp,varname,varbuf,varlen)                                              
  4838. Rstruc ggcb *gp;                                                                
  4839. char        *varname;                                                           
  4840. char        *varbuf;                                                            
  4841. int          varlen;                                                            
  4842. {                                                                               
  4843.  int         vreplace_length;                                                   
  4844.                                                                                 
  4845.  vreplace_length = (varlen<0 ? strlen(varbuf) : varlen);                        
  4846.                                                                                 
  4847.  gp->ispfrc = ISPLINK("VREPLACE",varname,&vreplace_length,varbuf);              
  4848.  switch (gp->ispfrc) {                                                          
  4849.    case  0:                                                                     
  4850.            return TRUE;                                                         
  4851.    case 16:                                                                     
  4852.            fprintf(stderr,                                                      
  4853.                    "Error: ISPF variable buffer too short to put %s\n",         
  4854.                    varname);                                                    
  4855.            return FALSE;                                                        
  4856.    default:                                                                     
  4857.            GGMierr(gp);   /* handle ISPF error */                               
  4858.            return FALSE;                                                        
  4859.  }                                                                              
  4860. }                                                                               
  4861.                                                                                 
  4862. ./   ADD NAME=GGMMTFER,SSI=01030000                                             
  4863.                                                                                 
  4864.  /********************************************************************/         
  4865.  /*                                                                  */         
  4866.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4867.  /*                                                                  */         
  4868.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4869.  /*                                                                  */         
  4870.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4871.  /* including the implied warranties of merchantability and fitness, */         
  4872.  /* are expressly denied.                                            */         
  4873.  /*                                                                  */         
  4874.  /* Provided this copyright notice is included, this software may    */         
  4875.  /* be freely distributed and not offered for sale.                  */         
  4876.  /*                                                                  */         
  4877.  /* Changes or modifications may be made and used only by the maker  */         
  4878.  /* of same, and not further distributed.  Such modifications should */         
  4879.  /* be mailed to the author for consideration for addition to the    */         
  4880.  /* software and incorporation in subsequent releases.               */         
  4881.  /*                                                                  */         
  4882.  /********************************************************************/         
  4883.                                                                                 
  4884. #pragma  csect(code,  "GG@MTFER")                                               
  4885. #pragma  csect(static,"GG$MTFER")                                               
  4886. #include "gg.h"                                                                 
  4887.                                                                                 
  4888. /*********************************************************************/         
  4889.                                                                                 
  4890. void                                                                            
  4891. GGMmtfer(                                                                       
  4892.          int          retcode,                                                  
  4893.          char        *kind)                                                     
  4894. {                                                                               
  4895.  char    *ermsg;                                                                
  4896.                                                                                 
  4897.  switch (retcode) {                                                             
  4898.    case MTF_OK:                                                                 
  4899.         ermsg = NULL;                                                           
  4900.         break;                                                                  
  4901.    case EINACTIVE:                                                              
  4902.         ermsg = "MTF is inactive";                                              
  4903.         break;                                                                  
  4904.    case ESUBCALL:                                                               
  4905.         ermsg = "The MTF call was issued from a subtask";                       
  4906.         break;                                                                  
  4907.    case EWRONGOS:                                                               
  4908.         ermsg = "MTF is not supported under CMS, IMS, CICS, or DB2";            
  4909.         break;                                                                  
  4910.    case EACTIVE:                                                                
  4911.         ermsg = "MTF has already been initialized and is active";               
  4912.         break;                                                                  
  4913.    case ENAME2LNG:                                                              
  4914.         ermsg = "The parallel module name is longer than 8 characters";         
  4915.         break;                                                                  
  4916.    case ETASKNUM:                                                               
  4917.         ermsg = "The number of tasks specified is invalid";                     
  4918.         break;                                                                  
  4919.    case ENOMEM:                                                                 
  4920.         ermsg = "Insufficient storage for MTF internal areas";                  
  4921.         break;                                                                  
  4922.    case EMODFIND:                                                               
  4923.         ermsg = "The parallel load module was not found";                       
  4924.         break;                                                                  
  4925.    case EMODREAD:                                                               
  4926.         ermsg = "The parallel load module was not sucessfully read";            
  4927.         break;                                                                  
  4928.    case EMODFMT:                                                                
  4929.         ermsg = "The parallel load module format is invalid";                   
  4930.         break;                                                                  
  4931.    case EAUTOALC:                                                               
  4932.         ermsg = "Automatic allocation of standard stream DD failed";            
  4933.         break;                                                                  
  4934.    case ETASKFAIL:                                                              
  4935.         ermsg = "The attempt to attach task(s) has failed";                     
  4936.         break;                                                                  
  4937.    case ETASKABND:                                                              
  4938.         ermsg = "One or more subtasks have abnormally terminated";              
  4939.         break;                                                                  
  4940.    case EBADLNKG:                                                               
  4941.         ermsg = "TSCHED has been invoked via invalid linkage";                  
  4942.         break;                                                                  
  4943.    case ETASKID:                                                                
  4944.         ermsg = "The task ID specified is not valid";                           
  4945.         break;                                                                  
  4946.    case EENTRY:                                                                 
  4947.         ermsg = "The parallel function was not in the parallel module";         
  4948.         break;                                                                  
  4949.    default:                                                                     
  4950.         ermsg = "Unknown MTF error";                                            
  4951.         break;                                                                  
  4952.  }                                                                              
  4953.                                                                                 
  4954.  if (ermsg) {                                                                   
  4955.    fprintf(stderr,"GGSERVER: %s error code %d:\n %s\n",                         
  4956.                   kind, retcode, ermsg);                                        
  4957.  }                                                                              
  4958.                                                                                 
  4959.  return;                                                                        
  4960.                                                                                 
  4961. }                                                                               
  4962.                                                                                 
  4963. ./   ADD NAME=GGMOUTS,SSI=01030000                                              
  4964.                                                                                 
  4965.  /********************************************************************/         
  4966.  /*                                                                  */         
  4967.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4968.  /*                                                                  */         
  4969.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4970.  /* including the implied warranties of merchantability and fitness, */         
  4971.  /* are expressly denied.                                            */         
  4972.  /*                                                                  */         
  4973.  /* Provided this copyright notice is included, this software may    */         
  4974.  /* be freely distributed and not offered for sale.                  */         
  4975.  /*                                                                  */         
  4976.  /* Changes or modifications may be made and used only by the maker  */         
  4977.  /* of same, and not further distributed.  Such modifications should */         
  4978.  /* be mailed to the author for consideration for addition to the    */         
  4979.  /* software and incorporation in subsequent releases.               */         
  4980.  /*                                                                  */         
  4981.  /********************************************************************/         
  4982.                                                                                 
  4983. #pragma  csect(code,  "GG@MOUTS")                                               
  4984. #pragma  csect(static,"GG$MOUTS")                                               
  4985.                                                                                 
  4986. #include "gg.h"                                                                 
  4987.                                                                                 
  4988. /*                                                                              
  4989.  ***********************************************************************        
  4990.  *                                                                     *        
  4991.  * This is a Gopher server routine that outputs data to a socket.      *        
  4992.  *                                                                     *        
  4993.  * If the "socket" is actually a file pointer, then output is          *        
  4994.  * written to the file pointer.                                        *        
  4995.  *                                                                     *        
  4996.  ***********************************************************************        
  4997.  */                                                                             
  4998.                                                                                 
  4999. /*=================================================================*/           
  5000.                                                                                 
  5001. Bool                                                                            
  5002. GGMouts(struct recvstruct *R,                                                   
  5003.         char              *text)                                                
  5004. {                                                                               
  5005.  int                len;                                                        
  5006.  int                reallen;                                                    
  5007.  Bool               rc;                                                         
  5008.  char               outbuf[515];  /* hold an output character string */         
  5009.                                                                                 
  5010.  if (R->outfp) {                    /* if using non-socket interface */         
  5011.    if (fputs(text,R->outfp) < 0) {                                              
  5012.      fprintf(stderr,"Error writing to output file\n");                          
  5013.      return FALSE;                                                              
  5014.    }                                                                            
  5015.    if (fputc('\n',R->outfp) < 0) {                                              
  5016.      fprintf(stderr,"Error writing to output file\n");                          
  5017.      return FALSE;                                                              
  5018.    }                                                                            
  5019.    return TRUE;                                                                 
  5020.  }                                                                              
  5021.                                                                                 
  5022.  if (text == NULL) {                                                            
  5023.    outbuf[0] = '.';                                                             
  5024.    len = 1;                                                                     
  5025.  }                                                                              
  5026.  else {                                                                         
  5027.    len = strlen(text);                                                          
  5028.    if (len >= sizeof(outbuf)-3) len = sizeof(outbuf)-3;                         
  5029.    if (text[0] == '.') {                                                        
  5030.      outbuf[0] = '.';                                                           
  5031.      memcpy(outbuf+1,text,len);                                                 
  5032.      len++;                                                                     
  5033.    }                                                                            
  5034.    else {                                                                       
  5035.      memcpy(outbuf,text,len);                                                   
  5036.    }                                                                            
  5037.  }                                                                              
  5038.  outbuf[len  ] = CARRIAGE_RETURN;                                               
  5039.  outbuf[len+1] = LINE_FEED;                                                     
  5040.  outbuf[len+2] = '\0';                                                          
  5041.  reallen = len + 2;                                                             
  5042.                                                                                 
  5043.  ebdtoasc(outbuf);                                                              
  5044.                                                                                 
  5045.  rc = TRUE;                                                                     
  5046.                                                                                 
  5047.  if (R->outlen + reallen > sizeof(R->sockbuf)) {                                
  5048.                                                                                 
  5049.    if (write(R->sockfd,R->sockbuf,R->outlen) < 0) {                             
  5050.      tcperror("SEND");                                                          
  5051.      rc = FALSE;                                                                
  5052.    }                                                                            
  5053.    R->outlen = 0;                                                               
  5054.  }                                                                              
  5055.                                                                                 
  5056.  memcpy(R->sockbuf + R->outlen, outbuf, reallen);                               
  5057.  R->outlen += reallen;                                                          
  5058.                                                                                 
  5059.  if (text == NULL) {  /* flush socket */                                        
  5060.    if (write(R->sockfd,R->sockbuf,R->outlen) < 0) {                             
  5061.      tcperror("SEND");                                                          
  5062.      rc = FALSE;                                                                
  5063.    }                                                                            
  5064.  }                                                                              
  5065.  return rc;                                                                     
  5066. }                                                                               
  5067.                                                                                 
  5068. ./   ADD NAME=GGMOUTTX,SSI=01010057                                             
  5069.                                                                                 
  5070.  /********************************************************************/         
  5071.  /*                                                                  */         
  5072.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5073.  /*                                                                  */         
  5074.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5075.  /*                                                                  */         
  5076.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5077.  /* including the implied warranties of merchantability and fitness, */         
  5078.  /* are expressly denied.                                            */         
  5079.  /*                                                                  */         
  5080.  /* Provided this copyright notice is included, this software may    */         
  5081.  /* be freely distributed and not offered for sale.                  */         
  5082.  /*                                                                  */         
  5083.  /* Changes or modifications may be made and used only by the maker  */         
  5084.  /* of same, and not further distributed.  Such modifications should */         
  5085.  /* be mailed to the author for consideration for addition to the    */         
  5086.  /* software and incorporation in subsequent releases.               */         
  5087.  /*                                                                  */         
  5088.  /********************************************************************/         
  5089.                                                                                 
  5090. #pragma  csect(code,  "GG@OUTTX")                                               
  5091. #pragma  csect(static,"GG$OUTTX")                                               
  5092. #include "gg.h"                                                                 
  5093.                                                                                 
  5094. /****** Output a line of text retrieved from the server. *************/         
  5095.                                                                                 
  5096. struct textline *                                                               
  5097. GGMouttx(gp,line,ip)                                                            
  5098. Rstruc ggcb         *gp;                                                        
  5099. char                *line;                                                      
  5100. Rstruc gopherinfo   *ip;                                                        
  5101.                                                                                 
  5102. {                                                                               
  5103.  struct texthdr     *thp;                                                       
  5104.  struct textline    *tp;                                                        
  5105.  short              line_length;                                                
  5106.  short              total_text_length;                                          
  5107.  short              tab_expansion_length;                                       
  5108.  Bool               tabs_present;                                               
  5109.  char              *p;                                                          
  5110.  char              *q;                                                          
  5111.  char              *t;                                                          
  5112.  int                e;                                                          
  5113.  int                u;                                                          
  5114.                                                                                 
  5115.  static char        tab_expansion_buffer[8*TEXT_BYTES];                         
  5116.                                                                                 
  5117.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  5118.                                                                                 
  5119.  /* If line starts with double period, make it a single period. */              
  5120.                                                                                 
  5121.  if (ip && memcmp(line,"..",2) == 0) line++;                                    
  5122.                                                                                 
  5123.  /* Add this line to the current queue of server text lines. */                 
  5124.                                                                                 
  5125.  /* First, expand tabs in the line. */                                          
  5126.                                                                                 
  5127.  line_length = strlen(line);                                                    
  5128.  t = strchr(line,'\t');                                                         
  5129.  if (t == NULL) {                                                               
  5130.    tabs_present = FALSE;                                                        
  5131.    total_text_length = line_length + 1;                                         
  5132.  }                                                                              
  5133.  else {                                   /* expand tabs */                     
  5134.    tabs_present = TRUE;                                                         
  5135.    p = line;                                                                    
  5136.    q = line + line_length;                                                      
  5137.    e = 0;                                                                       
  5138.    memset(tab_expansion_buffer,' ',sizeof(tab_expansion_buffer));               
  5139.    while (TRUE) {                                                               
  5140.      u = t-p;                                                                   
  5141.      if (u > 0) {                                                               
  5142.        memcpy(tab_expansion_buffer+e,p,u);                                      
  5143.        e += u;                                                                  
  5144.      }                                                                          
  5145.      if (t == q) break;                                                         
  5146.      e = e / 8 * 8 + 8;                                                         
  5147.      p = t+1;                                                                   
  5148.      t = strchr(p,'\t');                                                        
  5149.      if (t == NULL) t = q;                                                      
  5150.    }                                                                            
  5151.    tab_expansion_length = e;                                                    
  5152.    tab_expansion_buffer[tab_expansion_length] = '\0';                           
  5153.    total_text_length = line_length + tab_expansion_length + 1;                  
  5154.  }                                                                              
  5155.                                                                                 
  5156.  GETMAIN(tp, char, offsetof(struct textline, text) + total_text_length,         
  5157.                    "text line");                                                
  5158.                                                                                 
  5159.  if (tp == NULL) {                                                              
  5160.    ERR1("There is not enough virtual storage to process server text.");         
  5161.    return NULL;                                                                 
  5162.  }                                                                              
  5163.                                                                                 
  5164.  tp->next = NULL;                                                               
  5165.  tp->text_length = line_length;                                                 
  5166.  strcpy(tp->text,line);                                                         
  5167.  if (tabs_present) {                                                            
  5168.    tp->tab_expanded_text_length = tab_expansion_length;                         
  5169.    tp->tab_expanded_text = tp->text + line_length;                              
  5170.    strcpy(tp->tab_expanded_text,tab_expansion_buffer);                          
  5171.  }                                                                              
  5172.  else {                                                                         
  5173.    tp->tab_expanded_text_length = line_length;                                  
  5174.    tp->tab_expanded_text = tp->text;                                            
  5175.  }                                                                              
  5176.                                                                                 
  5177.  if (thp->last_text_line == NULL) {                                             
  5178.    thp->first_text_line   = tp;                                                 
  5179.    thp->text_body_line    = tp;                                                 
  5180.    thp->current_text_line = tp;                                                 
  5181.  }                                                                              
  5182.  else thp->last_text_line->next = tp;                                           
  5183.                                                                                 
  5184.  thp->last_text_line = tp;                                                      
  5185.  thp->text_line_count++;                                                        
  5186.                                                                                 
  5187.  if (thp->text_max_length < tp->text_length)                                    
  5188.      thp->text_max_length = tp->text_length;                                    
  5189.  if (thp->text_max_tab_expanded_length < tp->tab_expanded_text_length)          
  5190.      thp->text_max_tab_expanded_length = tp->tab_expanded_text_length;          
  5191.                                                                                 
  5192.  return tp;                                                                     
  5193.                                                                                 
  5194. }                                                                               
  5195.                                                                                 
  5196. ./   ADD NAME=GGMPMSG,SSI=01000057                                              
  5197.                                                                                 
  5198.  /********************************************************************/         
  5199.  /*                                                                  */         
  5200.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5201.  /*                                                                  */         
  5202.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5203.  /*                                                                  */         
  5204.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5205.  /* including the implied warranties of merchantability and fitness, */         
  5206.  /* are expressly denied.                                            */         
  5207.  /*                                                                  */         
  5208.  /* Provided this copyright notice is included, this software may    */         
  5209.  /* be freely distributed and not offered for sale.                  */         
  5210.  /*                                                                  */         
  5211.  /* Changes or modifications may be made and used only by the maker  */         
  5212.  /* of same, and not further distributed.  Such modifications should */         
  5213.  /* be mailed to the author for consideration for addition to the    */         
  5214.  /* software and incorporation in subsequent releases.               */         
  5215.  /*                                                                  */         
  5216.  /********************************************************************/         
  5217.                                                                                 
  5218. #define  SUPPRESS_V_DECLARATION                                                 
  5219. #pragma  csect(code,  "GG@PMSG ")                                               
  5220. #pragma  csect(static,"GG$PMSG ")                                               
  5221. #include "gg.h"                                                                 
  5222.                                                                                 
  5223. /****** Set an ISPF message, or write to SYSOUT if batch mode. *******/         
  5224.                                                                                 
  5225. void                                                                            
  5226. GGMpmsg(gp,msgtype,msghelp,msgformat) /* also ... for sprintf args */           
  5227. Rstruc ggcb *gp;                                                                
  5228. int          msgtype;                                                           
  5229. char        *msghelp;                                                           
  5230. char        *msgformat;                                                         
  5231. {                                                                               
  5232.  va_list     argp;                                                              
  5233.  char       *cp;                                                                
  5234.  char        zerrsm    [25];                                                    
  5235.  char        zerrhm     [9];                                                    
  5236.  char        zerralrm   [4];                                                    
  5237.  char        zerrlm    [73];                                                    
  5238.  char        buf      [257];                                                    
  5239.                                                                                 
  5240.  va_start(argp,msgformat);                                                      
  5241.  vsprintf(buf,msgformat,argp);                                                  
  5242.  va_end(argp);                                                                  
  5243.                                                                                 
  5244.  cp = strchr(buf,';');                                                          
  5245.  if (cp) {                                                                      
  5246.   *cp = '\0';                                                                   
  5247.   strncpy(zerrsm,buf, sizeof(zerrsm));                                          
  5248.   strncpy(zerrlm,cp+1,sizeof(zerrlm));                                          
  5249.  }                                                                              
  5250.  else {                                                                         
  5251.   strcpy(zerrsm,"");                                                            
  5252.   strncpy(zerrlm,buf,sizeof(zerrlm));                                           
  5253.  }                                                                              
  5254.                                                                                 
  5255.  zerrsm[sizeof(zerrsm)-1] = '\0';                                               
  5256.  zerrlm[sizeof(zerrlm)-1] = '\0';                                               
  5257.                                                                                 
  5258.  if (msghelp) strcpy(zerrhm, msghelp);                                          
  5259.  else         strcpy(zerrhm, "*"    );                                          
  5260.                                                                                 
  5261.  switch (msgtype) {                                                             
  5262.    case NOTIFY_MSG:    strcpy(zerralrm,"NO "); break;                           
  5263.    case WARNING_MSG:                                                            
  5264.    case CRITICAL_MSG:                                                           
  5265.    default:            strcpy(zerralrm,"YES"); break;                           
  5266.  }                                                                              
  5267.                                                                                 
  5268.  (void)GGMivput(gp,"ZERRSM ",  zerrsm,   -1);                                   
  5269.  (void)GGMivput(gp,"ZERRLM ",  zerrlm,   -1);                                   
  5270.  (void)GGMivput(gp,"ZERRHM ",  zerrhm,   -1);                                   
  5271.  (void)GGMivput(gp,"ZERRALRM ",zerralrm, -1);                                   
  5272.                                                                                 
  5273.  if (gp->brifp) {                                                               
  5274.    (void)GGMispf(gp,"SETMSG MSG(ISRZ002)");                                     
  5275.  }                                                                              
  5276.  else {                                                                         
  5277.    gp->setmsg = TRUE;                                                           
  5278.  }                                                                              
  5279.                                                                                 
  5280.  return;                                                                        
  5281. }                                                                               
  5282.                                                                                 
  5283. ./   ADD NAME=GGMPROC,SSI=010F0022                                              
  5284.                                                                                 
  5285.  /********************************************************************/         
  5286.  /*                                                                  */         
  5287.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5288.  /*                                                                  */         
  5289.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5290.  /* including the implied warranties of merchantability and fitness, */         
  5291.  /* are expressly denied.                                            */         
  5292.  /*                                                                  */         
  5293.  /* Provided this copyright notice is included, this software may    */         
  5294.  /* be freely distributed and not offered for sale.                  */         
  5295.  /*                                                                  */         
  5296.  /* Changes or modifications may be made and used only by the maker  */         
  5297.  /* of same, and not further distributed.  Such modifications should */         
  5298.  /* be mailed to the author for consideration for addition to the    */         
  5299.  /* software and incorporation in subsequent releases.               */         
  5300.  /*                                                                  */         
  5301.  /********************************************************************/         
  5302.                                                                                 
  5303. #pragma  csect(code,  "GG@MPROC")                                               
  5304. #pragma  csect(static,"GG$MPROC")                                               
  5305.                                                                                 
  5306. #pragma  linkage(IRXEXEC,OS)                                                    
  5307.                                                                                 
  5308. #include "gg.h"                                                                 
  5309.                                                                                 
  5310. /*=================================================================*/           
  5311.                                                                                 
  5312. /*******************************************************************/           
  5313. /*   This routine cleans up a token.  It converts all chars to     */           
  5314. /*   upper case and removes any leading spaces. Note that the      */           
  5315. /*   string is assumed to be null terminated.                      */           
  5316. /*                                                                 */           
  5317. /*       INPUT    token          pointer to token string.          */           
  5318. /*       OUTPUT   *token         string upcased, blanks removed.   */           
  5319. /*******************************************************************/           
  5320.                                                                                 
  5321. static char *                                                                   
  5322. uppercase_and_trim_leading_space(char *token)                                   
  5323. {                                                                               
  5324.                                                                                 
  5325.  uppercase_in_place(token);                                                     
  5326.                                                                                 
  5327.  return token + strspn(token," ");                                              
  5328. };                                                                              
  5329.                                                                                 
  5330. /*=================================================================*/           
  5331.                                                                                 
  5332. /****************************************************/                          
  5333. /* This routine "cleans" a string by removing the   */                          
  5334. /* leading spaces and trailing spaces+non-printable */                          
  5335. /* characters.                                      */                          
  5336. /****************************************************/                          
  5337.                                                                                 
  5338. static char *                                                                   
  5339. trim_leading_and_trailing_space(char *string)                                   
  5340. {                                                                               
  5341. char *str;                                                                      
  5342. char *ptr;                                                                      
  5343.                                                                                 
  5344.  /*  first clean up the beginning of the string... */                           
  5345.                                                                                 
  5346.  str = string + strspn(string," \t");                                           
  5347.                                                                                 
  5348.  /*    now look at the end of the string... */                                  
  5349.                                                                                 
  5350.  ptr = str+strlen(str)-1;                                                       
  5351.  while (!isgraph(*ptr) && ptr >=str) ptr--;                                     
  5352.  *(ptr+1)=0;                                                                    
  5353.                                                                                 
  5354.  return str;                                                                    
  5355. }                                                                               
  5356.                                                                                 
  5357. /*=================================================================*/           
  5358.                                                                                 
  5359. /****************************************************/                          
  5360. /* This routine "cleans" an output line by removing */                          
  5361. /* trailing spaces and non-printable characters.    */                          
  5362. /****************************************************/                          
  5363.                                                                                 
  5364. static void                                                                     
  5365. trim_trailing_space(char *string)                                               
  5366. {                                                                               
  5367.  char *ptr;                                                                     
  5368.                                                                                 
  5369.  ptr = string;                                                                  
  5370.                                                                                 
  5371.  /*  look at the end of the string... */                                        
  5372.                                                                                 
  5373.  ptr = string+strlen(string)-1;                                                 
  5374.  while (isgraph(*ptr)==0 && ptr >=string) ptr--;                                
  5375.  *(ptr+1)=0;                                                                    
  5376. }                                                                               
  5377.                                                                                 
  5378. /*=================================================================*/           
  5379.                                                                                 
  5380. static void                                                                     
  5381. gbarf(struct recvstruct *R,                                                     
  5382.       char              *message)                                               
  5383. {                                                                               
  5384.  char        temp[257];                                                         
  5385.                                                                                 
  5386.  /* the number should be 2 (ERROR) but some clients may not show it             
  5387.   *             |                                                               
  5388.   *             |                                                               
  5389.   *             |                                                               
  5390.   *             V                                                               
  5391.   */                                                                            
  5392.  sprintf(temp, "1Sorry, %s.\t0\t0\t0", message);                                
  5393.                                                                                 
  5394.  (void)GGMouts(R,temp);                                                         
  5395.                                                                                 
  5396.  return;                                                                        
  5397. }                                                                               
  5398.                                                                                 
  5399. /*=================================================================*/           
  5400.                                                                                 
  5401. static Bool                                                                     
  5402. insure_my_name(struct recvstruct *R)                                            
  5403. {                                                                               
  5404.                                                                                 
  5405.  /* Determine the local path name, if not already set. */                       
  5406.                                                                                 
  5407.  if (!*R->myname) {                                                             
  5408.    if (gethostname(R->myname,MAXHOSTNAMELEN) < 0) {                             
  5409.      fprintf(stderr,"GOPHER:gethostname() failed, can't get my name\n");        
  5410.      gbarf(R,"the GOPHER server had an attack of amnesia");                     
  5411.      return FALSE;                                                              
  5412.    }                                                                            
  5413.  }                                                                              
  5414.                                                                                 
  5415.  return TRUE;                                                                   
  5416.                                                                                 
  5417. }                                                                               
  5418.                                                                                 
  5419. /*=================================================================*/           
  5420.                                                                                 
  5421. static Bool                                                                     
  5422. authorized_file(struct recvstruct *R)                                           
  5423. {                                                                               
  5424.  char    *cp;                                                                   
  5425.  FILE    *afp;                                                                  
  5426.  int      n;                                                                    
  5427.  int      hostcount;                                                            
  5428.  Bool     rc;                                                                   
  5429.  char     filetest[RBUFSIZE];                                                   
  5430.  char     accline [RBUFSIZE];                                                   
  5431.  char     accfile [RBUFSIZE];                                                   
  5432.  char     acchost [RBUFSIZE];                                                   
  5433.                                                                                 
  5434.  /* If non-socket interface, bypass the authorization check. */                 
  5435.                                                                                 
  5436.  if (R->outfp) return TRUE;                                                     
  5437.                                                                                 
  5438.  /* Check that the server is allowed to return data from the file               
  5439.   * specified in R->fileptr.  Note that this could be the name of               
  5440.   * an exec.  The name will be (dataset), EXEC:execname, or DD:file             
  5441.   * - we look at only the first part, whitespace-delimited.                     
  5442.   * Entries in the file authorization table look as above.                      
  5443.   */                                                                            
  5444.                                                                                 
  5445.  rc = FALSE;                                                                    
  5446.  filetest[0] = '\0';                                                            
  5447.  sscanf(R->fileptr,"%s",filetest);                                              
  5448.                                                                                 
  5449.  /* Read authorization file. */                                                 
  5450.                                                                                 
  5451.  afp = fopen(ACCESS_TABLE,"r");                                                 
  5452.  if (!afp) {                                                                    
  5453.    perror(ACCESS_TABLE);                                                        
  5454.    fflush(stderr);                                                              
  5455.    return FALSE;                                                                
  5456.  }                                                                              
  5457.                                                                                 
  5458.  for (;;) {                                                                     
  5459.    fgets(accline, sizeof(accline), afp);                                        
  5460.    if (ferror(afp)) {                                                           
  5461.      fprintf(stderr,"Error reading access table %s\n",ACCESS_TABLE);            
  5462.      fflush(stderr);                                                            
  5463.      break;                                                                     
  5464.    }                                                                            
  5465.    if (feof(afp)) break;                                                        
  5466.    /* format of line is: filename machine(s) */                                 
  5467.    uppercase_in_place(accline);                                                 
  5468.    cp = accline;                      /* Start scan pointer         */          
  5469.    *accfile = '\0';                   /* Clear access file name     */          
  5470.    sscanf(cp,"%s %n",accfile,&n);     /* Get file name, bump scan   */          
  5471.    if (!strcmp(filetest,accfile)) {   /* If file name matches       */          
  5472.      hostcount = 0;                   /* Clear access host count    */          
  5473.      for (;;) {                       /* Loop over access host ids  */          
  5474.        cp += n;                       /* Bump to next word in file  */          
  5475.        *acchost = '\0';               /* Clear word before scanf    */          
  5476.        sscanf(cp,"%s %n",acchost,&n); /* Get next word, bump scan   */          
  5477.        if (!*acchost) break;          /* exit loop if no more hosts */          
  5478.        hostcount++;                   /* increment access host count*/          
  5479.        if (!strcmp(R->hostname,acchost)                                         
  5480.         || !strcmp(R->hosttest,acchost)) { /* if hostname matches */            
  5481.          rc = TRUE;                        /* access is allowed   */            
  5482.          break;                                                                 
  5483.        }                                                                        
  5484.      }                                                                          
  5485.      if (!rc) {                       /* If no matching host found  */          
  5486.        if (hostcount == 0) rc = TRUE; /* if no access hosts, say OK */          
  5487.      }                                                                          
  5488.      if (rc) break;                   /* if access OK, finished     */          
  5489.                                                                                 
  5490.      /* If access is not permitted, we keep checking because                    
  5491.       * there may be more than one entry in the access table                    
  5492.       * for this file, so that many host names can be given.                    
  5493.       */                                                                        
  5494.                                                                                 
  5495.    }                                                                            
  5496.  }                                                                              
  5497.                                                                                 
  5498.  (void)fclose(afp);                                                             
  5499.                                                                                 
  5500.  if (!rc) {                                                                     
  5501.    fprintf(stderr,"Not authorized from %s: '%s'\n",                             
  5502.                   R->hosttest, filetest);                                       
  5503.  }                                                                              
  5504.                                                                                 
  5505.  fflush(stderr);                                                                
  5506.                                                                                 
  5507.  return rc;                                                                     
  5508. }                                                                               
  5509.                                                                                 
  5510. /*=================================================================*/           
  5511.                                                                                 
  5512. /*******************************************************************/           
  5513. /*            This routine determines what type of gopher file     */           
  5514. /*            we've opened.  We'll return the file type to the     */           
  5515. /*            caller.                                              */           
  5516. /*                                                                 */           
  5517. /*            INPUT:   ident   pointer to first line of file       */           
  5518. /*                                                                 */           
  5519. /*            OUTPUT:   MENU   file type is a menu                 */           
  5520. /*                      FILE   file type is a file                 */           
  5521. /*                      INDEX  file type is an INDEX (not done)    */           
  5522. /*******************************************************************/           
  5523.                                                                                 
  5524. static char                                                                     
  5525. getftype(char *ident)                                                           
  5526. {                                                                               
  5527.  int   x;                              /* loop counter */                       
  5528.  char  buffer[RBUFSIZE];                                                        
  5529.  char *bufptr;                                                                  
  5530.                                                                                 
  5531.  /**********/                                                                   
  5532.  /*   first, convert the string to upper case...   */                           
  5533.  /*********/                                                                    
  5534.  strcpy(buffer,ident);                                                          
  5535.  bufptr = uppercase_and_trim_leading_space(buffer);                             
  5536.                                                                                 
  5537.  /**********/                                                                   
  5538.  /*   return the type of file.                     */                           
  5539.  /*********/                                                                    
  5540.                                                                                 
  5541.  if(strcmp(bufptr,MENUIDENT)==0) return(MENU);                                  
  5542.  if(strcmp(bufptr,INDEXIDENT)==0) return(INDEX);                                
  5543.                                                                                 
  5544.  /**********/                                                                   
  5545.  /*   don't know, so assume it's a "file" file...    */                         
  5546.  /*********/                                                                    
  5547.                                                                                 
  5548.  return(GFILE);                                                                 
  5549.                                                                                 
  5550. }                                                                               
  5551.                                                                                 
  5552. /*=================================================================*/           
  5553.                                                                                 
  5554. /*******************************************************************/           
  5555. /*            This routine figures out what type of parm line      */           
  5556. /*            the current line is.  We'll return the token         */           
  5557. /*            type to the caller.                                  */           
  5558. /*                                                                 */           
  5559. /*            INPUT:   buffer  pointer to first line of file       */           
  5560. /*                       (Note: string must be null terminated!    */           
  5561. /*            OUTPUT:   Type of token.  (See in include file...)   */           
  5562. /*******************************************************************/           
  5563.                                                                                 
  5564. static int                                                                      
  5565. menukeywd(char  *buffer,                                                        
  5566.           char  *token,                                                         
  5567.           char  *operand)                                                       
  5568. {                                                                               
  5569.  int             x;                              /* loop counter */             
  5570.  char           *tokval;                                                        
  5571.  char           *oprval;                                                        
  5572.  char           *tokptr;                                                        
  5573.  char            tokstr[256];                                                   
  5574.                                                                                 
  5575.  strcpy(tokstr,buffer);                                                         
  5576.  tokval=strtok(tokstr,"=");                                                     
  5577.  oprval=strtok(NULL,"");                                                        
  5578.  strcpy(token,tokval);                                                          
  5579.  strcpy(operand,oprval);                                                        
  5580.  tokptr = uppercase_and_trim_leading_space(token);                              
  5581.                                                                                 
  5582.  /*********/                                                                    
  5583.  /*  now look at the tokens to see if we have a weener... */                    
  5584.  /*********/                                                                    
  5585.                                                                                 
  5586.  if(strcmp(tokptr,TOKTYPE)==0) return(TYPETOK);                                 
  5587.  if(strcmp(tokptr,TOKNAME)==0) return(NAMETOK);                                 
  5588.  if(strcmp(tokptr,TOKPATH)==0) return(PATHTOK);                                 
  5589.  if(strcmp(tokptr,TOKHOST)==0) return(HOSTTOK);                                 
  5590.  if(strcmp(tokptr,TOKPORT)==0) return(PORTTOK);                                 
  5591.  if(strcmp(tokptr,TOKEND)==0) return(ENDTOK);                                   
  5592.                                                                                 
  5593.  /* for back compatibility with the old MVS GOPHER server */                    
  5594.                                                                                 
  5595.  if(strcmp(tokptr,TOKDISPLAY)==0) return(DISPLAYTOK);                           
  5596.  if(strcmp(tokptr,TOKSELECT)==0) return(SELECTTOK);                             
  5597.                                                                                 
  5598.  return(COMMENTTOK);                                                            
  5599.                                                                                 
  5600. }                                                                               
  5601.                                                                                 
  5602. /*=================================================================*/           
  5603.                                                                                 
  5604. /*******************************************************************/           
  5605. /*       This routine reads a line from the specified file.        */           
  5606. /*       if a read error occurs, an error message is printed and   */           
  5607. /*       FALSE is returned.                                        */           
  5608. /*                                                                 */           
  5609. /*       INPUT   buffer      pointer to buffer to place line       */           
  5610. /*               readfile    file structure to read from           */           
  5611. /*                                                                 */           
  5612. /*       OUTPUT  buffer      line that was read from the file      */           
  5613. /*               TRUE        read worked ok                        */           
  5614. /*               FALSE       read failed!                          */           
  5615. /*******************************************************************/           
  5616.                                                                                 
  5617. static Bool                                                                     
  5618. readaline(struct recvstruct *R)                                                 
  5619. {                                                                               
  5620.                                                                                 
  5621.  memset(R->buffer,0,RBUFSIZE);                                                  
  5622.  fread(R->buffer,RBUFSIZE,1,R->readfile);                                       
  5623.  if (ferror(R->readfile)) {                                                     
  5624.    /* perror("FREAD"); */                                                       
  5625.    fprintf(stderr,"GGSTASK: Error reading file\n");                             
  5626.    return(FALSE);                                                               
  5627.  }                                                                              
  5628.  trim_trailing_space(R->buffer); /* Remove trailing whitespace */               
  5629.  return(TRUE);                                                                  
  5630. }                                                                               
  5631.                                                                                 
  5632. /*=================================================================*/           
  5633.                                                                                 
  5634. /*******************************************************************/           
  5635. /*   This routine sends a file to the calling client.              */           
  5636. /*   It assumes the file is a text formatted file.                 */           
  5637. /*   INPUT:   buffer    pointer to the already read line...        */           
  5638. /*            readfile  file we're going to read from..            */           
  5639. /*            maxlen    size of the buffer.                        */           
  5640. /*            sockfd    socket descriptor for client.              */           
  5641. /*                                                                 */           
  5642. /*   OUTPUT:   send the file to the client                         */           
  5643. /*******************************************************************/           
  5644. static void                                                                     
  5645. sendafile(struct recvstruct *R)                                                 
  5646. {                                                                               
  5647.  int            x;                                                              
  5648.  char          *moveit;                                                         
  5649.                                                                                 
  5650.  /*******/                                                                      
  5651.  /*   send the first line (cause we already read it) */                         
  5652.  /*******/                                                                      
  5653.                                                                                 
  5654.  if (!GGMouts(R,R->buffer)) return;                                             
  5655.                                                                                 
  5656.  /*******/                                                                      
  5657.  /*   get the rest of the lines of the file and send them... */                 
  5658.  /*******/                                                                      
  5659.                                                                                 
  5660.  for (;;) {                                                                     
  5661.    if (!readaline(R)) {                                                         
  5662.      (void)GGMouts(R,"<<<*** I/O ERROR ON MVS FILE ***>>>");                    
  5663.      return;                                                                    
  5664.    }                                                                            
  5665.    if (feof(R->readfile)) break;                                                
  5666.    if (!GGMouts(R,R->buffer)) return;                                           
  5667.  }                                                                              
  5668. }                                                                               
  5669.                                                                                 
  5670. /*=================================================================*/           
  5671.                                                                                 
  5672. /*******************************************************************/           
  5673. /*   This routine formats a menu file into gopher data & sends it  */           
  5674. /*   to the client.                                                */           
  5675. /*   INPUT:   buffer    pointer to the already read line...        */           
  5676. /*            readfile  file we're going to read from..            */           
  5677. /*            maxlen    size of the buffer.                        */           
  5678. /*            sockfd    socket descriptor for client               */           
  5679. /*                                                                 */           
  5680. /*   OUTPUT:   send the menu to the client                         */           
  5681. /*******************************************************************/           
  5682.                                                                                 
  5683. #define MENU_STUFF_SIZE GOPHER_DESC_LENGTH + \                                  
  5684.                         GOPHER_PATH_LENGTH + \                                  
  5685.                         GOPHER_HOST_LENGTH + 20                                 
  5686.                                                                                 
  5687. static void                                                                     
  5688. sendamenu(struct recvstruct *R)                                                 
  5689. {                                                                               
  5690.  char           *moveit;                                                        
  5691.  char           *operptr;                                                       
  5692.  char           *typeoftype;             /*pointer for strtok   */              
  5693.  char           *cp;                                                            
  5694.  int             kindotoken;                                                    
  5695.  int             x;                         /* loop counter */                  
  5696.  char            token   [133];                                                 
  5697.  char            operand [133];                                                 
  5698.  char            outbuf  [MENU_STUFF_SIZE];                                     
  5699.  struct menuitem menu;                                                          
  5700.                                                                                 
  5701.  memset(&menu,0,sizeof menu );                                                  
  5702.  for (;;) {                                                                     
  5703.    if (!readaline(R)) break;                                                    
  5704.    if (feof(R->readfile)) break;                                                
  5705.    if (!*R->buffer) continue;                                                   
  5706.    kindotoken = menukeywd(R->buffer,token,operand);                             
  5707.    switch(kindotoken) {                                                         
  5708.      case TYPETOK:                                                              
  5709.           operptr = uppercase_and_trim_leading_space(operand);                  
  5710.           typeoftype = strtok(operptr," ");                                     
  5711.           if (strlen(typeoftype) == 1)      menu.type = *typeoftype;            
  5712.           else                                                                  
  5713.           if (EQUAL(typeoftype,TYPEFILE))   menu.type = GFILE;                  
  5714.           else                                                                  
  5715.           if (EQUAL(typeoftype,TYPEMENU))   menu.type = MENU;                   
  5716.           else                                                                  
  5717.           if (EQUAL(typeoftype,TYPEINDEX))  menu.type = INDEX;                  
  5718.           else                                                                  
  5719.           if (EQUAL(typeoftype,TYPETELNET)) menu.type = TELNET;                 
  5720.           else                                                                  
  5721.           if (EQUAL(typeoftype,TYPEWHOIS))  menu.type = WHOIS;                  
  5722.           else                              menu.type = ERROR;                  
  5723.           break;                                                                
  5724.      case NAMETOK:                                                              
  5725.      case DISPLAYTOK:                                                           
  5726.           strncpy(menu.desc,     operptr, sizeof(menu.desc));                   
  5727.           break;                                                                
  5728.      case PATHTOK:                                                              
  5729.      case SELECTTOK:                                                            
  5730.           strncpy(menu.select,   operptr, sizeof(menu.select));                 
  5731.           break;                                                                
  5732.      case HOSTTOK:                                                              
  5733.           if (EQUAL(operptr,IDENT_HOST_FROB)) {  /* HOST=+  */                  
  5734.             if (insure_my_name(R)) {                                            
  5735.               strncpy(menu.hostname, R->myname, sizeof(menu.hostname));         
  5736.             }                                                                   
  5737.           }                                                                     
  5738.           else {                                                                
  5739.             strncpy(menu.hostname, operptr, sizeof(menu.hostname));             
  5740.           }                                                                     
  5741.           break;                                                                
  5742.      case PORTTOK:                                                              
  5743.           if (EQUAL(operptr,IDENT_HOST_FROB)) {  /* PORT=+  */                  
  5744.             menu.port = SERV_TCP_PORT;                                          
  5745.           }                                                                     
  5746.           else {                                                                
  5747.             menu.port=atoi(operptr);                                            
  5748.           }                                                                     
  5749.           break;                                                                
  5750.      case ENDTOK:                                                               
  5751.           if (menu.type==TELNET && menu.port==0) menu.port=0; /* ??? */         
  5752.           else if (menu.port==0) menu.port=GOPHER_PORT_NUMBER;                  
  5753.           /* If host is local and path is in the form "(member)",               
  5754.            * and current dsname is a PDS, then use same PDS:                    
  5755.            * i.e. turn PATH=(FOOBAR) into PATH=AA.BB.CC(FOOBAR)                 
  5756.            */                                                                   
  5757.           if (*R->myname                                                        
  5758.            && EQUAL(menu.hostname,R->myname)                                    
  5759.            && *menu.select == '('        /* ) */                                
  5760.            && (cp = strchr(R->dsname,'(' /* ) */ ))) {                          
  5761.             memcpy(outbuf, R->dsname, (cp-R->dsname));                          
  5762.             strcpy(outbuf+(cp-R->dsname), menu.select);                         
  5763.             strncpy(menu.select, outbuf, sizeof(menu.select));                  
  5764.           }                                                                     
  5765.           if (*menu.desc && *menu.hostname) {                                   
  5766.             sprintf(outbuf,"%c%s\t%s\t%s\t%d",                                  
  5767.                            menu.type,menu.desc,                                 
  5768.                            menu.select,menu.hostname,menu.port);                
  5769.             if (!GGMouts(R,outbuf)) return;                                     
  5770.           }                                                                     
  5771.           fflush(stdout);                                                       
  5772.           memset(&menu,0,sizeof menu );                                         
  5773.           break;                                                                
  5774.      default:                                                                   
  5775.           break;                                                                
  5776.        }                                                                        
  5777.    }                                                                            
  5778. }                                                                               
  5779.                                                                                 
  5780. /*=================================================================*/           
  5781.                                                                                 
  5782. static Bool                                                                     
  5783. get_directory(struct recvstruct *R)                                             
  5784. {                                                                               
  5785.  FILE              *dirfile;                                                    
  5786.  int                i;                                                          
  5787.  short              block_count;                                                
  5788.  short              bump_amount;                                                
  5789.  Bool               reject;                                                     
  5790.  Bool               no_more;                                                    
  5791.  char              *cp;                                                         
  5792.  char              *mp;                                                         
  5793.  char               dirblk  [256];                                              
  5794.  char               pdsspec [256];                                              
  5795.  char               entry   [256];                                              
  5796.                                                                                 
  5797.  /* The local path name is required for this function. */                       
  5798.                                                                                 
  5799.  if (!insure_my_name(R)) return FALSE;                                          
  5800.                                                                                 
  5801.  if ((dirfile=fopen(R->buffer,"rb,recfm=u,lrecl=256")) == NULL) {               
  5802.    perror(R->buffer);                                                           
  5803.    printf("Can't open PDS directory:%s\n",R->dsname);                           
  5804.    gbarf(R,"the GOPHER server can't open the directory");                       
  5805.    return(FALSE);                                                               
  5806.  }                                                                              
  5807.                                                                                 
  5808.  while (!feof(dirfile)) {                                                       
  5809.                                                                                 
  5810.    no_more = FALSE;                                                             
  5811.                                                                                 
  5812.    do {                                                                         
  5813.      memset(dirblk,0x00,256);                                                   
  5814.      fread(dirblk,256,1,dirfile);                                               
  5815.      if (feof(dirfile)) break;                                                  
  5816.      if (ferror(dirfile)) {                                                     
  5817.        printf("Can't read PDS directory:%s\n", R->fileptr);                     
  5818.        gbarf(R,"the GOPHER server can't read the directory");                   
  5819.        fclose(dirfile);                                                         
  5820.        return FALSE;                                                            
  5821.      }                                                                          
  5822.      mp = dirblk;                                                               
  5823.      block_count = *(short *)mp - 2;   /* # bytes in dir block */               
  5824.      mp += 2;                        /* addr of dir block data */               
  5825.      while (block_count > 0) {                                                  
  5826.        if (memcmp(mp,"\xff\xff\xff\xff\xff\xff\xff\xff",8)==0) break;           
  5827.        reject = FALSE;                                                          
  5828.        /*                                                                       
  5829.         * Uncomment this if you want to skip aliases.                           
  5830.         * It is recommended that you let aliases through, since                 
  5831.         * they often have better names (e.g. TSO HELP files)                    
  5832.         *                                                                       
  5833.         * if ((mp[11] & 0x80) != 0) {                                           
  5834.         *   fprintf(stderr,"Skipping alias:  %-8.8s\n",mp);                     
  5835.         *   reject = TRUE;                                                      
  5836.         * }                                                                     
  5837.         */                                                                      
  5838.        if (!reject) {                                                           
  5839.          strcpy(pdsspec, R->dsname);                                            
  5840.          cp = strchr(pdsspec, '\0');                                            
  5841.          *(cp++) = '(';                                                         
  5842.          for (i = 0; i < 8 && mp[i] != ' '; cp++, i++) *cp = mp[i];             
  5843.          *(cp++) = ')';                                                         
  5844.          *cp = '\0';                                                            
  5845.          sprintf(entry,"0%8.8s\t%s\t%s\t%d",                                    
  5846.                        mp, pdsspec, R->myname, SERV_TCP_PORT);                  
  5847.          (void)GGMouts(R,entry);                                                
  5848.        }                                                                        
  5849.        bump_amount = 12 + ((mp[11] & 0x1f) * 2);                                
  5850.        mp += bump_amount;                                                       
  5851.        block_count -= bump_amount;                                              
  5852.      }                                                                          
  5853.    } while(!no_more);                                                           
  5854.                                                                                 
  5855.  }                                                                              
  5856.                                                                                 
  5857.  fclose(dirfile);                                                               
  5858.  return TRUE;                                                                   
  5859. }                                                                               
  5860.                                                                                 
  5861. /*=================================================================*/           
  5862.                                                                                 
  5863. static Bool                                                                     
  5864. get_flat_file(struct recvstruct *R)                                             
  5865. {                                                                               
  5866.  int                x;            /* loop counter*/                             
  5867.  int                numread;      /* number of items read... */                 
  5868.  char               filetype;     /* type of file we're dealing with*/          
  5869.                                                                                 
  5870.  if ((R->readfile=fopen(R->buffer,"rb,type=record")) == NULL) {                 
  5871.    perror(R->buffer);                                                           
  5872.    printf("INVALID! requested:%s\n",R->fileptr);                                
  5873.    gbarf(R,"the GOPHER server couldn't open the file");                         
  5874.    return(FALSE);                                                               
  5875.  }                                                                              
  5876.                                                                                 
  5877.  /************/                                                                 
  5878.  /*  get the first line and see what type of file we've got.      */            
  5879.  /************/                                                                 
  5880.                                                                                 
  5881.  if (readaline(R) && !feof(R->readfile)) {                                      
  5882.                                                                                 
  5883.    filetype=getftype(R->buffer);                                                
  5884.                                                                                 
  5885.   /************/                                                                
  5886.   /*  Now let's go do whatever we need to for this file type.    */             
  5887.   /************/                                                                
  5888.                                                                                 
  5889.    switch(filetype) {                                                           
  5890.      case MENU:                                                                 
  5891.                  sendamenu(R);                                                  
  5892.                  break;                                                         
  5893.      case GFILE:                                                                
  5894.      default:                                                                   
  5895.                  sendafile(R);                                                  
  5896.                  break;                                                         
  5897.    }                                                                            
  5898.                                                                                 
  5899.  }                                                                              
  5900.                                                                                 
  5901.  if(fclose(R->readfile) < 0) {                                                  
  5902.    /* perror("PROCESS CLOSE"); */                                               
  5903.    fprintf(stderr,"GGSTASK: Error closing file %s\n",R->fileptr);               
  5904.    gbarf(R,"the GOPHER server couldn't close the file");                        
  5905.    return FALSE;                                                                
  5906.  }                                                                              
  5907.                                                                                 
  5908.  return TRUE;                                                                   
  5909.                                                                                 
  5910. }                                                                               
  5911.                                                                                 
  5912. /*=================================================================*/           
  5913.                                                                                 
  5914. #define PARAMETER   unsigned int                                                
  5915. #define LASTPARM(X) ((unsigned int)(X) | 0x80000000)                            
  5916.                                                                                 
  5917.                                                                                 
  5918. static Bool                                                                     
  5919. get_exec_data(struct recvstruct *R)                                             
  5920. {                                                                               
  5921.  char              *command;                                                    
  5922.  char              *commandargs;                                                
  5923.  unsigned int       bitflags;                                                   
  5924.  int                rexxrc;                                                     
  5925.  int                irxexecrc;                                                  
  5926.  int                commandlength;                                              
  5927.  int                scan_count;                                                 
  5928.  int                i;                                                          
  5929.  Bool               rc;                                                         
  5930.  int              (*irxexec)();                                                 
  5931.  FILE              *fp;                                                         
  5932.  char               exectest[RBUFSIZE];                                         
  5933.  PARAMETER          parameter[11];                                              
  5934.  struct {                                                                       
  5935.                          /* repeat this block for each argument */              
  5936.          char      *argstring_ptr;                                              
  5937.          int        argstring_length;                                           
  5938.                          /* end repeat this block for each argument */          
  5939.          int        argstring_end;                                              
  5940.         }           arguments;                                                  
  5941.                                                                                 
  5942.  struct {                                                                       
  5943.          char       acryn[8];       /* "IRXEXECB" */                            
  5944.          int        length;                                                     
  5945.          int        reserved1;                                                  
  5946.          char       member[8];                                                  
  5947.          char       ddname[8];                                                  
  5948.          char       subcom[8];                                                  
  5949.          char      *dsnptr;                                                     
  5950.          int        dsnlen;                                                     
  5951.         }           execblk;                                                    
  5952.                                                                                 
  5953.   /*                                                                            
  5954.    * Menu item should look like this:                                           
  5955.    *                                                                            
  5956.    * exec:rexxname any args                                                     
  5957.    *                                                                            
  5958.    * The exec should write output to SYSTSPRT.  Normal TSO command              
  5959.    * output will be captured by the SYSTSPRT allocation only if                 
  5960.    * the Gopher server is run as a batch job.                                   
  5961.    *                                                                            
  5962.    * If this was sent by the client with a type 7 or type w, then               
  5963.    * additional args will appear at the end delimited by a space.               
  5964.    */                                                                           
  5965.                                                                                 
  5966.  irxexec = NULL;                                                                
  5967.  rc = TRUE;                                                                     
  5968.  scan_count = 0;                                                                
  5969.                                                                                 
  5970.  if (R->wargptr) {                                                              
  5971.    commandlength = strlen(R->fileptr) + strlen(R->wargptr) + 4;                 
  5972.    command = (char *)malloc(commandlength);                                     
  5973.    if (!command) {                                                              
  5974.      printf("Cannot allocate %d bytes of memory for exec\n",                    
  5975.             commandlength);                                                     
  5976.      gbarf(R,"the GOPHER server ran out of memory");                            
  5977.      return FALSE;                                                              
  5978.    }                                                                            
  5979.    else sprintf(command,"%s %s",R->fileptr,R->wargptr);                         
  5980.  }                                                                              
  5981.  else {                                                                         
  5982.    commandlength = 0;                                                           
  5983.    command = R->fileptr;                                                        
  5984.  }                                                                              
  5985.                                                                                 
  5986.  *exectest = '\0';                                                              
  5987.  sscanf(command, "%s %n", exectest, &scan_count);                               
  5988.  if (strlen(exectest) > 8) {                                                    
  5989.    gbarf(R,"name of exec is too long");                                         
  5990.    return FALSE;                                                                
  5991.  }                                                                              
  5992.  commandargs = command + scan_count;                                            
  5993.                                                                                 
  5994.  if (rc) {                                                                      
  5995.    irxexec = (int(*)())fetch("IRXEXEC");                                        
  5996.    if (!irxexec) {                                                              
  5997.      printf("Cannot fetch IRXEXEC\n");                                          
  5998.      rc = FALSE;                                                                
  5999.    }                                                                            
  6000.  }                                                                              
  6001.                                                                                 
  6002.  /* Give the exec an empty SYSTSPRT file to write into.                         
  6003.   * Then when we read it we can see only what was added.                        
  6004.   * Since IRXEXEC doesn't close SYSTSPRT, we can't remove it                    
  6005.   * and reallocate it.                                                          
  6006.   */                                                                            
  6007.                                                                                 
  6008.  if (rc) {                                                                      
  6009.    fp = fopen("DD:SYSTSPRT","w");                                               
  6010.    if (!fp) {                                                                   
  6011.      perror("DD:SYSTSPRT");                                                     
  6012.      printf("Cannot open SYSTSPRT to prepare for REXX exec\n");                 
  6013.      rc = FALSE;                                                                
  6014.    }                                                                            
  6015.                                                                                 
  6016.    /* Open for write + close = clear it out */                                  
  6017.                                                                                 
  6018.    else if (fclose(fp) < 0) {                                                   
  6019.      printf("Cannot close SYSTSPRT to prepare for REXX exec\n");                
  6020.      rc = FALSE;                                                                
  6021.    }                                                                            
  6022.  }                                                                              
  6023.                                                                                 
  6024.  /* Set up parameters for IRXEXEC:                                              
  6025.   *                                                                             
  6026.   * Param 1  -  address of EXECBLK                                              
  6027.   * Param 2  -  address of arguments                                            
  6028.   * Param 3  -  bitflags                                                        
  6029.   * Param 4  -  address of INSTBLK                                              
  6030.   * Param 5  -  address of CPPL                                                 
  6031.   * Param 6  -  address of EVALBLOCK                                            
  6032.   * Param 7  -  address of 8-byte work area                                     
  6033.   * Param 8  -  address of user field                                           
  6034.   * Param 9  -  address of environment block                                    
  6035.   * Param 10 -  return code                                                     
  6036.   *                                                                             
  6037.   */                                                                            
  6038.                                                                                 
  6039.  if (rc) {                                                                      
  6040.                                                                                 
  6041.    /* set up exec block */                                                      
  6042.                                                                                 
  6043.    memset (&execblk, 0, sizeof(execblk));                                       
  6044.    execblk.length = sizeof(execblk);                                            
  6045.    memcpy (execblk.acryn, "IRXEXECB", 8);                                       
  6046.    strncpy(execblk.member,exectest,8);                                          
  6047.    for (i=0;i<8;i++) {                                                          
  6048.      if (execblk.member[i] == '\0')                                             
  6049.          execblk.member[i] = ' ';                                               
  6050.    }                                                                            
  6051.    /* We may have just clobbered this, so do this after... */                   
  6052.                                                                                 
  6053.    memcpy (execblk.ddname, REXX_EXEC_LIBRARY_DDNAME, 8);                        
  6054.    memcpy (execblk.subcom, REXX_EXEC_SUBCOM,     8);                            
  6055.                                                                                 
  6056.    /* set up arguments  */                                                      
  6057.                                                                                 
  6058.    arguments.argstring_ptr    = commandargs;                                    
  6059.    arguments.argstring_length = strlen(commandargs);                            
  6060.    arguments.argstring_end    = 0xffffffff;                                     
  6061.                                                                                 
  6062.    /* Invoke the rexx exec */                                                   
  6063.                                                                                 
  6064.    if (!R->outfp) printf("Executing:%s\n", command);                            
  6065.                                                                                 
  6066. #define INVOKE_EXEC_AS_COMMAND            (unsigned int)0x80000000              
  6067. #define INVOKE_EXEC_AS_EXTERNAL_FUNCTION  (unsigned int)0x40000000              
  6068. #define INVOKE_EXEC_AS_SUBROUTINE         (unsigned int)0x20000000              
  6069. #define RETURN_EXTENDED_RETURN_CODES      (unsigned int)0x10000000              
  6070.                                                                                 
  6071.    rexxrc = 0;                                                                  
  6072.    bitflags = (unsigned int)(INVOKE_EXEC_AS_COMMAND +                           
  6073.                              RETURN_EXTENDED_RETURN_CODES);                     
  6074.                                                                                 
  6075.    parameter[ 1] =   (PARAMETER)&execblk;                                       
  6076.    parameter[ 2] =   (PARAMETER)&arguments;                                     
  6077.    parameter[ 3] =   (PARAMETER)bitflags;                                       
  6078.    parameter[ 4] =   (PARAMETER)NULL;  /* no INSTBLK */                         
  6079.    parameter[ 5] =   (PARAMETER)NULL;  /* no CPPL    */                         
  6080.    parameter[ 6] =   (PARAMETER)NULL;  /* no eval block */                      
  6081.    parameter[ 7] =   (PARAMETER)NULL;  /* no work area */                       
  6082.    parameter[ 8] =   (PARAMETER)NULL;  /* no user field, last parm */           
  6083.    parameter[ 9] =   (PARAMETER)NULL;  /* no environment block */               
  6084.    parameter[10] =   (PARAMETER)0;     /* return code */                        
  6085.                                                                                 
  6086.    irxexecrc = (*irxexec) (                                                     
  6087.                            ¶meter[1],                                       
  6088.                            ¶meter[2],                                       
  6089.                            ¶meter[3],                                       
  6090.                            ¶meter[4],                                       
  6091.                            ¶meter[5],                                       
  6092.                            ¶meter[6],                                       
  6093.                            ¶meter[7],                                       
  6094.                            LASTPARM(¶meter[8]), /* old REXX */              
  6095.                            ¶meter[9],                                       
  6096.                            LASTPARM(¶meter[10]) /* new REXX */              
  6097.                           );                                                    
  6098.                                                                                 
  6099.    if (irxexecrc != 0) {                                                        
  6100.      fprintf(stderr,"Return code from IRXEXEC is %d\n", irxexecrc);             
  6101.      gbarf(R,"the Gopher server was unable to run the exec");                   
  6102.      rc = FALSE;                                                                
  6103.    }                                                                            
  6104.    else {                                                                       
  6105.                                                                                 
  6106.      rexxrc = parameter[10];                                                    
  6107.                                                                                 
  6108.      if (!R->outfp) printf("Return code from exec is %d\n", rexxrc);            
  6109.                                                                                 
  6110.      /* Read what the exec wrote. */                                            
  6111.                                                                                 
  6112.      strcpy(R->buffer,"DD:SYSTSPRT");                                           
  6113.      R->fileptr = R->buffer;                                                    
  6114.      rc = get_flat_file(R);                                                     
  6115.                                                                                 
  6116.    }                                                                            
  6117.                                                                                 
  6118.  }                                                                              
  6119.                                                                                 
  6120.  else {                                                                         
  6121.      gbarf(R,"the GOPHER server had a problem with the exec");                  
  6122.  }                                                                              
  6123.                                                                                 
  6124.  if (irxexec) release((void (*)())irxexec);                                     
  6125.                                                                                 
  6126.  if (commandlength > 0) free(command);                                          
  6127.                                                                                 
  6128.  return rc;                                                                     
  6129.                                                                                 
  6130. }                                                                               
  6131.                                                                                 
  6132. /*=================================================================*/           
  6133.                                                                                 
  6134. /*******************************************************************/           
  6135. /*   This routine Processes the file the user requested.           */           
  6136. /*   If it's a menu, we'll form a menu line, if it's a             */           
  6137. /*   file, we'll just send it as is.                               */           
  6138. /*                                                                 */           
  6139. /*   INPUT:   filename  pointer to the file name to open           */           
  6140. /*            sockfd    socket descriptor for the client           */           
  6141. /*                                                                 */           
  6142. /*   OUTPUT:   print "gopher" lines.                               */           
  6143. /*             TRUE  - file printed ok.                            */           
  6144. /*             FALSE - Error reading or writing                    */           
  6145. /*******************************************************************/           
  6146.                                                                                 
  6147. Bool                                                                            
  6148. GGMproc(struct recvstruct *R)                                                   
  6149. {                                                                               
  6150.  int                x;            /* loop counter*/                             
  6151.  int                numread;      /* number of items read... */                 
  6152.  int                hacksize;     /* length of hack prefix before : */          
  6153.  Bool               rc;           /* return value */                            
  6154.  enum data_set_type dstype;       /* SEQ, PDS or UNK */                         
  6155.  char              *p;                                                          
  6156.  char              *q;                                                          
  6157.  char              *tabptr;                                                     
  6158.  char              *colonptr;                                                   
  6159.  char               ddname    [  9];                                            
  6160.  char               hackprefix[ 17];                                            
  6161.                                                                                 
  6162.  *ddname     = '\0';                                                            
  6163.  *hackprefix = '\0';                                                            
  6164.                                                                                 
  6165.  /************/                                                                 
  6166.  /*  First, strip off any "bad" characters from the arguments. */               
  6167.  /************/                                                                 
  6168.                                                                                 
  6169.  /*                                                                             
  6170.   * Break the argument up into one or two pieces delimited by tab.              
  6171.   */                                                                            
  6172.                                                                                 
  6173.  R->fileptr = R->buffer;        /* filename passed in buffer */                 
  6174.                                                                                 
  6175.  tabptr = strchr(R->fileptr,'\t');                                              
  6176.  if (tabptr) {                                                                  
  6177.    *tabptr = '\0';                                                              
  6178.    R->fileptr = trim_leading_and_trailing_space(R->fileptr);                    
  6179.    R->wargptr = trim_leading_and_trailing_space(tabptr+1);                      
  6180.  }                                                                              
  6181.  else {                                                                         
  6182.    R->fileptr = trim_leading_and_trailing_space(R->fileptr);                    
  6183.    R->wargptr = NULL;                                                           
  6184.  }                                                                              
  6185.                                                                                 
  6186.  if (!*R->fileptr) {                                                            
  6187.    R->fileptr = DEFAULT_DIRECTORY;                                              
  6188.  }                                                                              
  6189.                                                                                 
  6190.  /* If first character is numeric, assume it's a gopher type.                   
  6191.   * Later we will actually support different types...                           
  6192.   */                                                                            
  6193.                                                                                 
  6194.  switch (*R->fileptr) {                                                         
  6195.    case '0':                                                                    
  6196.    case '1':                                                                    
  6197.    case '2':                                                                    
  6198.    case '3':                                                                    
  6199.    case '4':                                                                    
  6200.    case '5':                                                                    
  6201.    case '6':                                                                    
  6202.    case '7':                                                                    
  6203.    case '8':                                                                    
  6204.    case '9':  R->fileptr++; break;                                              
  6205.    default:                 break;                                              
  6206.  }                                                                              
  6207.                                                                                 
  6208.  if (!R->outfp) printf("%s: requested:%s;\n",R->hostname,R->fileptr);           
  6209.                                                                                 
  6210.  /*                                                                             
  6211.   * Process special hacks here.                                                 
  6212.   *                                                                             
  6213.   * For example, if the file name begins with "exec:", then                     
  6214.   * execute the specified REXX exec.                                            
  6215.   *                                                                             
  6216.   * Hackless names are processed as files.  "dd:" is not a                      
  6217.   * special hack but the normal C/370 DDname reference.                         
  6218.   *                                                                             
  6219.   */                                                                            
  6220.                                                                                 
  6221.  colonptr = strchr(R->fileptr,':');                                             
  6222.  if (colonptr) {                                                                
  6223.    hacksize = colonptr - R->fileptr;                                            
  6224.    if (hacksize > 0 && hacksize < sizeof(hackprefix)) {                         
  6225.      for (p = hackprefix, q = R->fileptr;                                       
  6226.           hacksize > 0;                                                         
  6227.           p++, q++, hacksize--) *p = toupper(*q);                               
  6228.      *p = '\0';                                                                 
  6229.    }                                                                            
  6230.  }                                                                              
  6231.                                                                                 
  6232.  if (EQUAL(hackprefix,"EXEC")) {                                                
  6233.   /*                                                                            
  6234.    * REXX exec, which must reside in SYSEXEC DD.                                
  6235.    */                                                                           
  6236.    if (!authorized_file(R)) {                                                   
  6237.      gbarf(R,"the GOPHER server won't run the exec for you");                   
  6238.      rc = FALSE;                                                                
  6239.    }                                                                            
  6240.    else {                                                                       
  6241.      R->fileptr = colonptr + 1;  /* point to exec itself */                     
  6242.      rc = get_exec_data(R);                                                     
  6243.    }                                                                            
  6244.  }                                                                              
  6245.  else                                                                           
  6246.  if (EQUAL(hackprefix,"DD")) {                                                  
  6247.   /*                                                                            
  6248.    * C/370 style ddname.  Assume sequential file - cannot be a PDS              
  6249.    * because I don't feel like trying to determine that right now.              
  6250.    */                                                                           
  6251.    if (!authorized_file(R)) {                                                   
  6252.      gbarf(R,"the GOPHER server won't read the DD for you");                    
  6253.      rc = FALSE;                                                                
  6254.    }                                                                            
  6255.    else {                                                                       
  6256.      strcpy(R->buffer,R->fileptr); /* still points to "DD:xxxxxxxx" */          
  6257.      dstype = SEQ;                                                              
  6258.      rc = get_flat_file(R);                                                     
  6259.    }                                                                            
  6260.  }                                                                              
  6261.  else {                                                                         
  6262.    /* Regular file name without ":" hack, or with invalid ":" hack.             
  6263.     * Check to see that the file name is on our "official" list.                
  6264.     */                                                                          
  6265.    if (!authorized_file(R)) {                                                   
  6266.      gbarf(R,"the GOPHER server won't let you see the file");                   
  6267.      rc = FALSE;                                                                
  6268.    }                                                                            
  6269.    else {                                                                       
  6270.                                                                                 
  6271.    /* Dynamically allocate data set and use generated ddname.                   
  6272.     * Note that we have to allocate the data set name to a ddname and           
  6273.     * then open the ddname to prevent C/370 from barfing on otherwise           
  6274.     * valid data set names like those with hyphens in them.  But this           
  6275.     * also lets us determine if the data set is sequential or a PDS.            
  6276.     */                                                                          
  6277.      strcpy(R->dsname,R->fileptr);                                              
  6278.      dstype = GGMalloc(R->dsname,ddname,UNK,0);                                 
  6279.      sprintf(R->buffer,"DD:%s",ddname);                                         
  6280.      switch (dstype) {                                                          
  6281.        case SEQ: rc = get_flat_file(R); break;                                  
  6282.        case PDS: rc = get_directory(R); break;                                  
  6283.        default:                                                                 
  6284.                printf("INVALID! requested:%s\n",R->fileptr);                    
  6285.                gbarf(R,"the GOPHER server couldn't allocate the file");         
  6286.                rc = FALSE;                                                      
  6287.      }                                                                          
  6288.    }                                                                            
  6289.  }                                                                              
  6290.                                                                                 
  6291.  GGMunalc(ddname);  /* free the ddname if set */                                
  6292.                                                                                 
  6293.  if (!rc) {                                                                     
  6294.    fflush(stdout);                                                              
  6295.    fflush(stderr);                                                              
  6296.  }                                                                              
  6297.                                                                                 
  6298.  return rc;                                                                     
  6299.                                                                                 
  6300. }                                                                               
  6301.                                                                                 
  6302. ./   ADD NAME=GGMPTX,SSI=01000029                                               
  6303.                                                                                 
  6304.  /********************************************************************/         
  6305.  /*                                                                  */         
  6306.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6307.  /*                                                                  */         
  6308.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6309.  /*                                                                  */         
  6310.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6311.  /* including the implied warranties of merchantability and fitness, */         
  6312.  /* are expressly denied.                                            */         
  6313.  /*                                                                  */         
  6314.  /* Provided this copyright notice is included, this software may    */         
  6315.  /* be freely distributed and not offered for sale.                  */         
  6316.  /*                                                                  */         
  6317.  /* Changes or modifications may be made and used only by the maker  */         
  6318.  /* of same, and not further distributed.  Such modifications should */         
  6319.  /* be mailed to the author for consideration for addition to the    */         
  6320.  /* software and incorporation in subsequent releases.               */         
  6321.  /*                                                                  */         
  6322.  /********************************************************************/         
  6323.                                                                                 
  6324. #pragma  csect(code,  "GG@PTX  ")                                               
  6325. #pragma  csect(static,"GG$PTX  ")                                               
  6326. #include "gg.h"                                                                 
  6327.                                                                                 
  6328. /****** Print the lines of server text. ******************************/         
  6329.                                                                                 
  6330. void                                                                            
  6331. GGMptx(gp,ip)                                                                   
  6332. Rstruc ggcb         *gp;                                                        
  6333. Rstruc gopherinfo   *ip;                                                        
  6334. {                                                                               
  6335.  FILE               *pfp;                                                       
  6336.  struct texthdr     *thp;                                                       
  6337.  struct textline    *tp;                                                        
  6338.                                                                                 
  6339.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  6340.                                                                                 
  6341.  pfp = stdout;                                                                  
  6342.                                                                                 
  6343.  /* Article must be specified (cannot be null). */                              
  6344.                                                                                 
  6345.  for (tp=thp->first_text_line;tp;tp=tp->next) {                                 
  6346.    if (tp->text_length >= 0) {                                                  
  6347.      char *p = tp->tab_expanded_text;                                           
  6348.      while (*p) {                                                               
  6349.        if isprint(*p) fprintf(pfp,"%c",*p);                                     
  6350.        else fprintf(pfp,"?");                                                   
  6351.        p++;                                                                     
  6352.      }                                                                          
  6353.      fprintf(pfp,"\n");                                                         
  6354.    }                                                                            
  6355.  }                                                                              
  6356.  fprintf(pfp,"\n");                                                             
  6357.                                                                                 
  6358.  return;                                                                        
  6359.                                                                                 
  6360. }                                                                               
  6361.                                                                                 
  6362. ./   ADD NAME=GGMSOCKT,SSI=01090005                                             
  6363.                                                                                 
  6364.  /********************************************************************/         
  6365.  /*                                                                  */         
  6366.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6367.  /*                                                                  */         
  6368.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6369.  /*                                                                  */         
  6370.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6371.  /* including the implied warranties of merchantability and fitness, */         
  6372.  /* are expressly denied.                                            */         
  6373.  /*                                                                  */         
  6374.  /* Provided this copyright notice is included, this software may    */         
  6375.  /* be freely distributed and not offered for sale.                  */         
  6376.  /*                                                                  */         
  6377.  /* Changes or modifications may be made and used only by the maker  */         
  6378.  /* of same, and not further distributed.  Such modifications should */         
  6379.  /* be mailed to the author for consideration for addition to the    */         
  6380.  /* software and incorporation in subsequent releases.               */         
  6381.  /*                                                                  */         
  6382.  /********************************************************************/         
  6383.                                                                                 
  6384. #pragma  csect(code,  "GG@SOCKT")                                               
  6385. #pragma  csect(static,"GG$SOCKT")                                               
  6386. #include "gg.h"                                                                 
  6387.                                                                                 
  6388. /****** Output one data line for the server. *************************/         
  6389.                                                                                 
  6390. Bool                                                                            
  6391. GGMsockt(gp)                                                                    
  6392. Rstruc ggcb        *gp;                                                         
  6393. {                                                                               
  6394.  int                gopher_bytes;                                               
  6395.  int                writrc;                                                     
  6396.  int                j;                                                          
  6397.  char              *s_buf;                                                      
  6398.  Bool               procok;                                                     
  6399.  struct recvstruct *R;                                                          
  6400.                                                                                 
  6401.  /* Before sending a request to the server, do a cleanup operation              
  6402.   * to make sure that no more responses are coming from the server.             
  6403.   */                                                                            
  6404.                                                                                 
  6405.  GGMesrvr(gp);           /* End server read */                                  
  6406.                                                                                 
  6407.  /* If local mode, call server subtask processor with command. */               
  6408.                                                                                 
  6409.  if ((R=gp->recvp)) {                                                           
  6410.    if (!R->outfp) {                                                             
  6411.      CRIT1("Can't send data locally, non-socket not connected");                
  6412.      return FALSE;                                                              
  6413.    }                                                                            
  6414.    strncpy(R->buffer, gp->gopher_command, sizeof(R->buffer)-1);                 
  6415.    strcpy(R->myname, LOCAL_HOST_FROB);  /* used by PDS feature */               
  6416.                                                                                 
  6417.    /* allocate SYSTSPRT file, used by REXX EXEC interface */                    
  6418.                                                                                 
  6419.    if (GGMtso(                                                                  
  6420.      "ALLOC FI(SYSTSPRT) T SP(100 100) REL REU DEL"                             
  6421.      " RECFM(V B) LRECL(1024) BLKSIZE(32760)"                                   
  6422.              ) != 0) {                                                          
  6423.      fprintf(stderr,                                                            
  6424.        "Warning: Cannot allocate temporary SYSTSPRT file.\n");                  
  6425.      fprintf(stderr,                                                            
  6426.        "         Some interfaces may not work properly.\n");                    
  6427.    }                                                                            
  6428.                                                                                 
  6429.    procok = GGMproc(R);                                                         
  6430.                                                                                 
  6431.    /* free SYSTSPRT file, used by REXX EXEC interface */                        
  6432.                                                                                 
  6433.    (void)GGMunalc("SYSTSPRT");                                                  
  6434.                                                                                 
  6435.    /* Prepare to read from the beginning of the file */                         
  6436.                                                                                 
  6437.    if (fseek(R->outfp, 0, SEEK_SET) != 0) {                                     
  6438.      CRIT1("Can't reposition to start of local file");                          
  6439.      return FALSE;                                                              
  6440.    }                                                                            
  6441.    return procok;                                                               
  6442.  }                                                                              
  6443.                                                                                 
  6444.  gopher_bytes = strlen(gp->gopher_command);                                     
  6445.                                                                                 
  6446.  memcpy(gp->client_buf,gp->gopher_command,gopher_bytes);                        
  6447.  gp->client_buf[gopher_bytes]   = CARRIAGE_RETURN;                              
  6448.  gp->client_buf[gopher_bytes+1] = LINE_FEED;                                    
  6449.                                                                                 
  6450.  if (gp->receiving_text &&                                                      
  6451.      gopher_bytes == 1  &&                                                      
  6452.      gp->client_buf[0] == '.') {                                                
  6453.    gp->receiving_text = FALSE;                                                  
  6454.  }                                                                              
  6455.                                                                                 
  6456.  if (gp->debug_mode)                                                            
  6457.     GGMdump(gp,"Writing to server",gp->client_buf,gopher_bytes+2);              
  6458.                                                                                 
  6459. #ifdef MVS                                                                      
  6460.                                                                                 
  6461.  for (j=0;j<gopher_bytes+2;++j) {                                               
  6462.    gp->client_buf[j] = etoa(gp->client_buf[j]);                                 
  6463.  }                                                                              
  6464.                                                                                 
  6465. #endif                                                                          
  6466.                                                                                 
  6467.  writrc = write(gp->socknum, gp->client_buf, gopher_bytes+2);                   
  6468.  if (writrc < 0) {                                                              
  6469.    gp->connection_broken = TRUE;                                                
  6470.    CRIT2("TCP/IP error: write() failed to send data to server %s.",             
  6471.          gp->ggserver);                                                         
  6472.    return FALSE;                                                                
  6473.  }                                                                              
  6474.                                                                                 
  6475.  /* Prepare server for read. */                                                 
  6476.                                                                                 
  6477.  gp->server_has_something_pending = TRUE;                                       
  6478.  gp->server_finished_replying     = FALSE;                                      
  6479.  gp->sending_text                 = FALSE;                                      
  6480.  gp->dont_read                    = FALSE;                                      
  6481.                                                                                 
  6482.  return TRUE;                                                                   
  6483. }                                                                               
  6484.                                                                                 
  6485. ./   ADD NAME=GGMSOPT,SSI=01000036                                              
  6486.                                                                                 
  6487.  /********************************************************************/         
  6488.  /*                                                                  */         
  6489.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6490.  /*                                                                  */         
  6491.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6492.  /*                                                                  */         
  6493.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6494.  /* including the implied warranties of merchantability and fitness, */         
  6495.  /* are expressly denied.                                            */         
  6496.  /*                                                                  */         
  6497.  /* Provided this copyright notice is included, this software may    */         
  6498.  /* be freely distributed and not offered for sale.                  */         
  6499.  /*                                                                  */         
  6500.  /* Changes or modifications may be made and used only by the maker  */         
  6501.  /* of same, and not further distributed.  Such modifications should */         
  6502.  /* be mailed to the author for consideration for addition to the    */         
  6503.  /* software and incorporation in subsequent releases.               */         
  6504.  /*                                                                  */         
  6505.  /********************************************************************/         
  6506.                                                                                 
  6507. #pragma  csect(code,  "GG@SOPT ")                                               
  6508. #pragma  csect(static,"GG$SOPT ")                                               
  6509. #include "gg.h"                                                                 
  6510.                                                                                 
  6511. #define BOOLOPTSET(A,B,C) \                                                     
  6512.    switch (A[0]) { \                                                            
  6513.      case  'n': \                                                               
  6514.      case  'N':   B = FALSE; break; \                                           
  6515.      case  'y': \                                                               
  6516.      case  'Y':   B = TRUE; break; \                                            
  6517.      case '\0': \                                                               
  6518.      default:     B = C; break; \                                               
  6519.    }                                                                            
  6520.                                                                                 
  6521. /****** Set options that are stored in ISPF profile. *****************/         
  6522.                                                                                 
  6523. void                                                                            
  6524. GGMsopt(gp,which)                                                               
  6525. Rstruc ggcb        *gp;                                                         
  6526. enum user_option    which;                                                      
  6527. {                                                                               
  6528.  int                arrows;                                                     
  6529.  char               ggextpow[  4];                                              
  6530.  char               ggextpap[  4];                                              
  6531.  char               ggscroll[  4];                                              
  6532.                                                                                 
  6533.  if (which == OPTION_ALL) {                                                     
  6534.    GGMispf(gp, "VGET (GGMUPDTF GGEXTPOW GGEXTPOP GGSCROLL) PROFILE");           
  6535.  }                                                                              
  6536.                                                                                 
  6537.  if (which == OPTION_ALL || which == OPTION_OTHER) {                            
  6538.                                                                                 
  6539.    (void)GGMivget(gp,"GGEXTPOW ", ggextpow, sizeof(ggextpow));                  
  6540.    (void)GGMivget(gp,"GGEXTPAP ", ggextpap, sizeof(ggextpap));                  
  6541.                                                                                 
  6542.    BOOLOPTSET(ggextpow, gp->warn_overwrite,              TRUE);                 
  6543.    BOOLOPTSET(ggextpap, gp->warn_append,                 TRUE);                 
  6544.                                                                                 
  6545.  }                                                                              
  6546.                                                                                 
  6547.  if (which == OPTION_ALL || which == OPTION_VIEW) {                             
  6548.                                                                                 
  6549.    (void)GGMivget(gp,"GGSCROLL ", ggscroll, sizeof(ggscroll));                  
  6550.                                                                                 
  6551.    BOOLOPTSET(ggscroll, gp->autoscroll, TRUE);                                  
  6552.                                                                                 
  6553.  }                                                                              
  6554.                                                                                 
  6555.  return;                                                                        
  6556. }                                                                               
  6557.                                                                                 
  6558. ./   ADD NAME=GGMSSRVR,SSI=01010032                                             
  6559.                                                                                 
  6560.  /********************************************************************/         
  6561.  /*                                                                  */         
  6562.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6563.  /*                                                                  */         
  6564.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6565.  /*                                                                  */         
  6566.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6567.  /* including the implied warranties of merchantability and fitness, */         
  6568.  /* are expressly denied.                                            */         
  6569.  /*                                                                  */         
  6570.  /* Provided this copyright notice is included, this software may    */         
  6571.  /* be freely distributed and not offered for sale.                  */         
  6572.  /*                                                                  */         
  6573.  /* Changes or modifications may be made and used only by the maker  */         
  6574.  /* of same, and not further distributed.  Such modifications should */         
  6575.  /* be mailed to the author for consideration for addition to the    */         
  6576.  /* software and incorporation in subsequent releases.               */         
  6577.  /*                                                                  */         
  6578.  /********************************************************************/         
  6579.                                                                                 
  6580. #pragma  csect(code,  "GG@SSRVR")                                               
  6581. #pragma  csect(static,"GG$SSRVR")                                               
  6582. #include "gg.h"                                                                 
  6583.                                                                                 
  6584. /****** Start server read. *******************************************/         
  6585.                                                                                 
  6586. void                                                                            
  6587. GGMssrvr(gp)                                                                    
  6588. Rstruc ggcb  *gp;                                                               
  6589. {                                                                               
  6590.                                                                                 
  6591.  gp->server_has_something_pending = TRUE;                                       
  6592.  gp->server_finished_replying     = FALSE;                                      
  6593.  gp->sending_text                 = FALSE;                                      
  6594.  gp->dont_read                    = FALSE;                                      
  6595.                                                                                 
  6596.  return;                                                                        
  6597.                                                                                 
  6598. }                                                                               
  6599.                                                                                 
  6600. ./   ADD NAME=GGMTNET,SSI=01040000                                              
  6601.                                                                                 
  6602.  /********************************************************************/         
  6603.  /*                                                                  */         
  6604.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6605.  /*                                                                  */         
  6606.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6607.  /*                                                                  */         
  6608.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6609.  /* including the implied warranties of merchantability and fitness, */         
  6610.  /* are expressly denied.                                            */         
  6611.  /*                                                                  */         
  6612.  /* Provided this copyright notice is included, this software may    */         
  6613.  /* be freely distributed and not offered for sale.                  */         
  6614.  /*                                                                  */         
  6615.  /* Changes or modifications may be made and used only by the maker  */         
  6616.  /* of same, and not further distributed.  Such modifications should */         
  6617.  /* be mailed to the author for consideration for addition to the    */         
  6618.  /* software and incorporation in subsequent releases.               */         
  6619.  /*                                                                  */         
  6620.  /********************************************************************/         
  6621.                                                                                 
  6622. #pragma  csect(code,  "GG@TNET ")                                               
  6623. #pragma  csect(static,"GG$TNET ")                                               
  6624. #include "gg.h"                                                                 
  6625.                                                                                 
  6626. /****** Gopher TELNET interface. *************************************/         
  6627.                                                                                 
  6628. Bool                                                                            
  6629. GGMtnet(gp,ip,as_file)                                                          
  6630. Rstruc ggcb        *gp;                                                         
  6631. Rstruc gopherinfo  *ip;                                                         
  6632. Fool                as_file;                                                    
  6633. {                                                                               
  6634.  int                tsorc;                                                      
  6635.  char               tsocmd[256];                                                
  6636.                                                                                 
  6637.  if (as_file) {                                                                 
  6638.    ERR1("TELNET interface cannot be viewed as a file.");                        
  6639.    return FALSE;                                                                
  6640.  }                                                                              
  6641.                                                                                 
  6642.  GGMispf(gp,"CONTROL DISPLAY LINE");                                            
  6643.                                                                                 
  6644.  fprintf(stderr,"Note: Login as user: %s\n\n", ip->path);                       
  6645.                                                                                 
  6646.  sprintf(tsocmd,"%s %s %d", TELNET_COMMAND_NAME,                                
  6647.                             ip->host,                                           
  6648.                             ip->port);                                          
  6649.                                                                                 
  6650.  if ((tsorc = GGMtso(tsocmd)) != 0) {                                           
  6651.    ERR3("%s command returned code %d", TELNET_COMMAND_NAME, tsorc);             
  6652.  }                                                                              
  6653.                                                                                 
  6654.  GGMispf(gp,"CONTROL DISPLAY REFRESH");                                         
  6655.                                                                                 
  6656.  return TRUE;                                                                   
  6657. }                                                                               
  6658.                                                                                 
  6659. ./   ADD NAME=GGMTSO,SSI=01000051                                               
  6660.                                                                                 
  6661.  /********************************************************************/         
  6662.  /*                                                                  */         
  6663.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6664.  /*                                                                  */         
  6665.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6666.  /*                                                                  */         
  6667.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6668.  /* including the implied warranties of merchantability and fitness, */         
  6669.  /* are expressly denied.                                            */         
  6670.  /*                                                                  */         
  6671.  /* Provided this copyright notice is included, this software may    */         
  6672.  /* be freely distributed and not offered for sale.                  */         
  6673.  /*                                                                  */         
  6674.  /* Changes or modifications may be made and used only by the maker  */         
  6675.  /* of same, and not further distributed.  Such modifications should */         
  6676.  /* be mailed to the author for consideration for addition to the    */         
  6677.  /* software and incorporation in subsequent releases.               */         
  6678.  /*                                                                  */         
  6679.  /********************************************************************/         
  6680.                                                                                 
  6681.  /********************************************************************/         
  6682.  /*                                                                  */         
  6683.  /* Thanks to Michael Van Norman for this code.                      */         
  6684.  /*                                                                  */         
  6685.  /********************************************************************/         
  6686.                                                                                 
  6687. #pragma  csect(code,  "GG@TSO  ")                                               
  6688. #pragma  csect(static,"GG$TSO  ")                                               
  6689. #include "gg.h"                                                                 
  6690.                                                                                 
  6691. #pragma linkage(ikjeftsr,OS)                                                    
  6692.                                                                                 
  6693. #define _IKJEFTSR_FLAGS_AUTH        0x00000000                                  
  6694. #define _IKJEFTSR_FLAGS_COMMAND     0x00000001                                  
  6695. #define _IKJEFTSR_FLAGS_DUMP        0x00000100                                  
  6696. #define _IKJEFTSR_FLAGS_NODUMP      0x00000000                                  
  6697. #define _IKJEFTSR_FLAGS_PROGRAM     0x00000002                                  
  6698. #define _IKJEFTSR_FLAGS_UNAUTH      0x00010000                                  
  6699.                                                                                 
  6700. /****** Issue TSO command. *******************************************/         
  6701.                                                                                 
  6702. int                                                                             
  6703. GGMtso(command)                                                                 
  6704. char        *command;                                                           
  6705. {                                                                               
  6706.  int         flags         = _IKJEFTSR_FLAGS_COMMAND +                          
  6707.                              _IKJEFTSR_FLAGS_UNAUTH;                            
  6708.  int         commandLength = strlen(command);                                   
  6709.  int         rc            = 0;                                                 
  6710.  int         returnCode    = 0;                                                 
  6711.  int         reasonCode    = 0;                                                 
  6712.  int         abendCode     = 0;                                                 
  6713.                                                                                 
  6714.  static int (*ikjeftsr)() = NULL;                                               
  6715.                                                                                 
  6716.  if (!ikjeftsr) {                                                               
  6717.    int tsoEntryAddress;                                                         
  6718.                                                                                 
  6719.    tsoEntryAddress = 0x00000010;    /* Address of CVT */                        
  6720.    tsoEntryAddress = *(int *)(tsoEntryAddress);                                 
  6721.    tsoEntryAddress += 0x9C;/*       /* Offset of TVT in CVT */                  
  6722.    tsoEntryAddress = *(int *)(tsoEntryAddress);                                 
  6723.    tsoEntryAddress += 0x10;/*       /* TSVTASF-TSVT (from IKJTSVT) */           
  6724.    tsoEntryAddress = *(int *)(tsoEntryAddress);                                 
  6725.    ikjeftsr = (int (*)())(tsoEntryAddress);                                     
  6726.  }                                                                              
  6727.                                                                                 
  6728.  if (!ikjeftsr) {                                                               
  6729.    fprintf(stderr,                                                              
  6730.            "Cannot execute TSO commands, can't fetch IKJEFTSR.\n");             
  6731.    return -2;                                                                   
  6732.  }                                                                              
  6733.                                                                                 
  6734.  rc = (*ikjeftsr)(&flags, command, &commandLength,                              
  6735.                           &returnCode, &reasonCode,                             
  6736.                           (int *)((int)(&abendCode) | 0x80000000));             
  6737.                                                                                 
  6738.  if (rc != 0) {                                                                 
  6739.    if (rc > 4) {                                                                
  6740.      fprintf(stderr,"Command failed:%s\n",command);                             
  6741.      if (rc == 20 && reasonCode == 40)                                          
  6742.           fprintf(stderr,"Command was not found.\n");                           
  6743.      else fprintf(stderr,                                                       
  6744.              "rc=%d,returncode=%d,reasoncode=%d,abendcode=%8.8x\n",             
  6745.              rc, returnCode, reasonCode, abendCode);                            
  6746.    }                                                                            
  6747.    if (abendCode != 0) rc = -1;                                                 
  6748.    else rc = returnCode;                                                        
  6749.  }                                                                              
  6750.                                                                                 
  6751.  return rc;                                                                     
  6752. }                                                                               
  6753.                                                                                 
  6754. ./   ADD NAME=GGMTYPE,SSI=01030020                                              
  6755.                                                                                 
  6756.  /********************************************************************/         
  6757.  /*                                                                  */         
  6758.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6759.  /*                                                                  */         
  6760.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6761.  /*                                                                  */         
  6762.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6763.  /* including the implied warranties of merchantability and fitness, */         
  6764.  /* are expressly denied.                                            */         
  6765.  /*                                                                  */         
  6766.  /* Provided this copyright notice is included, this software may    */         
  6767.  /* be freely distributed and not offered for sale.                  */         
  6768.  /*                                                                  */         
  6769.  /* Changes or modifications may be made and used only by the maker  */         
  6770.  /* of same, and not further distributed.  Such modifications should */         
  6771.  /* be mailed to the author for consideration for addition to the    */         
  6772.  /* software and incorporation in subsequent releases.               */         
  6773.  /*                                                                  */         
  6774.  /********************************************************************/         
  6775.                                                                                 
  6776. #pragma  csect(code,  "GG@TYPE ")                                               
  6777. #pragma  csect(static,"GG$TYPE ")                                               
  6778. #include "gg.h"                                                                 
  6779.                                                                                 
  6780. /*********************************************************************/         
  6781.                                                                                 
  6782. char *                                                                          
  6783. GGMtype(gophertype t)                                                           
  6784. {                                                                               
  6785.                                                                                 
  6786.  switch (t) {                                                                   
  6787.    case GOPHER_FILE:        return "File     ";                                 
  6788.    case GOPHER_DIRECTORY:   return "Directory";                                 
  6789.    case GOPHER_CSO:         return "Cso      ";                                 
  6790.    case GOPHER_ERROR:       return "Error    ";                                 
  6791.    case GOPHER_MAC_BINHEX:  return "Binhex   ";                                 
  6792.    case GOPHER_DOS_BINARCH: return "Binarch  ";                                 
  6793.    case GOPHER_UUENCODE:    return "Uuencode ";                                 
  6794.    case GOPHER_WAIS:        return "Index    ";                                 
  6795.    case GOPHER_TELNET:      return "Telnet   ";                                 
  6796.    case GOPHER_BINARY:      return "Binary   ";                                 
  6797.    case GOPHER_REDUNDANT:   return "Redundant";                                 
  6798.    case GOPHER_WHOIS:       return "Whois    ";                                 
  6799.    default:                 return "Unknown  ";                                 
  6800.  }                                                                              
  6801. }                                                                               
  6802.                                                                                 
  6803. ./   ADD NAME=GGMUNALC,SSI=01000040                                             
  6804.                                                                                 
  6805.  /********************************************************************/         
  6806.  /*                                                                  */         
  6807.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6808.  /*                                                                  */         
  6809.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6810.  /*                                                                  */         
  6811.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6812.  /* including the implied warranties of merchantability and fitness, */         
  6813.  /* are expressly denied.                                            */         
  6814.  /*                                                                  */         
  6815.  /* Provided this copyright notice is included, this software may    */         
  6816.  /* be freely distributed and not offered for sale.                  */         
  6817.  /*                                                                  */         
  6818.  /* Changes or modifications may be made and used only by the maker  */         
  6819.  /* of same, and not further distributed.  Such modifications should */         
  6820.  /* be mailed to the author for consideration for addition to the    */         
  6821.  /* software and incorporation in subsequent releases.               */         
  6822.  /*                                                                  */         
  6823.  /********************************************************************/         
  6824.                                                                                 
  6825. #pragma  csect(code,  "GG@UNALC")                                               
  6826. #pragma  csect(static,"GG$UNALC")                                               
  6827. #include "gg.h"                                                                 
  6828.                                                                                 
  6829. /****** Unallocate a data set. ***************************************/         
  6830.                                                                                 
  6831. Bool                                                                            
  6832. GGMunalc(ddname)                                                                
  6833. char         *ddname;                                                           
  6834. {                                                                               
  6835.  __S99parms   stuff99;   /* The manual has it wrong.  No "struct". */           
  6836.  int          rc;                                                               
  6837.  char        *cp;                                                               
  6838.  TEXTUNIT    *tu [2];                                                           
  6839.  TEXTUNIT     tu_ddn;                                                           
  6840.  TEXTUNIT     tu_una;                                                           
  6841.                                                                                 
  6842.  if (!ddname ||                                                                 
  6843.      !*ddname) return TRUE;   /* if no ddname to free, do nothing */            
  6844.                                                                                 
  6845.  memset((char *)&stuff99,0,sizeof(__S99parms));                                 
  6846.                                                                                 
  6847.  stuff99.__S99RBLN   = 20;                                                      
  6848.  stuff99.__S99VERB   = S99VRBUN;                                                
  6849.  stuff99.__S99FLAG1  = 0;                                                       
  6850.  stuff99.__S99ERROR  = 0;                                                       
  6851.  stuff99.__S99INFO   = 0;                                                       
  6852.  stuff99.__S99TXTPP  = tu;                                                      
  6853.  stuff99.__S99FLAG2  = 0;                                                       
  6854.                                                                                 
  6855.  tu[0] = &tu_ddn;                                                               
  6856.  tu[1] = &tu_una;                                                               
  6857.  *(int *)&tu[1] |= 0x80000000;                                                  
  6858.                                                                                 
  6859.  tu_ddn.key     = DUNDDNAM;                                                     
  6860.  tu_ddn.num     = 1;                                                            
  6861.  tu_ddn.ent.len = strlen(ddname);                                               
  6862.  strcpy(tu_ddn.ent.prm,ddname);                                                 
  6863.                                                                                 
  6864.  tu_una.key     = DUNUNALC;                                                     
  6865.  tu_una.num     = 0;                                                            
  6866.                                                                                 
  6867.  for (cp=tu_ddn.ent.prm; *cp; cp++) *cp = toupper(*cp);                         
  6868.                                                                                 
  6869.  rc = svc99(&stuff99);                                                          
  6870.                                                                                 
  6871.  if (rc == 0) return TRUE;                                                      
  6872.  else if (stuff99.__S99ERROR == 0x0438) /* not freed, is not allocated*/        
  6873.          return TRUE;                                                           
  6874.  else {                                                                         
  6875.    GGMdfail(rc,&stuff99);                                                       
  6876.    return FALSE;                                                                
  6877.  }                                                                              
  6878. }                                                                               
  6879.                                                                                 
  6880. ./   ADD NAME=GGMVTX,SSI=01050014                                               
  6881.                                                                                 
  6882.  /********************************************************************/         
  6883.  /*                                                                  */         
  6884.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6885.  /*                                                                  */         
  6886.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6887.  /*                                                                  */         
  6888.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6889.  /* including the implied warranties of merchantability and fitness, */         
  6890.  /* are expressly denied.                                            */         
  6891.  /*                                                                  */         
  6892.  /* Provided this copyright notice is included, this software may    */         
  6893.  /* be freely distributed and not offered for sale.                  */         
  6894.  /*                                                                  */         
  6895.  /* Changes or modifications may be made and used only by the maker  */         
  6896.  /* of same, and not further distributed.  Such modifications should */         
  6897.  /* be mailed to the author for consideration for addition to the    */         
  6898.  /* software and incorporation in subsequent releases.               */         
  6899.  /*                                                                  */         
  6900.  /********************************************************************/         
  6901.                                                                                 
  6902. #pragma  csect(code,  "GG@VTX  ")                                               
  6903. #pragma  csect(static,"GG$VTX  ")                                               
  6904. #include "gg.h"                                                                 
  6905.                                                                                 
  6906. /****** BRIF fakeout. ************************************************/         
  6907.                                                                                 
  6908. static void                                                                     
  6909. fake_out_for_brif(fpp,codebuf)                                                  
  6910. void **fpp;                                                                     
  6911. char  *codebuf;                                                                 
  6912.                                                                                 
  6913. #ifndef I370                                                                    
  6914.                                                                                 
  6915. /* The purpose of this is to put a wrapper around the actual                    
  6916.    function pointed to by the argument, so that FORTRAN-style                   
  6917.    return codes (in register 0) get put into register 15.                       
  6918.                                                                                 
  6919.    Source code:                                                                 
  6920.                                                                                 
  6921.          USING *,15                                                             
  6922.          ST    14,save_14                                                       
  6923.          L     15,realcode                                                      
  6924.          DROP  15                                                               
  6925.          BALR  14,15                                                            
  6926.          USING *,14                                                             
  6927.          L     14,save_14                                                       
  6928.          DROP  14                                                               
  6929.          LR    15,0                                                             
  6930.          BR    14                                                               
  6931.          SPACE 1                                                                
  6932. save_14  DS    F                                                                
  6933. realcode DS    F                                                                
  6934.                                                                                 
  6935.  *** Warning: As written, this fake-out code is not reentrant. ***              
  6936.                                                                                 
  6937. */                                                                              
  6938.                                                                                 
  6939. {                                                                               
  6940.  static char fake_out_code[32] = {                                              
  6941.                                0x50,0xE0,0xF0,0x14,0x58,0xF0,0xF0,0x18,         
  6942.                                0x05,0xEF,0x58,0xE0,0xE0,0x0A,0x18,0xF0,         
  6943.                                0x07,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,         
  6944.                                0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00          
  6945.                                  };                                             
  6946.                                                                                 
  6947.  memcpy(codebuf,fake_out_code,32);                                              
  6948.  memcpy(codebuf+0x18,(char *)fpp,4);                                            
  6949.                                                                                 
  6950. #else                                                                           
  6951.                                                                                 
  6952. /* The purpose of this is to put a wrapper around the actual                    
  6953.    function pointed to by the argument, so that the C Runtime                   
  6954.    Anchor Block pointer (in register 12) can be saved/restored.                 
  6955. */                                                                              
  6956.                                                                                 
  6957. {                                                                               
  6958. #define FAKE_BUF_SIZE 48               /*                             */        
  6959.  static short fake_out_code[FAKE_BUF_SIZE/2] =                                  
  6960.  {                                     /*     USING *,15              */        
  6961.   0x50C0,0xF020,                       /* +00 ST    14,save_12        */        
  6962.   0x50E0,0xF024,                       /* +04 ST    12,save_14        */        
  6963.   0x58C0,0xF02C,                       /* +08 L     12,crab           */        
  6964.   0x58F0,0xF028,                       /* +0C L     15,realcode       */        
  6965.                                        /*     DROP  15                */        
  6966.   0x58F0,0xF000,                       /* +10 L     15,0(,15)         */        
  6967.   0x05EF,                              /* +14 BALR  14,15             */        
  6968.                                        /*     USING *,14              */        
  6969.   0x58C0,0xE00A,                       /* +16 L     12,save_12        */        
  6970.   0x58E0,0xE00E,                       /* +1A L     14,save_14        */        
  6971.                                        /*     DROP  14                */        
  6972.   0x07FE,                              /* +1E BR    14                */        
  6973.   0x0000,0x0000,                       /* +20 save_12                 */        
  6974.   0x0000,0x0000,                       /* +24 save_14                 */        
  6975.   0x0000,0x0000,                       /* +28 realcode                */        
  6976.   0x0000,0x0000                        /* +2C crab                    */        
  6977.  };                                                                             
  6978.                                                                                 
  6979.  memcpy( codebuf, fake_out_code, FAKE_BUF_SIZE );                               
  6980.  memcpy( codebuf+0x28, (char *)fpp, 4 );                                        
  6981.  _ldregs( R2, codebuf+0x2C  ),         /* get -> crab in fakeout buff */        
  6982.  _code  ( 0, 0x50C0, 0x2000 );         /* save -> CRAB                */        
  6983.                                                                                 
  6984. #endif                                                                          
  6985.                                                                                 
  6986.  *fpp = (void *)codebuf;                                                        
  6987.                                                                                 
  6988.  return;                                                                        
  6989.                                                                                 
  6990. }                                                                               
  6991.                                                                                 
  6992. /****** Print text lines. ********************************************/         
  6993.                                                                                 
  6994. static void                                                                     
  6995. print_text_lines(fp,textp)                                                      
  6996. FILE              *fp;                                                          
  6997. struct textline   *textp;                                                       
  6998. {                                                                               
  6999.  struct textline  *tp;                                                          
  7000.  char             *p;                                                           
  7001.                                                                                 
  7002.  for (tp=textp; tp; tp=tp->next) {                                              
  7003.    if (tp->text_length >= 0) {                                                  
  7004.      p = tp->tab_expanded_text;                                                 
  7005.      while (*p) {                                                               
  7006.        if isprint(*p) fprintf(fp,"%c",*p);                                      
  7007.        else fprintf(fp,"?");                                                    
  7008.        p++;                                                                     
  7009.      }                                                                          
  7010.      fprintf(fp,"\n");                                                          
  7011.    }                                                                            
  7012.  }                                                                              
  7013.  fprintf(fp,"\n");                                                              
  7014.                                                                                 
  7015.  return;                                                                        
  7016. }                                                                               
  7017.                                                                                 
  7018. /****** View the lines of text retrieved from the server. ************/         
  7019.                                                                                 
  7020. Bool                                                                            
  7021. GGMvtx(gp,ip,as_file)                                                           
  7022. Rstruc ggcb         *gp;                                                        
  7023. Rstruc gopherinfo   *ip;                                                        
  7024. Fool                 as_file;  /* ignored */                                    
  7025. {                                                                               
  7026.  int                brif_max_reclen;                                            
  7027.  int                i;                                                          
  7028.  char              *p;                                                          
  7029.  char              *q;                                                          
  7030.  struct texthdr    *texthdrp;                                                   
  7031.  void              *dialog_data_ptr;                                            
  7032.  void              *read_function_ptr;                                          
  7033.  void              *command_function_ptr;                                       
  7034.  char               read_fakeout_buffer    [32];                                
  7035.  char               command_fakeout_buffer [32];                                
  7036.  char               brif_title             [81];                                
  7037.                                                                                 
  7038.  texthdrp = (ip ? &ip->thdr : &gp->thdr);                                       
  7039.                                                                                 
  7040.  if (gp->brifp) {                                                               
  7041.    printf("Cannot use ISPF BROWSE now, displaying in line mode:\n\n");          
  7042.    print_text_lines(stdout,texthdrp->first_text_line);                          
  7043.    return TRUE;                                                                 
  7044.  }                                                                              
  7045.                                                                                 
  7046.  gp->brifp = texthdrp;                                                          
  7047.                                                                                 
  7048.  gp->brif_previous_recno = -1;                                                  
  7049.                                                                                 
  7050.  if (!ip) sprintf(brif_title, "GopherServer:%s ",gp->ggserver);                 
  7051.  else {                                                                         
  7052.    /* BRIF doesn't like blanks in the title */                                  
  7053.    for (p=ip->desc,q=brif_title,i=sizeof(brif_title)-1;                         
  7054.         i > 0 && *p;                                                            
  7055.         p++,q++,i--) {                                                          
  7056.      *q = (*p == ' ' ? '_' : *p);                                               
  7057.    }                                                                            
  7058.    *q = ' ';                                                                    
  7059.    *(q+1) = '\0';                                                               
  7060.  }                                                                              
  7061.                                                                                 
  7062.  brif_max_reclen      = gp->brifp->text_max_tab_expanded_length;                
  7063.  dialog_data_ptr      = (void *)gp;                                             
  7064.  read_function_ptr    = (void *)&GGMbrifr;                                      
  7065.  command_function_ptr = (void *)&GGMbrifc;                                      
  7066.                                                                                 
  7067.  fake_out_for_brif(&read_function_ptr,read_fakeout_buffer);                     
  7068.  fake_out_for_brif(&command_function_ptr,command_fakeout_buffer);               
  7069.                                                                                 
  7070.  if (gp->test_mode) {                                                           
  7071.    printf("Here are the %d lines BRIF should be displaying:\n\n",               
  7072.           gp->brifp->text_line_count);                                          
  7073.    print_text_lines(stdout,gp->brifp->first_text_line);                         
  7074.    gp->brifp = NULL;                                                            
  7075.    return TRUE;                                                                 
  7076.  }                                                                              
  7077.                                                                                 
  7078.  if (gp->setmsg) {                                                              
  7079.    (void)GGMispf(gp,"SETMSG MSG(ISRZ002)");                                     
  7080.    gp->setmsg = FALSE;                                                          
  7081.  }                                                                              
  7082.                                                                                 
  7083.  gp->ispfrc = ISPLINK("BRIF ",                                                  
  7084.                       brif_title,                                               
  7085.                       "V ",              /* variable record format */           
  7086.                       &brif_max_reclen,                                         
  7087.                       &read_function_ptr,                                       
  7088.                       &command_function_ptr,                                    
  7089.                       &dialog_data_ptr,                                         
  7090.                       "        ",        /* use IBM's   browse panel */         
  7091.                       "        ",        /* no format */                        
  7092.                       "NO ");            /* default sbcs data */                
  7093.                                                                                 
  7094.  gp->brifp = NULL;                                                              
  7095.                                                                                 
  7096.  switch (gp->ispfrc) {                                                          
  7097.    case  0:                                                                     
  7098.            break;                                                               
  7099.    case 12:                                                                     
  7100.  ERR1("There is no data returned from the gopher host to be browsed.");         
  7101.            break;                                                               
  7102.    case 16:                                                                     
  7103.            break;                                                               
  7104.    default:                                                                     
  7105.            GGMierr(gp);   /* handle ISPF error */                               
  7106.            break;                                                               
  7107.  }                                                                              
  7108.                                                                                 
  7109.  return TRUE;                                                                   
  7110. }                                                                               
  7111.                                                                                 
  7112. ./   ADD NAME=GGMWAIS,SSI=01060010                                              
  7113.                                                                                 
  7114.  /********************************************************************/         
  7115.  /*                                                                  */         
  7116.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7117.  /*                                                                  */         
  7118.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7119.  /*                                                                  */         
  7120.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7121.  /* including the implied warranties of merchantability and fitness, */         
  7122.  /* are expressly denied.                                            */         
  7123.  /*                                                                  */         
  7124.  /* Provided this copyright notice is included, this software may    */         
  7125.  /* be freely distributed and not offered for sale.                  */         
  7126.  /*                                                                  */         
  7127.  /* Changes or modifications may be made and used only by the maker  */         
  7128.  /* of same, and not further distributed.  Such modifications should */         
  7129.  /* be mailed to the author for consideration for addition to the    */         
  7130.  /* software and incorporation in subsequent releases.               */         
  7131.  /*                                                                  */         
  7132.  /********************************************************************/         
  7133.                                                                                 
  7134. #pragma  csect(code,  "GG@WAIS ")                                               
  7135. #pragma  csect(static,"GG$WAIS ")                                               
  7136. #include "gg.h"                                                                 
  7137.                                                                                 
  7138. /****** Gopher WAIS interface. *************************************/           
  7139.                                                                                 
  7140. Bool                                                                            
  7141. GGMwais(gp,ip,as_file)                                                          
  7142. Rstruc ggcb        *gp;                                                         
  7143. Rstruc gopherinfo  *ip;                                                         
  7144. Fool                as_file;                                                    
  7145. {                                                                               
  7146.  char              *lp;                                                         
  7147.  char               ggwaisq[256];                                               
  7148.                                                                                 
  7149.  strcpy(gp->ggserver,ip->host);     /* Specify server to connect to */          
  7150.                                                                                 
  7151.  strcpy(ggwaisq,"");                                                            
  7152.                                                                                 
  7153.  GGMispf(gp,"VGET (GGWAISQ) PROFILE");                                          
  7154.                                                                                 
  7155.  if (GGMdispl(gp,"GGMPWAIS") > 0) return FALSE;                                 
  7156.                                                                                 
  7157.  GGMivget(gp,"GGWAISQ ",ggwaisq, sizeof(ggwaisq));                              
  7158.                                                                                 
  7159.  if (!*ip->path) strcpy(gp->gopher_command, ggwaisq);                           
  7160.  else            sprintf(gp->gopher_command,"%s\t%s",ip->path,ggwaisq);         
  7161.                                                                                 
  7162.  gp->ginfo = ip;                                                                
  7163.  gp->receiving_text = FALSE;                                                    
  7164.                                                                                 
  7165.  if (!GGMconn(gp)) return FALSE;   /* Connect to gopher server      */          
  7166.                                                                                 
  7167.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  7168.                                                                                 
  7169.  GGMclrtx(gp,ip);                  /* Clear text */                             
  7170.                                                                                 
  7171.  gp->receiving_text = TRUE;                                                     
  7172.                                                                                 
  7173.  do {                                                                           
  7174.                                                                                 
  7175.    if (GGMgsrvl(gp,&lp))                  /* Get server line */                 
  7176.      if (lp)                                                                    
  7177.        (void)GGMouttx(gp,lp,ip);          /* Output text line */                
  7178.                                                                                 
  7179.  } while (lp);                            /* until no more lines */             
  7180.                                                                                 
  7181.  if (gp->time_to_go_home) {                                                     
  7182.    WARN2("No data available from server %s.\n",gp->ggserver);                   
  7183.    return FALSE;                                                                
  7184.  }                                                                              
  7185.                                                                                 
  7186.  if (gp->connected_to_server) {                                                 
  7187.    (void)GGMdisc(gp);              /* Disconnect from gopher server */          
  7188.  }                                                                              
  7189.                                                                                 
  7190.  GGMdir(gp,ip,as_file); /* display entries returned from WAIS server */         
  7191.                                                                                 
  7192.  return TRUE;                                                                   
  7193.                                                                                 
  7194. }                                                                               
  7195.                                                                                 
  7196. ./   ADD NAME=GGMWHOIS,SSI=01020013                                             
  7197.                                                                                 
  7198.  /********************************************************************/         
  7199.  /*                                                                  */         
  7200.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7201.  /*                                                                  */         
  7202.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7203.  /*                                                                  */         
  7204.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7205.  /* including the implied warranties of merchantability and fitness, */         
  7206.  /* are expressly denied.                                            */         
  7207.  /*                                                                  */         
  7208.  /* Provided this copyright notice is included, this software may    */         
  7209.  /* be freely distributed and not offered for sale.                  */         
  7210.  /*                                                                  */         
  7211.  /* Changes or modifications may be made and used only by the maker  */         
  7212.  /* of same, and not further distributed.  Such modifications should */         
  7213.  /* be mailed to the author for consideration for addition to the    */         
  7214.  /* software and incorporation in subsequent releases.               */         
  7215.  /*                                                                  */         
  7216.  /********************************************************************/         
  7217.                                                                                 
  7218. #pragma  csect(code,  "GG@WHOIS")                                               
  7219. #pragma  csect(static,"GG$WHOIS")                                               
  7220. #include "gg.h"                                                                 
  7221.                                                                                 
  7222. /****** Gopher WHOIS/FINGER interface. *****************************/           
  7223.                                                                                 
  7224. Bool                                                                            
  7225. GGMwhois(gp,ip,as_file)                                                         
  7226. Rstruc ggcb        *gp;                                                         
  7227. Rstruc gopherinfo  *ip;                                                         
  7228. Fool                as_file;        /* ignored */                               
  7229. {                                                                               
  7230.  char              *lp;                                                         
  7231.  Bool               got_some;                                                   
  7232.  char               ggwhoisq[256];                                              
  7233.                                                                                 
  7234.  strcpy(gp->ggserver,ip->host);     /* Specify server to connect to */          
  7235.                                                                                 
  7236.  strcpy(ggwhoisq,"");                                                           
  7237.                                                                                 
  7238.  GGMispf(gp,"VGET (GGWHOISQ) PROFILE");                                         
  7239.                                                                                 
  7240.  if (GGMdispl(gp,"GGMPWHOI") > 0) return FALSE;                                 
  7241.                                                                                 
  7242.  GGMivget(gp,"GGWHOISQ ",ggwhoisq, sizeof(ggwhoisq));                           
  7243.                                                                                 
  7244.  if (!*ip->path) strcpy(gp->gopher_command, ggwhoisq);                          
  7245.  else            sprintf(gp->gopher_command,"%s\t%s",ip->path,ggwhoisq);        
  7246.                                                                                 
  7247.  gp->ginfo = ip;                                                                
  7248.  gp->receiving_text = FALSE;                                                    
  7249.                                                                                 
  7250.  if (!GGMconn(gp)) return FALSE;   /* Connect to gopher server      */          
  7251.                                                                                 
  7252.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  7253.                                                                                 
  7254.  GGMclrtx(gp,ip);                  /* Clear text */                             
  7255.                                                                                 
  7256.  gp->receiving_text = TRUE;                                                     
  7257.  got_some = FALSE;                                                              
  7258.  do {                                                                           
  7259.    if (GGMgsrvl(gp,&lp)) {                /* Get server line */                 
  7260.      if (lp) {                                                                  
  7261.        got_some = TRUE;                                                         
  7262.        (void)GGMouttx(gp,lp,ip);          /* Output text line */                
  7263.      }                                                                          
  7264.    }                                                                            
  7265.  } while (lp);                            /* until no more lines */             
  7266.                                                                                 
  7267.  if (!got_some) {                                                               
  7268.    WARN2("No data available from server %s.\n",gp->ggserver);                   
  7269.    return FALSE;                                                                
  7270.  }                                                                              
  7271.                                                                                 
  7272.  if (gp->connected_to_server) {                                                 
  7273.    (void)GGMdisc(gp);              /* Disconnect from gopher server */          
  7274.  }                                                                              
  7275.                                                                                 
  7276.  GGMvtx(gp,ip,as_file);  /* display text from WHOIS/FINGER server */            
  7277.                                                                                 
  7278.  return TRUE;                                                                   
  7279.                                                                                 
  7280. }                                                                               
  7281.                                                                                 
  7282. ./   ADD NAME=GGMXTX,SSI=01050051                                               
  7283.                                                                                 
  7284.  /********************************************************************/         
  7285.  /*                                                                  */         
  7286.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7287.  /*                                                                  */         
  7288.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7289.  /*                                                                  */         
  7290.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7291.  /* including the implied warranties of merchantability and fitness, */         
  7292.  /* are expressly denied.                                            */         
  7293.  /*                                                                  */         
  7294.  /* Provided this copyright notice is included, this software may    */         
  7295.  /* be freely distributed and not offered for sale.                  */         
  7296.  /*                                                                  */         
  7297.  /* Changes or modifications may be made and used only by the maker  */         
  7298.  /* of same, and not further distributed.  Such modifications should */         
  7299.  /* be mailed to the author for consideration for addition to the    */         
  7300.  /* software and incorporation in subsequent releases.               */         
  7301.  /*                                                                  */         
  7302.  /********************************************************************/         
  7303.                                                                                 
  7304. #pragma  csect(code,  "GG@XTX  ")                                               
  7305. #pragma  csect(static,"GG$XTX  ")                                               
  7306. #include "gg.h"                                                                 
  7307.                                                                                 
  7308. /****** Extract the lines of server text into a data set. ************/         
  7309.                                                                                 
  7310. Bool                                                                            
  7311. GGMxtx(gp,ip)                                                                   
  7312. Rstruc ggcb         *gp;                                                        
  7313. Rstruc gopherinfo   *ip;                                                        
  7314. {                                                                               
  7315.  FILE               *xfp;                                                       
  7316.  struct texthdr     *thp;                                                       
  7317.  struct textline    *tp;                                                        
  7318.  struct extraction  *ep;                                                        
  7319.  int                 l;                                                         
  7320.  char               *cp;                                                        
  7321.  char                formatted_number [11];                                     
  7322.  struct extraction   the_extraction;                                            
  7323.                                                                                 
  7324.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  7325.                                                                                 
  7326.  /* Set article data for message. */                                            
  7327.                                                                                 
  7328.  if (ip) {                                                                      
  7329.    sprintf(formatted_number,"%d",ip->type);                                     
  7330.    (void)GGMivput(gp,"GGTNUM ",  formatted_number, -1);                         
  7331.    (void)GGMivput(gp,"GGTSUBJ ", ip->desc,         -1);                         
  7332.  }                                                                              
  7333.                                                                                 
  7334.  if (gp->extract_file) {                                                        
  7335.    (void)GGMispf(gp,"CONTROL DISPLAY LOCK");                                    
  7336.    (void)GGMispf(gp,"DISPLAY PANEL(GGMLEXN2)");                                 
  7337.    xfp = gp->extract_file;                                                      
  7338.  }                                                                              
  7339.  else {                                                                         
  7340.                                                                                 
  7341.    ep = &the_extraction;                                                        
  7342.    memset(ep,0,sizeof(struct extraction));                                      
  7343.    ep->mode = SEQ;                                                              
  7344.    strcpy(ep->panelname,"GGMPEXDS");                                            
  7345.                                                                                 
  7346.    if (!((xfp=GGMgetds(gp,ep)))) return FALSE;                                  
  7347.                                                                                 
  7348.    gp->extract_tab_expanding          = ep->tab_expanding;                      
  7349.    gp->extract_appending              = ep->appending;                          
  7350.    gp->extract_blank_before_separator = ep->blanking;                           
  7351.    gp->extract_separator_line         = ep->separator;                          
  7352.  }                                                                              
  7353.                                                                                 
  7354.  /* If append mode, and a separator line was specified, use it. */              
  7355.                                                                                 
  7356.  gp->extract_write_error = FALSE;                                               
  7357.  gp->extract_close_error = FALSE;                                               
  7358.                                                                                 
  7359.  while (gp->extract_appending && gp->extract_separator_line &&                  
  7360.         *gp->extract_separator_line) {                                          
  7361.    if (fprintf(xfp,"%s\n",gp->extract_separator_line) < 0) {                    
  7362.      gp->extract_write_error = TRUE; break;                                     
  7363.    }                                                                            
  7364.    if (gp->extract_blank_before_separator) {                                    
  7365.      if (fprintf(xfp,"\n") < 0) {                                               
  7366.        gp->extract_write_error = TRUE; break;                                   
  7367.      }                                                                          
  7368.    }                                                                            
  7369.    break;                                                                       
  7370.  }                                                                              
  7371.  for (tp = thp->first_text_line;                                                
  7372.       tp && !gp->extract_write_error;                                           
  7373.       tp = tp->next) {                                                          
  7374.    if (tp->text_length == 0) {                                                  
  7375.      if (fputc('\n',xfp) == EOF) {                                              
  7376.        gp->extract_write_error = TRUE; break;                                   
  7377.      }                                                                          
  7378.    }                                                                            
  7379.    else if (tp->text_length > 0) {                                              
  7380.      if (gp->extract_tab_expanding) {                                           
  7381.        cp = tp->tab_expanded_text;                                              
  7382.        l  = tp->tab_expanded_text_length;                                       
  7383.      }                                                                          
  7384.      else {                                                                     
  7385.        cp = tp->text;                                                           
  7386.        l  = tp->text_length;                                                    
  7387.      }                                                                          
  7388.      for (; l > 0; cp += 251, l -= 251) {                                       
  7389.        fwrite(cp,(l>251 ? 251 : l),1,xfp);                                      
  7390.        if (ferror(xfp)) {                                                       
  7391.          gp->extract_write_error = TRUE; break;                                 
  7392.        }                                                                        
  7393.        if (fputc('\n',xfp) == EOF) {                                            
  7394.          gp->extract_write_error = TRUE; break;                                 
  7395.        }                                                                        
  7396.      }                                                                          
  7397.    }                                                                            
  7398.  }                                                                              
  7399.                                                                                 
  7400.  if (!gp->extract_write_error && ferror(xfp))                                   
  7401.     gp->extract_write_error = TRUE;                                             
  7402.                                                                                 
  7403.  if (!gp->extract_appending || !gp->extract_file) {                             
  7404.    if (fclose(xfp) < 0) {                                                       
  7405.      /* perror(nnexdsn); */                                                     
  7406.      ERR2("An error occurred closing data set %s.", ep->dsname);                
  7407.      gp->extract_close_error = TRUE;                                            
  7408.      return FALSE;                                                              
  7409.    }                                                                            
  7410.  }                                                                              
  7411.                                                                                 
  7412.  if (!gp->extract_file) {                                                       
  7413.    if (gp->extract_write_error) {                                               
  7414.      ERR2("An error occurred writing to data set %s.", ep->dsname);             
  7415.      gp->extract_write_error = TRUE;                                            
  7416.    }                                                                            
  7417.    else if (ip) {                                                               
  7418.      WARN2("Current item extracted into file %s.",                              
  7419.             ep->dsname);                                                        
  7420.    }                                                                            
  7421.    else {                                                                       
  7422.      WARN2("Displayed text has been extracted into file %s.",                   
  7423.             ep->dsname);                                                        
  7424.    }                                                                            
  7425.  }                                                                              
  7426.  if (gp->extract_write_error) return FALSE;                                     
  7427.  else return TRUE;                                                              
  7428. }                                                                               
  7429.                                                                                 
  7430. ./   ADD NAME=GGSERVER,SSI=010E0026                                             
  7431. /*                                                                              
  7432.  ***********************************************************************        
  7433.  *                                                                     *        
  7434.  * GOPHER server, based on the simple TCP/IP server from Shawn Hart at *        
  7435.  * the University of Delaware.                                         *        
  7436.  *                                                                     *        
  7437.  ***********************************************************************        
  7438.  *                                                                              
  7439.  *  This server follows the GOPHER protocols defined by UMN.                    
  7440.  *  For more information, see the ANONYMOUS FTP site at                         
  7441.  *  BOOMBOX.MICRO.UMN.EDU.                                                      
  7442.  *                                                                              
  7443.  */                                                                             
  7444.                                                                                 
  7445. #pragma  csect(code,  "GG@ERVER")                                               
  7446. #pragma  csect(static,"GG$ERVER")                                               
  7447. #include "gg.h"                 /* All system file includes needed. */          
  7448.                                                                                 
  7449. /********************************************************************/          
  7450.                                                                                 
  7451. static int                                                                      
  7452. tcpsetup(int          port,                                                     
  7453.          int          qlen)                                                     
  7454. {                                                                               
  7455.  int                  tinitrc;             /* loop counter*/                    
  7456.  int                  sockfd;              /* loop counter*/                    
  7457.  int                  x;                   /* loop counter*/                    
  7458.  struct linger        l;                   /* linger for setsockopt */          
  7459.  struct sockaddr_in   server;   /*server address information */                 
  7460.                                                                                 
  7461.  /*    initialize the MTF  environment.                   */                    
  7462.                                                                                 
  7463. #ifdef DEBUGMTF                                                                 
  7464.  fprintf(stderr,"tinit...\n");                                                  
  7465. #endif                                                                          
  7466.                                                                                 
  7467.  tinitrc = tinit("GGSTASK", MTF_TASKS);                                         
  7468.                                                                                 
  7469.  if (tinitrc != MTF_OK) {                                                       
  7470.    GGMmtfer(tinitrc, "TINIT");                                                  
  7471.    return -1;                                                                   
  7472.  }                                                                              
  7473.                                                                                 
  7474.  /*       open a TCP socket...                            */                    
  7475.                                                                                 
  7476.  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {                          
  7477.    tcperror("SOCKET - ");                                                       
  7478.    return -1;                                                                   
  7479.  };                                                                             
  7480.                                                                                 
  7481.  /*  set the linger option on so we wait for data to be sent... */              
  7482.                                                                                 
  7483.  l.l_onoff  =  1;                                                               
  7484.  l.l_linger =100;           /* wait 100 seconds before giving up */             
  7485.                                                                                 
  7486.  if (setsockopt(sockfd,SOL_SOCKET,SO_LINGER,(char *)&l,sizeof(l))               
  7487.      < 0) {                                                                     
  7488.    tcperror("SETSOCKOPT - ");                                                   
  7489.    return -1;                                                                   
  7490.  }                                                                              
  7491.                                                                                 
  7492.  /*    now bind our local address so that the client can send to us */          
  7493.                                                                                 
  7494.  memset((char *)&server, 0, sizeof(server));                                    
  7495.  server.sin_family           =   AF_INET;                                       
  7496.  server.sin_addr.s_addr      =   INADDR_ANY;                                    
  7497.  server.sin_port             =   htons(port);                                   
  7498.                                                                                 
  7499.  if (bind(sockfd, &server, sizeof(server)) < 0) {                               
  7500.    tcperror("BIND - ");                                                         
  7501.    return -1;                                                                   
  7502.  }                                                                              
  7503.                                                                                 
  7504.  /*    now set length of the connection queue... */                             
  7505.                                                                                 
  7506.  if (listen(sockfd,qlen) != 0) {                                                
  7507.    tcperror("LISTEN -");                                                        
  7508.    return -1;                                                                   
  7509.  }                                                                              
  7510.                                                                                 
  7511.  return sockfd;                                                                 
  7512.                                                                                 
  7513. }                                                                               
  7514.                                                                                 
  7515.                                                                                 
  7516. /********************************************************************/          
  7517. /*                                                                              
  7518. *   This routine waits for an exception on the socket.  When one                
  7519. *   occurs (by a subtask's "TAKESOCKET"!) we'll close our (the main             
  7520. *   task's) connection to it.                                                   
  7521. *                                                                               
  7522. *               INPUT   s   pointer to socket descripter.                       
  7523. *               OUTPUT  rc  -1 = connection timed out...                        
  7524. *                            0 = an excption occured!                           
  7525. */                                                                              
  7526. /********************************************************************/          
  7527.                                                                                 
  7528. static int                                                                      
  7529. closesock(int              newsockfd)                                           
  7530. {                                                                               
  7531.  int                       temps;                                               
  7532.  struct sockaddr           clientaddress;                                       
  7533.  int                       addrlen;                                             
  7534.  int                       maxfdpl;                                             
  7535.  struct fd_set             readmask;                                            
  7536.  struct fd_set             writmask;                                            
  7537.  struct fd_set             exepmask;                                            
  7538.  int                       rc;                                                  
  7539.  struct timeval            time;                                                
  7540.                                                                                 
  7541.  temps = newsockfd;                                                             
  7542.  time.tv_sec = CONNECT_TIME_OUT;                                                
  7543.  time.tv_usec = 0;                                                              
  7544.  maxfdpl = temps + 1;                                                           
  7545.                                                                                 
  7546.  FD_ZERO(&readmask);                                                            
  7547.  FD_ZERO(&writmask);                                                            
  7548.  FD_ZERO(&exepmask);                                                            
  7549.  FD_SET(temps, &exepmask);                                                      
  7550.                                                                                 
  7551.  rc = select(maxfdpl, &readmask, &writmask, &exepmask, &time);                  
  7552.                                                                                 
  7553.  if (rc < 0) {                                                                  
  7554.    tcperror("SELECT - ");                                                       
  7555.    return rc;                                                                   
  7556.  }                                                                              
  7557.  else {                                                                         
  7558.    if (rc == 0) fprintf(stderr,"The GIVESOCKET timed out!\n");                  
  7559.                                                                                 
  7560.    if (close(newsockfd) < 0) tcperror("CLOSE -");                               
  7561.    return rc;                                                                   
  7562.  }                                                                              
  7563. }                                                                               
  7564.                                                                                 
  7565. /********************************************************************/          
  7566. /*                                                                              
  7567. *       This routine starts a subtask, passing control of a socket              
  7568. *       to it.  It then waits for the subtask to take the socket and            
  7569. *       then closes the socket.                                                 
  7570. *                                                                               
  7571. *       INPUT: newsockfd - socket descriptor to give to subtask.                
  7572. */                                                                              
  7573. /********************************************************************/          
  7574.                                                                                 
  7575. static Bool                                                                     
  7576. spawn(                                                                          
  7577.       int          newsockfd)                                                   
  7578. {                                                                               
  7579.  int               tschedrc;                                                    
  7580.  struct clientid   clid;                                                        
  7581.  char              mysname[8];                                                  
  7582.                                                                                 
  7583.  if(getclientid(AF_INET,&clid) < 0) {                                           
  7584.    tcperror("GETCLIENTID");                                                     
  7585.    return FALSE;                                                                
  7586.  }                                                                              
  7587.  clid.domain = AF_INET;                                                         
  7588.  memcpy(mysname,clid.subtaskname,8);                                            
  7589.  memcpy(clid.subtaskname,"        ",8);                                         
  7590.                                                                                 
  7591.  if(givesocket(newsockfd,&clid) != 0) {                                         
  7592.    tcperror("GIVESOCKET");                                                      
  7593.    return FALSE;                                                                
  7594.  }                                                                              
  7595.  memcpy(clid.subtaskname,mysname,8);                                            
  7596.                                                                                 
  7597. #ifdef DEBUGMTF                                                                 
  7598.  fprintf(stderr,"tsched...\n");                                                 
  7599. #endif                                                                          
  7600.                                                                                 
  7601.  tschedrc = tsched(MTF_ANY,"GGSRECV",newsockfd,clid);                           
  7602.  if (tschedrc != 0) {                                                           
  7603.    GGMmtfer(tschedrc,"TSCHED");                                                 
  7604.    return FALSE;                                                                
  7605.  }                                                                              
  7606.                                                                                 
  7607.  if (closesock(newsockfd) < 0) {                                                
  7608.    tcperror("close socket");                                                    
  7609.    return FALSE;                                                                
  7610.  }                                                                              
  7611.                                                                                 
  7612.  return TRUE;                                                                   
  7613.                                                                                 
  7614. }                                                                               
  7615.                                                                                 
  7616. /******************************************************************/            
  7617.                                                                                 
  7618. int                                                                             
  7619. main(int            argc,                                                       
  7620.          char     **argv)                                                       
  7621. {                                                                               
  7622.  int                trc;               /* return code */                        
  7623.  int                x;                 /* loop counter*/                        
  7624.  int                sockfd;            /* connection socket...*/                
  7625.  int                newsockfd;         /* new connection socket...*/            
  7626.  int                clientlen;         /* new connection socket...*/            
  7627.  struct sockaddr_in client;            /* client address information */         
  7628.  struct clientid    clid;              /* client info for givesocket */         
  7629.  char               buffer[255];       /* buffer for input/output*/             
  7630.                                                                                 
  7631. /******************************************************************/            
  7632. /*         set up the connection to the socket...                 */            
  7633. /******************************************************************/            
  7634.                                                                                 
  7635.  sockfd = tcpsetup(SERV_TCP_PORT,TCP_QUEUE_LENGTH);                             
  7636.  if (sockfd < 0) {                                                              
  7637.    fprintf(stderr,"Could not set up the TCP/IP environment!\n");                
  7638.    exit(16);                                                                    
  7639.  }                                                                              
  7640.                                                                                 
  7641. /******************************************************************/            
  7642. /*         Now loop, waiting for a connection request.            */            
  7643. /******************************************************************/            
  7644.                                                                                 
  7645.  clientlen = sizeof(client);                                                    
  7646.  x = 0;                                                                         
  7647.  for (;;) {                                                                     
  7648.                                                                                 
  7649.    if ((newsockfd=accept(sockfd,&client,&clientlen)) == -1) {                   
  7650.      tcperror("ACCEPT - ");                                                     
  7651.      exit(8);                                                                   
  7652.    }                                                                            
  7653.    x++;                                                                         
  7654.    if (!spawn(newsockfd)) {                                                     
  7655.      fprintf(stderr,"spawn failed for socket %d\n",newsockfd);                  
  7656.      exit(8);                                                                   
  7657.    }                                                                            
  7658.    else {                                                                       
  7659. #ifdef DEBUGMTF                                                                 
  7660.      fprintf(stderr,"spawn OK for socket %d\n",newsockfd);                      
  7661. #endif                                                                          
  7662.    }                                                                            
  7663.  }                                                                              
  7664.                                                                                 
  7665. /******************************************************************/            
  7666. /*         Wait for all pending tasks to complete (should never   */            
  7667. /*         run, since I haven't added PURGE support yet...)       */            
  7668. /*         then shut down subtasks.                               */            
  7669. /******************************************************************/            
  7670.                                                                                 
  7671. #ifdef DEBUGMTF                                                                 
  7672.  fprintf(stderr,"tsyncro...\n");                                                
  7673. #endif                                                                          
  7674.                                                                                 
  7675.  trc = tsyncro(MTF_ALL);                                                        
  7676.  if (trc != 0) {                                                                
  7677.    GGMmtfer(trc,"TSYNCRO");                                                     
  7678.  }                                                                              
  7679.                                                                                 
  7680. #ifdef DEBUGMTF                                                                 
  7681.  fprintf(stderr,"tterm...\n");                                                  
  7682. #endif                                                                          
  7683.                                                                                 
  7684.  trc = tterm();                                                                 
  7685.  if (trc != 4) {                                                                
  7686.    GGMmtfer(trc,"TTERM");                                                       
  7687.    exit(8);                                                                     
  7688.  }                                                                              
  7689.                                                                                 
  7690.  exit(0);                                                                       
  7691.                                                                                 
  7692. }                                                                               
  7693. ./   ADD NAME=GGSTASK,SSI=01530040                                              
  7694.                                                                                 
  7695.  /********************************************************************/         
  7696.  /*                                                                  */         
  7697.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7698.  /*                                                                  */         
  7699.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7700.  /* including the implied warranties of merchantability and fitness, */         
  7701.  /* are expressly denied.                                            */         
  7702.  /*                                                                  */         
  7703.  /* Provided this copyright notice is included, this software may    */         
  7704.  /* be freely distributed and not offered for sale.                  */         
  7705.  /*                                                                  */         
  7706.  /* Changes or modifications may be made and used only by the maker  */         
  7707.  /* of same, and not further distributed.  Such modifications should */         
  7708.  /* be mailed to the author for consideration for addition to the    */         
  7709.  /* software and incorporation in subsequent releases.               */         
  7710.  /*                                                                  */         
  7711.  /********************************************************************/         
  7712.                                                                                 
  7713. #pragma  csect(code,  "GGSTASK ")                                               
  7714. #pragma  csect(static,"GG$TASK ")                                               
  7715.                                                                                 
  7716. #include "gg.h"                                                                 
  7717.                                                                                 
  7718. /*=================================================================*/           
  7719.                                                                                 
  7720. /*******************************************************************/           
  7721. /*                                                                 */           
  7722. /*    this is a debugging routine;  it looks at the status of a    */           
  7723. /*    socket.                                                      */           
  7724. /*******************************************************************/           
  7725.                                                                                 
  7726. static void                                                                     
  7727. lookatsocket(int sockfd)                                                        
  7728. {                                                                               
  7729.  int             rc;                       /* return code */                    
  7730.  int             length;                   /* length variable */                
  7731.  int             option;                                                        
  7732.  int             x;                                                             
  7733.  struct linger   l;                        /* linger structure */               
  7734.  char            buffer[RBUFSIZE];                                              
  7735.                                                                                 
  7736.  length = sizeof(l);                                                            
  7737.  if (getsockopt(sockfd,SOL_SOCKET, SO_LINGER,&l,&length)==0) {                  
  7738.    printf("l_onoff=%d\n",l.l_onoff);                                            
  7739.    printf("l_linger=%d\n",l.l_linger);                                          
  7740.  }                                                                              
  7741.  else tcperror("GETSOCKOPT");                                                   
  7742.                                                                                 
  7743.  length = sizeof(option);                                                       
  7744.  if (getsockopt(sockfd,SOL_SOCKET, SO_ERROR,&option,&length)==0) {              
  7745.    printf("so_error=%d\n",option);                                              
  7746.  }                                                                              
  7747.  else tcperror("GETSOCKOPT");                                                   
  7748.                                                                                 
  7749.  if (fcntl(sockfd,F_SETFL,FNDELAY)!=0) tcperror("FCNTL");                       
  7750.                                                                                 
  7751.  length = recv(sockfd,buffer,sizeof(buffer)-1,0);                               
  7752.  if (length == -1) {                                                            
  7753.    if (errno != EWOULDBLOCK) tcperror("recv");                                  
  7754.  }                                                                              
  7755.  else {                                                                         
  7756.    buffer[sizeof(buffer)-1] = 0;                                                
  7757.    printf("buffer =%s\n",buffer);                                               
  7758.    for (x=0;x<length;x++) printf("%x ",buffer[x]);                              
  7759.    printf("\n");                                                                
  7760.  }                                                                              
  7761.                                                                                 
  7762. }                                                                               
  7763.                                                                                 
  7764. /*******************************************************************/           
  7765.                                                                                 
  7766. /**************************************************************/                
  7767. /*    this routine processes the data once a connection       */                
  7768. /*    has been accepted.  It just takes the data sent by the  */                
  7769. /*    client and prints it to sysprint, then sends it back    */                
  7770. /*    to the client.                                          */                
  7771. /*                                                            */                
  7772. /*             INPUT:   newsockfd  - socket descriptor        */                
  7773. /*                      clid       - takesocket structure...  */                
  7774. /**************************************************************/                
  7775.                                                                                 
  7776. void                                                                            
  7777. GGSrecv(                                                                        
  7778.  int                newsockfd,                                                  
  7779.  struct clientid    clid                                                        
  7780.        )                                                                        
  7781. {                                                                               
  7782.  struct recvstruct *R;                                                          
  7783.  struct hostent    *hostentp;                                                   
  7784.  char              *bufptr;   /* pointer into buffer strings         */         
  7785.  char              *hp;                                                         
  7786.  char             **halias;                                                     
  7787.  int                retcode;  /* return code                         */         
  7788.  int                len;      /* length of the buffer we're sent     */         
  7789.  int                x;        /* loop counter                        */         
  7790.  int                addrlen;  /* length of client address socket     */         
  7791.  int                hostlen;                                                    
  7792.  int                domslen;                                                    
  7793.  struct sockaddr_in clientaddress; /* address of client              */         
  7794.  struct recvstruct  r;                                                          
  7795.  time_t             timeval;                                                    
  7796.  struct tm         *tmp;                                                        
  7797.  char               outbuf[RBUFSIZE];  /* hold an output string */              
  7798.  char               timestamp[20];                                              
  7799.                                                                                 
  7800.  memset(&r, 0, sizeof(struct recvstruct));                                      
  7801.  R = &r;                                                                        
  7802.                                                                                 
  7803.  R->sockfd = takesocket(&clid,newsockfd);                                       
  7804.  if(R->sockfd < 0) {                                                            
  7805.    tcperror("TAKESOCKET");                                                      
  7806.    return;                                                                      
  7807.  }                                                                              
  7808.                                                                                 
  7809.  time(&timeval);                                                                
  7810.  tmp = localtime(&timeval);                                                     
  7811.  sprintf(timestamp,"%2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d",                       
  7812.          tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_year,                           
  7813.          tmp->tm_hour, tmp->tm_min, tmp->tm_sec);                               
  7814.                                                                                 
  7815.  addrlen = sizeof(clientaddress);                                               
  7816.  if(getpeername(R->sockfd,&clientaddress,&addrlen)!=0) {                        
  7817.    tcperror("GETPEERNAME");                                                     
  7818.    printf("could not determine client address\n");                              
  7819.  }                                                                              
  7820.                                                                                 
  7821.  /* Try to get the name of the client host. */                                  
  7822.                                                                                 
  7823.  strcpy(R->hostname,"{UNKNOWN HOST NAME}");                                     
  7824.                                                                                 
  7825.  hostentp = gethostbyaddr(&clientaddress.sin_addr,                              
  7826.                           sizeof(clientaddress.sin_addr),                       
  7827.                           AF_INET);                                             
  7828.                                                                                 
  7829.  if (hostentp && hostentp->h_name) {                                            
  7830.    memcpy(&R->clienthostent, hostentp, sizeof(struct hostent));                 
  7831.    strcpy(R->hostname,hostentp->h_name);                                        
  7832.    uppercase_in_place(R->hostname);                                             
  7833.  }                                                                              
  7834.                                                                                 
  7835.  strcpy(R->hosttest,R->hostname);                                               
  7836.                                                                                 
  7837.  hostlen = strlen(R->hosttest);                                                 
  7838.  domslen = sizeof(MY_DOMAIN_SUFFIX) - 1;                                        
  7839.  if (hostlen > domslen) {                                                       
  7840.    hp = R->hosttest + hostlen - domslen;                                        
  7841.    if (!memcmp(hp, MY_DOMAIN_SUFFIX, domslen)) {                                
  7842.      *hp = '\0';                                                                
  7843.    }                                                                            
  7844.  }                                                                              
  7845.                                                                                 
  7846.  printf("%s Connection from %s (%s, aka %s).\n",                                
  7847.         timestamp,                                                              
  7848.         inet_ntoa(clientaddress.sin_addr), R->hostname, R->hosttest);           
  7849.                                                                                 
  7850.  for (halias = R->clienthostent.h_aliases; *halias; halias++) {                 
  7851.    printf("  Host alias:'%s'\n",*halias);                                       
  7852.  }                                                                              
  7853.                                                                                 
  7854.  R->buffer[0] = '\0';                                                           
  7855.  bufptr = R->buffer;                                                            
  7856.                                                                                 
  7857. /***********************/                                                       
  7858. /*  NOTE:  sometimes, if timing is right, RECV can return a 0 length */         
  7859. /* record when a connection is closed by the client!!  below is a   */          
  7860. /* hack to check for a 0 length record, and then terminate this     */          
  7861. /* connection if we got one.                                        */          
  7862. /***********************/                                                       
  7863.                                                                                 
  7864.  for (;;) {                                                                     
  7865.    if ((len=recv(R->sockfd,outbuf,sizeof(R->buffer)-1,0)) <= 0) {               
  7866.      tcperror("RECV - ");                                                       
  7867.      printf("tcp error! len=%d\n",len);                                         
  7868.      break;                                                                     
  7869.    }                                                                            
  7870.                                                                                 
  7871.    *(outbuf+(len))=0;    /*make sure it's null terminated...*/                  
  7872.    /* printf("len=%d;",len); */                                                 
  7873.    asctoebd(outbuf);                                                            
  7874.    if (strlen(R->buffer) + strlen(outbuf) >= sizeof(R->buffer)) {               
  7875.      printf("\nError: More than %d bytes seen without CRLF\n",                  
  7876.             sizeof(R->buffer)-1);                                               
  7877.      len = 0;                                                                   
  7878.      break;                                                                     
  7879.    }                                                                            
  7880.    strcat(R->buffer,outbuf);                                                    
  7881.    bufptr=R->buffer+(strlen(R->buffer)-2);                                      
  7882.    if (*bufptr == CARRIAGE_RETURN && *(bufptr+1) == LINE_FEED) break;           
  7883.  }                                                                              
  7884.                                                                                 
  7885.  /* Note: no \n required, data line already has CRLF in it */                   
  7886.  fprintf(stderr,"%s Client data:%s", timestamp, R->buffer);                     
  7887.                                                                                 
  7888.  if (len < 0) return;                                                           
  7889.  else if (len == 0) {                                                           
  7890.    (void)GGMouts(R,                                                             
  7891.   "1Sorry, the GOPHER server couldn't hear you.  Try again.\t0\t0\t0");         
  7892.  }                                                                              
  7893.  else (void)GGMproc(R);                                                         
  7894.                                                                                 
  7895.  (void)GGMouts(R,NULL);          /* send terminating dot */                     
  7896.                                                                                 
  7897.  fflush(stdout);                                                                
  7898.  fflush(stderr);                                                                
  7899.                                                                                 
  7900.  /*     lookatsocket(R->sockfd);    */                                          
  7901.                                                                                 
  7902.  if(close(R->sockfd)<0) tcperror("CLOSE - ");                                   
  7903.                                                                                 
  7904. }                                                                               
  7905. ./ ENDUP                                                                        
  7906. ?!                                                                              
  7907. //CLIST    EXEC GGLOAD,TRK1='4',TO='CLIST'                                      
  7908. //SYSIN    DD DATA,DLM='?!'                                                     
  7909. ./   ADD NAME=GOPHER,SSI=010F0028                                               
  7910. /* REXX. GOPHER client.  */                                                     
  7911.                                                                                 
  7912. /* *** Customize the following lines for your installation.                     
  7913.  * If ggmpanel is set to "", it will not be LIBDEF'd.                           
  7914.  */                                                                             
  7915.                                                                                 
  7916. ggmprefix      = "GOPHER"                                                       
  7917. ggmpanelsuffix = "PANELS"                                                       
  7918. ggmloadsuffix  = "LOAD"                                                         
  7919. ggmlmod        = "GGCLIENT"                                                     
  7920. ggmpanel       = ggmprefix"."ggmpanelsuffix                                     
  7921. ggmload        = ggmprefix"."ggmloadsuffix                                      
  7922. ggmappl        = ""                     /* ISPF applid (e.g. ISR)  */           
  7923. ggmdefaulthost = "gopher.micro.umn.edu" /* to initialize GOPHERRC  */           
  7924. gophermeister  = ""              /* TSOid of Gopher's Big Brother  */           
  7925. xprocavailable = 0               /* set to 1 if XPROC is available */           
  7926.                                                                                 
  7927. trace off                                                                       
  7928. signal on novalue                                                               
  7929. stacked   = 0                                                                   
  7930. libdeffed = 0                                                                   
  7931. parse arg args                                                                  
  7932. "ISPQRY"                                                                        
  7933. if rc > 0 then do                                                               
  7934.  parse source . . execname . execds .                                           
  7935.  if execds = "?" then                                                           
  7936.   icmd = "%"execname args                                                       
  7937.  else                                                                           
  7938.   icmd = "EX '"execds"("execname")'" quote(args)                                
  7939.  call startispf ggmappl, icmd                                                   
  7940.  exit                                                                           
  7941. end                                                                             
  7942.                                                                                 
  7943. if xprocavailable then do                                                       
  7944.                                                                                 
  7945.  save_prompt = prompt("ON")                                                     
  7946.  "XPROC 0 TEST DEBUG FORCE LOCAL SERVER() PORT() PATH() DESCRIPTION()"          
  7947.  if rc <> 0 then exit rc                                                        
  7948.  call prompt save_prompt                                                        
  7949.                                                                                 
  7950. end                                                                             
  7951.                                                                                 
  7952. else do /* XPROC not available */                                               
  7953.                                                                                 
  7954.  server = ""                                                                    
  7955.  port = 70                                                                      
  7956.  path  =                                                                        
  7957.  description =                                                                  
  7958.  local =                                                                        
  7959.  force =                                                                        
  7960.  test  =                                                                        
  7961.  debug =                                                                        
  7962.  uargs = translate(args)                                                        
  7963.  if wordpos("LOCAL",uargs) > 0 then local = "LOCAL"                             
  7964.  if wordpos("FORCE",uargs) > 0 then force = "FORCE"                             
  7965.  if wordpos("TEST" ,uargs) > 0 then test  = "TEST"                              
  7966.  if wordpos("DEBUG",uargs) > 0 then debug = "DEBUG"                             
  7967.                                                                                 
  7968. end                                                                             
  7969.                                                                                 
  7970. signal on failure                                                               
  7971. signal on halt                                                                  
  7972.                                                                                 
  7973. call check_for_other_socket_app                                                 
  7974. call read_gopherrc                                                              
  7975. call validate_operands                                                          
  7976. call libdef                                                                     
  7977. call let_me_know                                                                
  7978. call ggm_dialog                                                                 
  7979. call unlibdef                                                                   
  7980.                                                                                 
  7981. cleanup:                                                                        
  7982. if libdeffed then call unlibdef                                                 
  7983. if stacked then "DELSTACK"                                                      
  7984. exit                                                                            
  7985. error:failure:halt:say "GOPHER: Severe lossage."                                
  7986. say "Statement:" sourceline(sigl)                                               
  7987. exit                                                                            
  7988.                                                                                 
  7989. /*********************************************************************/         
  7990.                                                                                 
  7991. validate_operands:                                                              
  7992.                                                                                 
  7993. /*                                                                              
  7994.  * Logic that determines what to display on startup:                            
  7995.  * If gopherrc file does not exist, create it from default                      
  7996.  * (default has everything commented out except for a                           
  7997.  *  one-item "initial" menu pointing to the MVS server)                         
  7998.  * Read gopherrc (in case operands need fields therein)                         
  7999.  * Command operands override gopherrc specs:                                    
  8000.  * if LOCAL given then server = "-", see below for SERVER(-)                    
  8001.  * if SERVER(host) given then startup host=SERVER, path=PATH, etc.              
  8002.  *  (no gopherrc referenced)                                                    
  8003.  * if SERVER(-) given then either PATH must be given or                         
  8004.  *  the gopherrc's localmenu: must be given,                                    
  8005.  *  otherwise look at gopherrc                                                  
  8006.  *   if LOCAL given and initial: present then extract startup menu              
  8007.  *    but remember that there will be no server access possible                 
  8008.  *   else nothing given, this is an error, barf                                 
  8009.  * if no SERVER, look at gopherrc:                                              
  8010.  *   if initial: given then extract startup menu from there                     
  8011.  *   else if localmenu: given then use that menu (SERVER=-)                     
  8012.  *   else nothing given, display ISPF panel asking for host/path                
  8013.  */                                                                             
  8014.                                                                                 
  8015. if local = "LOCAL" then do                                                      
  8016.  if server <> "" then do                                                        
  8017.   say "GOPHER: SERVER cannot be specified when LOCAL is specified."             
  8018.   exit 12                                                                       
  8019.  end                                                                            
  8020.  server = "-"                                                                   
  8021. end                                                                             
  8022.                                                                                 
  8023. ggpath = ""                                                                     
  8024. gghost = ""                                                                     
  8025. ggport = port                                                                   
  8026. ggdesc = description                                                            
  8027.                                                                                 
  8028. if server <> "" then do                                                         
  8029.  if server = "-" then do                                                        
  8030.   gghost = server                                                               
  8031.   if path <> "" then do                                                         
  8032.    ggpath = path                                                                
  8033.   end                                                                           
  8034.   else if localmenu <> "" then do                                               
  8035.    ggpath = localmenu                                                           
  8036.    if ggdesc = "" then ggdesc = "Local Private Gopher Menu"                     
  8037.   end                                                                           
  8038.   else if local = "LOCAL" & initial <> "" then do                               
  8039.    gghost = ""                                                                  
  8040.    call use_initial_spec                                                        
  8041.    if gghost <> "-" then do                                                     
  8042.     say "Gopher: Cannot determine path for local access."                       
  8043.     say "        Either specify PATH(pathname), activate"                       
  8044.     say "        the localmenu: line in GOPHERRC, or set"                       
  8045.     say "        the initial: line in GOPHERRC for local access."               
  8046.     exit 12                                                                     
  8047.    end                                                                          
  8048.   end                                                                           
  8049.   else do                                                                       
  8050.    say "Gopher: Cannot determine path for local access."                        
  8051.    say "        Either specify PATH(pathname) or activate"                      
  8052.    say "        the localmenu: or initial: line in GOPHERRC."                   
  8053.    exit 12                                                                      
  8054.   end                                                                           
  8055.  end                                                                            
  8056.  else do                                                                        
  8057.   gghost = server                                                               
  8058.   ggpath = path                                                                 
  8059.   ggdesc = description                                                          
  8060.   ggport = port                                                                 
  8061.   nop  /* use provided server, host, path, etc. */                              
  8062.  end                                                                            
  8063. end                                                                             
  8064. else do       /* no server given on command */                                  
  8065.  if localmenu <> "" then do                                                     
  8066.   gghost = "-"                                                                  
  8067.   ggpath = localmenu                                                            
  8068.   if ggdesc = "" then ggdesc = "Local Private Gopher Menu"                      
  8069.  end                                                                            
  8070.  else if initial <> "" then do                                                  
  8071.   call use_initial_spec                                                         
  8072.  end                                                                            
  8073.  else do                                                                        
  8074.   /* this is nominally illegal, but should cause gopher to                      
  8075.      display the hackish startup menu */                                        
  8076.   gghost = ""                                                                   
  8077.   ggpath = ""                                                                   
  8078.  end                                                                            
  8079. end                                                                             
  8080.                                                                                 
  8081. return                                                                          
  8082.                                                                                 
  8083. /*********************************************************************/         
  8084.                                                                                 
  8085. use_initial_spec:                                                               
  8086.                                                                                 
  8087.  if initial = "*temp*" then do                                                  
  8088.   /* we're eventually not going to do it this way really */                     
  8089.   /* initial_type is ignored - only "DIRECTORY" is valid anyway */              
  8090.   if initial_name <> "" & ggdesc = "" then ggdesc = initial_name                
  8091.   if initial_host <> "" & gghost = "" then gghost = initial_host                
  8092.   if initial_path <> "" & ggpath = "" then ggpath = initial_path                
  8093.   if initial_port <> "" & ggport = "" then ggport = initial_port                
  8094.  end                                                                            
  8095.  else do                                                                        
  8096.   ggpath = initial                                                              
  8097.   if ggdesc = "" then ggdesc = "Local Private Gopher Menu"                      
  8098.  end                                                                            
  8099.                                                                                 
  8100. return                                                                          
  8101.                                                                                 
  8102. /*********************************************************************/         
  8103.                                                                                 
  8104. read_gopherrc:                                                                  
  8105.                                                                                 
  8106. localmenu = ""                                                                  
  8107. localexec = ""                                                                  
  8108. initial   = ""                                                                  
  8109. initial_type = ""                                                               
  8110. initial_name = ""                                                               
  8111. initial_host = ""                                                               
  8112. initial_path = ""                                                               
  8113. initial_port = ""                                                               
  8114. new_gopherrc = 0                                                                
  8115. gopherrc = "'"userid()".GOPHERRC'"                                              
  8116. gopherdcb = "RECFM(V B) LRECL(255) BLKSIZE(6233) DSORG(PS)"                     
  8117. gopherrc_status = sysdsn(gopherrc)                                              
  8118. select                                                                          
  8119.  when gopherrc_status = "OK" then nop                                           
  8120.  when gopherrc_status = "DATASET NOT FOUND" then do                             
  8121.   address TSO "ALLOC DA("gopherrc") T SP(1 1)" gopherdcb                        
  8122.   if rc <> 0 then do                                                            
  8123.    say "Error: Cannot create" gopherrc                                          
  8124.    exit rc                                                                      
  8125.   end                                                                           
  8126.   new_gopherrc = 1                                                              
  8127.  end                                                                            
  8128.  otherwise do                                                                   
  8129.   say "Error: Cannot access" gopherrc":" gopherrc_status                        
  8130.   exit 16                                                                       
  8131.  end                                                                            
  8132. end                                                                             
  8133.                                                                                 
  8134. address TSO "ALLOC FI(GOPHERRC) DA("gopherrc") OLD REU"                         
  8135. if rc <> 0 then exit rc                                                         
  8136.                                                                                 
  8137. if new_gopherrc = 0 then do                                                     
  8138.  "EXECIO * DISKR GOPHERRC (FINIS STEM GOPHERRC.)"                               
  8139.  execiorc = rc                                                                  
  8140.  if execiorc <> 0 then do                                                       
  8141.   say "Error: Cannot read" gopherrc                                             
  8142.   address TSO "FREE FI(GOPHERRC)"                                               
  8143.   exit execiorc                                                                 
  8144.  end                                                                            
  8145.  if gopherrc.0 = 0 then new_gopherrc = 1                                        
  8146. end                                                                             
  8147.                                                                                 
  8148. if new_gopherrc then call initialize_gopherrc                                   
  8149.                                                                                 
  8150. address TSO "FREE FI(GOPHERRC)"                                                 
  8151.                                                                                 
  8152. collecting_initial = 0                                                          
  8153. do i = 1 to gopherrc.0                                                          
  8154.  gline = gopherrc.i                                                             
  8155.  if gline = "" then iterate                                                     
  8156.  if left(gline,1) = '#' then iterate                                            
  8157.  parse var gline ghead ":" gtext                                                
  8158.  ghead = translate(strip(ghead,"B"))                                            
  8159.  gtext = strip(gtext,"B")                                                       
  8160.  if collecting_initial then do                                                  
  8161.   parse var gline ghead "=" gtext                                               
  8162.   ghead = translate(strip(ghead,"B"))                                           
  8163.   gtext = strip(gtext,"B")                                                      
  8164.   select                                                                        
  8165.    when ghead = "TYPE" then initial_type = gtext                                
  8166.    when ghead = "NAME" then initial_name = gtext                                
  8167.    when ghead = "PATH" then initial_path = gtext                                
  8168.    when ghead = "HOST" then initial_host = gtext                                
  8169.    when ghead = "PORT" then initial_port = gtext                                
  8170.    when ghead = "END"  then do                                                  
  8171.     collecting_initial = 0                                                      
  8172.     initial = "*temp*"                                                          
  8173.    end                                                                          
  8174.    otherwise do                                                                 
  8175.     say "Error in "gopherrc": INITIAL: not terminated by END"                   
  8176.     say "Line where error was detected:"                                        
  8177.     say gline                                                                   
  8178.     exit 8                                                                      
  8179.    end                                                                          
  8180.   end                                                                           
  8181.  end                                                                            
  8182.  else select                                                                    
  8183.   when ghead = "LOCALMENU" then localmenu = gtext                               
  8184.   when ghead = "LOCALEXEC" then localexec = gtext                               
  8185.   when ghead = "INITIAL"   then do                                              
  8186.    if gtext = "" then collecting_initial = 1                                    
  8187.    else initial = gtext                                                         
  8188.   end                                                                           
  8189.   otherwise do                                                                  
  8190.    say "Warning, gopherrc field ignored:" ghead                                 
  8191.   end                                                                           
  8192.  end                                                                            
  8193. end                                                                             
  8194.                                                                                 
  8195. return                                                                          
  8196.                                                                                 
  8197. /*********************************************************************/         
  8198.                                                                                 
  8199. ggm_dialog:                                                                     
  8200.                                                                                 
  8201. vputvars = "GGHOST GGPORT GGPATH GGDESC"                                        
  8202.                                                                                 
  8203. if vputvars <> "" then do                                                       
  8204.  address ISPEXEC "VPUT ("vputvars") PROFILE"                                    
  8205.  if rc <> 0 then do; call ispf_error rc; exit rc; end                           
  8206. end                                                                             
  8207.                                                                                 
  8208. parm = ""                                                                       
  8209. if test  = "TEST"  then parm = parm "-t"                                        
  8210. if debug = "DEBUG" then parm = parm "-d"                                        
  8211. if local = "LOCAL" then parm = parm "-l"                                        
  8212. if gghost <> ""    then parm = parm "-q"                                        
  8213.                                                                                 
  8214. zerrmsg = ""                                                                    
  8215. zerrsm  = ""                                                                    
  8216. zerrlm  = ""                                                                    
  8217.                                                                                 
  8218. if ggmappl = "" then applsource = ""                                            
  8219. else applsource = "NEWAPPL("ggmappl") PASSLIB"                                  
  8220.                                                                                 
  8221. if ggmload = "" then selstring = "PGM("ggmlmod") PARM("parm")"                  
  8222. else selstring = "CMD(CALL '"ggmload"("ggmlmod")'" quote(parm)")"               
  8223.                                                                                 
  8224. address ISPEXEC "SELECT" applsource selstring                                   
  8225.                                                                                 
  8226. if rc <> 0 then say "Return code from" ggmlmod "program is" rc                  
  8227.                                                                                 
  8228. address ISPEXEC "VGET (ZERRSM ZERRLM)"                                          
  8229. if zerrsm <> "" then do                                                         
  8230.  say zerrmsg":" zerrsm                                                          
  8231.  say zerrlm                                                                     
  8232. end                                                                             
  8233.                                                                                 
  8234. return                                                                          
  8235.                                                                                 
  8236. /*********************************************************************/         
  8237.                                                                                 
  8238. libdef:                                                                         
  8239. if ggmpanel <> "" then do                                                       
  8240.  address ISPEXEC "LIBDEF ISPPLIB DATASET ID('"ggmpanel"')"                      
  8241.  if rc <> 0 then do; call ispf_error rc; exit rc; end                           
  8242. end                                                                             
  8243. if localexec <> "" then do                                                      
  8244.  address TSO "ALLOC FI(GGEXEC) SHR REU DA('"localexec"')"                       
  8245.  if rc <> 0 then exit rc                                                        
  8246. end                                                                             
  8247. libdeffed = 1                                                                   
  8248. return                                                                          
  8249.                                                                                 
  8250. /*********************************************************************/         
  8251.                                                                                 
  8252. unlibdef:                                                                       
  8253. if localexec <> "" then do                                                      
  8254.  address TSO "FREE FI(GGEXEC)"                                                  
  8255. end                                                                             
  8256. if ggmpanel <> "" then do                                                       
  8257.  address ISPEXEC "LIBDEF ISPPLIB DATASET"                                       
  8258.  if rc <> 0 then call ispf_error rc                                             
  8259. end                                                                             
  8260. libdeffed = 0                                                                   
  8261. return                                                                          
  8262.                                                                                 
  8263. /*********************************************************************/         
  8264.                                                                                 
  8265. initialize_gopherrc:                                                            
  8266.                                                                                 
  8267.  say "Initializing new GOPHERRC file..."                                        
  8268.  do i = sigl while sourceline(i) <> "_BEGIN_"                                   
  8269.  end                                                                            
  8270.  gx = 0                                                                         
  8271.  do i = i+1 by 1                                                                
  8272.   gline = sourceline(i)                                                         
  8273.   if gline = "_END_" then leave                                                 
  8274.   gpos = pos("ggmdefaulthost",gline)                                            
  8275.   if gpos > 0 then do                                                           
  8276.    gline = substr(gline,1,gpos-1) || ggmdefaulthost                             
  8277.   end                                                                           
  8278.   gx = gx + 1                                                                   
  8279.   gopherrc.gx = gline                                                           
  8280.  end                                                                            
  8281.  gopherrc.0 = gx                                                                
  8282.  "EXECIO * DISKW GOPHERRC (FINIS STEM GOPHERRC.)"                               
  8283.  say "New GOPHERRC file initialized."                                           
  8284.                                                                                 
  8285. return                                                                          
  8286.                                                                                 
  8287. /*                                                                              
  8288.                                                                                 
  8289. _BEGIN_                                                                         
  8290. #                                                                               
  8291. #                                                                               
  8292. # Default "gopherrc" file, created by the MVS Gopher client.                    
  8293. #                                                                               
  8294. # Uncomment desired fields by removing the initial "# " from them.              
  8295. #                                                                               
  8296. # Beware - the Gopher client may update this file with bookmarks.               
  8297. #          You can delete it at any time and it will be recreated               
  8298. #          from the default settings, but you'll lose your bookmarks.           
  8299. #                                                                               
  8300. ######################################################################          
  8301. #                                                                               
  8302. # If you want local (serverless) gopher access, then use the following          
  8303. # lines, specifying full qualified (no quotes) data set names:                  
  8304. #                                                                               
  8305. # localmenu: name_of_initial_gopher_menu                                        
  8306. # localexec: name_of_pds_of_rexx_execs                                          
  8307. #                                                                               
  8308. # Specifying localmenu: is equivalent to specifying an initial: section         
  8309. # with host set to "-" and path set to the value of localmenu.                  
  8310. #                                                                               
  8311. # You cannot use your own REXX execs, however, unless you specify               
  8312. # localexec: as above.  You don't need one to use the other, though.            
  8313. #                                                                               
  8314. ######################################################################          
  8315. #                                                                               
  8316. # The following is used by the Gopher client at startup to determine            
  8317. # how the initial menu will appear.                                             
  8318. #                                                                               
  8319. # You may want to change the host to the one appropriate for your site.         
  8320. #                                                                               
  8321. initial:                                                                        
  8322. #                                                                               
  8323. Type=DIRECTORY                                                                  
  8324. Name=Primary (Root) Gopher Menu                                                 
  8325. Path=                                                                           
  8326. Host=ggmdefaulthost                                                             
  8327. Port=70                                                                         
  8328. End                                                                             
  8329. #                                                                               
  8330. # Alternatively, if you want your own private Gopher data:                      
  8331. #                                                                               
  8332. # initial:                                                                      
  8333. #                                                                               
  8334. # Type=0                                                                        
  8335. # Name=My Own Private Gopherhole                                                
  8336. # Path=userid.GOPHER.MENU                                                       
  8337. # Host=-                                                                        
  8338. # End                                                                           
  8339. #                                                                               
  8340. # In which case you should create a data set called userid.GOPHER.MENU          
  8341. # (or whatever name you choose that appears in the "Path=" line above)          
  8342. # that looks like this.  (NOT in the gopherrc file!)                            
  8343. #                                                                               
  8344. #                                                                               
  8345. # gopher_menu                                                                   
  8346. #                                                                               
  8347. # TYPE=DIRECTORY                                                                
  8348. # NAME=Public GOPHER Server at ggmdefaulthost                                   
  8349. # PATH=                                                                         
  8350. # HOST=ggmdefaulthost                                                           
  8351. # END                                                                           
  8352. #                                                                               
  8353. # TYPE=DIRECTORY                                                                
  8354. # NAME=Private GOPHER                                                           
  8355. # PATH=userid.ANOTHER.GOPHER.MENU                                               
  8356. # HOST=-                                                                        
  8357. # END                                                                           
  8358. #                                                                               
  8359. # and then you need yet another menu, similar in format to this one,            
  8360. # in userid.ANOTHER.GOPHER.MENU.  Get the idea?                                 
  8361. #                                                                               
  8362. ######################################################################          
  8363. #                                                                               
  8364. # These fields may be used by the Gopher client for local purposes              
  8365. # in the future.  Currently they are ignored.                                   
  8366. #                                                                               
  8367. # Printercmd: lpr                                                               
  8368. # Telnetcmd: telnet                                                             
  8369. # Mailcmd: mail                                                                 
  8370. # Playcmd: play -v 40 -                                                         
  8371. # TN3270cmd: tn3270                                                             
  8372. # MIMEcmd: metamail -p                                                          
  8373. #                                                                               
  8374. ######################################################################          
  8375. _END_                                                                           
  8376.                                                                                 
  8377. */                                                                              
  8378.                                                                                 
  8379. /*********************************************************************/         
  8380.                                                                                 
  8381. check_for_other_socket_app:                                                     
  8382.                                                                                 
  8383.  if local = "LOCAL" then return                                                 
  8384.                                                                                 
  8385.  call nnmfiucv      /* FIND IUCVMULT in another PIE MultiTSO session */         
  8386.                                                                                 
  8387.  if result = 0 then return                                                      
  8388.                                                                                 
  8389.  say,                                                                           
  8390.  "A TCP/IP socket application appears active in another PIE session."           
  8391.  if force = "FORCE" then do                                                     
  8392.   say "Proceeding anyhow, because you said FORCE."                              
  8393.   return                                                                        
  8394.  end                                                                            
  8395.  say "To proceed at this point would be potentially disastrous."                
  8396.  say "If you want to use GOPHER anyway, use one of these operands:"             
  8397.  say "  FORCE  -  if I'm mistaken and it's really safe to make a"               
  8398.  say "            TCP/IP connection."                                           
  8399.  say "  LOCAL  -  if you just want local (serverless) access."                  
  8400.  say "Terminating."                                                             
  8401.                                                                                 
  8402. exit 16                                                                         
  8403.                                                                                 
  8404. /*********************************************************************/         
  8405.                                                                                 
  8406. ispf_error: parse arg ispfrc                                                    
  8407.                                                                                 
  8408. say "GOPHER: ISPF dialog service error detected on line" sigl                   
  8409. say sourceline(sigl)                                                            
  8410. say                                                                             
  8411. say zerrmsg":" zerrsm                                                           
  8412. say zerrlm                                                                      
  8413. say                                                                             
  8414.                                                                                 
  8415. return ispfrc                                                                   
  8416.                                                                                 
  8417. /*********************************************************************/         
  8418.                                                                                 
  8419. /*                                                                              
  8420.  * The following function starts ISPF from READY mode.                          
  8421.  * Beware:  splitting the screen starts up an identical copy of the             
  8422.  *          application, which may not be desirable.                            
  8423.  */                                                                             
  8424.                                                                                 
  8425. startispf: parse arg startappl, startcmd                                        
  8426. if startappl = "" then,                                                         
  8427.  "ISPSTART CMD("startcmd")"                                                     
  8428. else,                                                                           
  8429.  "ISPSTART NEWAPPL("startappl") CMD("startcmd")"                                
  8430. return                                                                          
  8431.                                                                                 
  8432. /* The following function implements Big Brother mode. */                       
  8433.                                                                                 
  8434. let_me_know:                                                                    
  8435. if gophermeister = "" | gophermeister = userid() then return                    
  8436. parse source . . execname . execds .                                            
  8437. call outtrap "X."                                                               
  8438. address TSO,                                                                    
  8439.  "SEND" quote(execds"("execname")" date("U") time()" "),                        
  8440.         "U("gophermeister") LOGON"                                              
  8441. call outtrap "OFF"                                                              
  8442. return                                                                          
  8443.                                                                                 
  8444. /* The following function enquotes a string. */                                 
  8445.                                                                                 
  8446. quote: parse arg string                                                         
  8447. ix = 1                                                                          
  8448. do forever                                                                      
  8449.  ix = pos("'",string,ix)                                                        
  8450.  if ix = 0 then return "'"string"'"                                             
  8451.  string = insert("'",string,ix)                                                 
  8452.  ix=ix+2                                                                        
  8453. end                                                                             
  8454.                                                                                 
  8455. ./   ADD NAME=NNMFIUCV,SSI=01000017                                             
  8456. /* REXX.  This exec scans the job pack queues for IUCVMULT and returns          
  8457.  * with an error code if IUCVMULT is already loaded under a                     
  8458.  * different TCB. This can only happen under PIE MultiTSO or a                  
  8459.  * similar product that makes multiple job step TCB's.                          
  8460.  */                                                                             
  8461.                                                                                 
  8462. trace off                                                                       
  8463. signal on novalue                                                               
  8464.                                                                                 
  8465. search_name = "IUCVMULT"                                                        
  8466. count = 0                                                                       
  8467. foundtcb. = ""                                                                  
  8468. current_tcb  = getword24("21C")                                                 
  8469. current_job_step_tcb = getword24(current_tcb,"7C")                              
  8470. current_ascb = getword24("224")                                                 
  8471. current_asxb = getword31(current_ascb,"6C")                                     
  8472. first_tcb    = getword24(current_asxb,"4")                                      
  8473. tcb = first_tcb                                                                 
  8474. motherflag = 0                                                                  
  8475. do forever                                                                      
  8476.  if motherflag = 0 then do                                                      
  8477.   call process                                                                  
  8478.   daughter_tcb = getword24(tcb,"88")                                            
  8479.   if daughter_tcb \= "00000000" then do                                         
  8480.    tcb = daughter_tcb                                                           
  8481.    iterate                                                                      
  8482.   end                                                                           
  8483.  end                                                                            
  8484.  motherflag = 0                                                                 
  8485.  sister_tcb = getword24(tcb, "80")                                              
  8486.  if sister_tcb \= "00000000" then do                                            
  8487.   tcb = sister_tcb                                                              
  8488.   iterate                                                                       
  8489.  end                                                                            
  8490.  mother_tcb = getword24(tcb, "84")                                              
  8491.  if mother_tcb \= "00000000" then do                                            
  8492.   tcb = mother_tcb                                                              
  8493.   motherflag = 1                                                                
  8494.   iterate                                                                       
  8495.  end                                                                            
  8496.  leave                                                                          
  8497. end                                                                             
  8498.                                                                                 
  8499. if count = 0 then return 0                                                      
  8500. problem = 0                                                                     
  8501. do i = 1 to count                                                               
  8502.  if foundtcb.i = current_job_step_tcb then do                                   
  8503.   /*                                                                            
  8504.   say search_name "is already loaded under current TCB at "foundtcb.i"."        
  8505.   */                                                                            
  8506.  end                                                                            
  8507.  else do                                                                        
  8508.   /*                                                                            
  8509.   say search_name "is loaded under different TCB at "foundtcb.i"."              
  8510.   */                                                                            
  8511.   problem = 1                                                                   
  8512.  end                                                                            
  8513. end                                                                             
  8514.                                                                                 
  8515. if problem = 1 then return 1                                                    
  8516.                                                                                 
  8517. else return 0                                                                   
  8518.                                                                                 
  8519. process:                                                                        
  8520.                                                                                 
  8521.  jpq = getword31(tcb,"2C")                                                      
  8522.  cde = jpq                                                                      
  8523.  do while cde \= "00000000"                                                     
  8524.   cde_contents = storage(cde,32)                                                
  8525.   cde_name = substr(cde_contents,9,8)                                           
  8526.   cde_epa  = substr(cde_contents,9,8)                                           
  8527.   if search_name = cde_name then do                                             
  8528.    count = count + 1                                                            
  8529.    foundtcb.count = tcb                                                         
  8530.   end                                                                           
  8531.   cde = getword31(cde,"0")                                                      
  8532.  end                                                                            
  8533.                                                                                 
  8534. return                                                                          
  8535.                                                                                 
  8536. getword31: parse arg addr, offset                                               
  8537. temp1 = x2d(addr)                                                               
  8538. if offset = "" then temp2 = 0                                                   
  8539. else temp2 = x2d(offset)                                                        
  8540. return c2x(storage(d2x(temp1+temp2),4))                                         
  8541.                                                                                 
  8542. getword24: parse arg addr, offset                                               
  8543. temp1 = x2d(addr)                                                               
  8544. if offset = "" then temp2 = 0                                                   
  8545. else temp2 = x2d(offset)                                                        
  8546. return "00"c2x(storage(d2x(temp1+temp2+1),3))                                   
  8547.                                                                                 
  8548. ./ ENDUP                                                                        
  8549. ?!                                                                              
  8550. //H        EXEC GGLOAD,TRK1='4',TO='H'                                          
  8551. //SYSIN    DD DATA,DLM='?!'                                                     
  8552. ./   ADD NAME=GG,SSI=01330001                                                   
  8553.                                                                                 
  8554.  /********************************************************************/         
  8555.  /*                                                                  */         
  8556.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  8557.  /*                                                                  */         
  8558.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  8559.  /*                                                                  */         
  8560.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  8561.  /* including the implied warranties of merchantability and fitness, */         
  8562.  /* are expressly denied.                                            */         
  8563.  /*                                                                  */         
  8564.  /* Provided this copyright notice is included, this software may    */         
  8565.  /* be freely distributed and not offered for sale.                  */         
  8566.  /*                                                                  */         
  8567.  /* Changes or modifications may be made and used only by the maker  */         
  8568.  /* of same, and not further distributed.  Such modifications should */         
  8569.  /* be mailed to the author for consideration for addition to the    */         
  8570.  /* software and incorporation in subsequent releases.               */         
  8571.  /*                                                                  */         
  8572.  /********************************************************************/         
  8573.                                                                                 
  8574. /* --------------------- "gg.h" include member --------------------- */         
  8575.                                                                                 
  8576. #pragma linkage(GGMbrifr,FORTRAN)                                               
  8577. #pragma linkage(GGMbrifc,FORTRAN)                                               
  8578. #pragma linkage(ispexec,OS)                                                     
  8579. #pragma linkage(isplink,OS)                                                     
  8580. #pragma linkage(ikjeff18,OS)                                                    
  8581.                                                                                 
  8582. /****** Installation-customized defines. *****************************/         
  8583.                                                                                 
  8584. #include "gguser.h"                                                             
  8585.                                                                                 
  8586. #ifndef  C370V1                                                                 
  8587. #ifndef  C370V2                                                                 
  8588. #ifndef  SASC                                                                   
  8589.  install_error_neither_C370V1_C370V2_nor_SASC_was_defined;                      
  8590. #endif                                                                          
  8591. #endif                                                                          
  8592. #endif                                                                          
  8593.                                                                                 
  8594. #ifndef  TCPIPV1                                                                
  8595. #ifndef  TCPIPV2                                                                
  8596.  install_error_neither_TCPIPV1_nor_TCPIPV2_was_defined;                         
  8597. #endif                                                                          
  8598. #endif                                                                          
  8599.                                                                                 
  8600. #define  MVS                                                                    
  8601.                                                                                 
  8602. /****** Clean up compiler warnings BEFORE time.h gets 'em ************/         
  8603.                                                                                 
  8604. #ifndef  SASC                                                                   
  8605. #define  localtime            LOCALTIM                                          
  8606. #endif                                                                          
  8607.                                                                                 
  8608. /****** Include all header files that are necessary. *****************/         
  8609.                                                                                 
  8610. #include <manifest.h>                                                           
  8611. #include <sys/types.h>                                                          
  8612. #include <sys/socket.h>                                                         
  8613. #include <netdb.h>                                                              
  8614. #include <netinet/in.h>                                                         
  8615. #include <sys/uio.h>                                                            
  8616. #include <sys/ioctl.h>                                                          
  8617. #include <tcperrno.h>                                                           
  8618. #include <ctype.h>                                                              
  8619. #include <errno.h>                                                              
  8620. #include <fcntl.h>                                                              
  8621. #include <limits.h>                                                             
  8622. #include <setjmp.h>                                                             
  8623. #include <stdio.h>                                                              
  8624. #include <stdarg.h>                                                             
  8625. #include <stdlib.h>                                                             
  8626. #include <string.h>                                                             
  8627. #include <stddef.h>                                                             
  8628. #include <time.h>                                                               
  8629. /*                                                                              
  8630. #include <signal.h>                                                             
  8631. */                                                                              
  8632.                                                                                 
  8633. #ifndef  SASC                                                                   
  8634. #include <ctest.h>                                                              
  8635. #endif                                                                          
  8636.                                                                                 
  8637. #ifdef   SASC                                                                   
  8638. #include "ggsasc.h"                                                             
  8639. #endif                                                                          
  8640.                                                                                 
  8641. #undef ENOMEM                                                                   
  8642.                                                                                 
  8643. #include <mtf.h>                                                                
  8644.                                                                                 
  8645. /****** Version-dependent stuff **************************************/         
  8646.                                                                                 
  8647. #ifdef   C370V1                                                                 
  8648. #undef   FETCH                                                                  
  8649. #endif                                                                          
  8650.                                                                                 
  8651. #ifdef   C370V2                                                                 
  8652. #define  FETCH                                                                  
  8653. #endif                                                                          
  8654.                                                                                 
  8655. #ifdef   TCPIPV1                                                                
  8656. #define  TCP_DEBUG            tcp_debug                                         
  8657. #endif                                                                          
  8658.                                                                                 
  8659. #ifdef   TCPIPV2                                                                
  8660. #define  TCP_DEBUG            sock_debug                                        
  8661. #endif                                                                          
  8662.                                                                                 
  8663. #ifdef   DEBUG                                                                  
  8664. #define  TCP_DEBUG_ON         TCP_DEBUG(1)                                      
  8665. #define  TCP_DEBUG_OFF        TCP_DEBUG(0)                                      
  8666. #else                                                                           
  8667. #define  TCP_DEBUG_ON         /* */                                             
  8668. #define  TCP_DEBUG_OFF        /* */                                             
  8669. #endif                                                                          
  8670.                                                                                 
  8671. /****** Preprocessor bookkeeping *************************************/         
  8672.                                                                                 
  8673. #define  Bool                 char                                              
  8674. #define  Fool                 unsigned int /* for function arguments */         
  8675.                                                                                 
  8676. #define  COMMANDSIZE          12                                                
  8677.                                                                                 
  8678. #define  GOPHER_FILE          '0'                                               
  8679. #define  GOPHER_DIRECTORY     '1'                                               
  8680. #define  GOPHER_CSO           '2'                                               
  8681. #define  GOPHER_ERROR         '3'                                               
  8682. #define  GOPHER_MAC_BINHEX    '4'                                               
  8683. #define  GOPHER_DOS_BINARCH   '5'                                               
  8684. #define  GOPHER_UUENCODE      '6'                                               
  8685. #define  GOPHER_WAIS          '7'                                               
  8686. #define  GOPHER_TELNET        '8'                                               
  8687. #define  GOPHER_BINARY        '9'                                               
  8688. #define  GOPHER_REDUNDANT     '+'                                               
  8689. #define  GOPHER_WHOIS         'w'                                               
  8690.                                                                                 
  8691. #define  READ_BYTES           1024                                              
  8692. #define  SERVER_BUF_MSGSIZE   1024                                              
  8693. #define  CLIENT_BUF_MSGSIZE   1024                                              
  8694. #define  TEXT_BYTES           1024                                              
  8695. #define  INTERNET_SIZE        256                                               
  8696. #define  RBUFSIZE             256                                               
  8697. #define  OUTBUFSIZE           1024                                              
  8698.                                                                                 
  8699. #define  GOPHER_PORT_NUMBER   70                                                
  8700. #define  GOPHER_HOST_LENGTH   MAXHOSTNAMELEN                                    
  8701. #define  GOPHER_PATH_LENGTH   512                                               
  8702. #define  GOPHER_DESC_LENGTH   256                                               
  8703.                                                                                 
  8704. #define  SOCKET_GETCHAR_ERROR (-1)                                              
  8705. #define  SOCKET_NO_MORE       (-2)                                              
  8706. #define  SOCKET_READ_NOTHING  (-3)                                              
  8707.                                                                                 
  8708. #define  NO_VALUE             (-1)                                              
  8709.                                                                                 
  8710. #define  Rstruc               register struct                                   
  8711.                                                                                 
  8712. #define  EQUAL                !strcmp                                           
  8713. #define  UNEQUAL              strcmp                                            
  8714.                                                                                 
  8715. #define  CARRIAGE_RETURN      ('\r')                                            
  8716.                                                                                 
  8717. #ifdef   MVS                                                                    
  8718. #ifdef   I370                                                                   
  8719. #define  LINE_FEED            (0x15)                                            
  8720. #else                                                                           
  8721. #define  LINE_FEED            (0x25)                                            
  8722. #endif                                                                          
  8723. #else                                                                           
  8724. #define  LINE_FEED            (0x0a)                                            
  8725. #endif                                                                          
  8726.                                                                                 
  8727. #ifdef   MVS                                                                    
  8728. #ifndef  I370                                                                   
  8729. #define  etoa(x)              ebcdictoascii[x]                                  
  8730. #define  atoe(x)              asciitoebcdic[x]                                  
  8731. #define  ebcdictoascii        ebcdicto                                          
  8732. #define  asciitoebcdic        asciitoe                                          
  8733. #else                                                                           
  8734. #define  etoa                 htoncs                                            
  8735. #define  atoe                 ntohcs                                            
  8736. #endif                                                                          
  8737. #endif                                                                          
  8738.                                                                                 
  8739. #ifdef   FETCH                                                                  
  8740. #define  ISPLINK              (gp->isplink_pointer)                             
  8741. #define  ISPEXEC              (gp->ispexec_pointer)                             
  8742. #else                                                                           
  8743. #define  ISPLINK              isplink                                           
  8744. #define  ISPEXEC              ispexec                                           
  8745. #endif                                                                          
  8746.                                                                                 
  8747. #define  DATAOUT_LOW          0x01                                              
  8748. #define  DATAOUT_HIGH         0x02                                              
  8749. #define  DATAIN_LOW           0x03                                              
  8750. #define  DATAIN_HIGH          0x04                                              
  8751. #define  DATAOUT_BLUE         DATAOUT_LOW                                       
  8752. #define  DATAOUT_GREEN        0x05                                              
  8753. #define  DATAOUT_PINK         0x06                                              
  8754. #define  DATAOUT_RED          0x07                                              
  8755. #define  DATAOUT_TURQ         0x08                                              
  8756. #define  DATAOUT_WHITE        DATAOUT_HIGH                                      
  8757. #define  DATAOUT_YELLOW       0x09                                              
  8758. #define  DATAIN_BLUE          0x0a                                              
  8759. #define  DATAIN_GREEN         DATAIN_LOW                                        
  8760. #define  DATAIN_PINK          0x0b                                              
  8761. #define  DATAIN_RED           DATAIN_HIGH                                       
  8762. #define  DATAIN_TURQ          0x0c                                              
  8763. #define  DATAIN_WHITE         0x0d                                              
  8764. #define  DATAIN_YELLOW        0x0e                                              
  8765.                                                                                 
  8766. #define  S99VRBAL  0x01             /* ALLOCATION                    */         
  8767. #define  S99VRBUN  0x02             /* UNALLOCATION                  */         
  8768. #define  S99VRBCC  0x03             /* CONCATENATION                 */         
  8769. #define  S99VRBDC  0x04             /* DECONCATENATION               */         
  8770. #define  S99VRBRI  0x05             /* REMOVE IN-USE                 */         
  8771. #define  S99VRBDN  0x06             /* DDNAME ALLOCATION             */         
  8772. #define  S99VRBIN  0x07             /* INFORMATION RETRIEVAL         */         
  8773. #define  S99NOCNV  0x40             /* ALLOC FUNCTION-DO NOT USE AN  */         
  8774.                                     /* EXISTING ALLOCATION TO SATISFY*/         
  8775.                                     /* THE REQUEST                   */         
  8776. #define  DALDDNAM   0x0001          /* DDNAME                        */         
  8777. #define  DALDSNAM   0x0002          /* DSNAME                        */         
  8778. #define  DALMEMBR   0x0003          /* MEMBER NAME                   */         
  8779. #define  DALSTATS   0x0004          /* DATA SET STATUS               */         
  8780. #define  DALNDISP   0x0005          /* DATA SET DISPOSITION          */         
  8781. #define  DALBLKLN   0x0009          /* BLOCK LENGTH                  */         
  8782. #define  DALPRIME   0x000a          /* PRIMARY SPACE ALLOCATION      */         
  8783. #define  DALSECND   0x000b          /* SECONDARY SPACE ALLOCATION    */         
  8784. #define  DALDIR     0x000c          /* DIRECTORY BLOCK ALLOCATION    */         
  8785. #define  DALBLKSZ   0x0030          /* DCB BLOCKSIZE                 */         
  8786. #define  DALDSORG   0x003c          /* DATA SET ORGANIZATION         */         
  8787. #define  DALLRECL   0x0042          /* DCB LOGICAL RECORD LENGTH     */         
  8788. #define  DALRECFM   0x0049          /* DCB RECORD FORMAT             */         
  8789. #define  DALPERMA   0x0052          /* PERMANENTLY ALLOCATED ATTRIB  */         
  8790. #define  DALRTDDN   0x0055          /* RETURN DDNAME                 */         
  8791. #define  DALRTDSN   0x0056          /* RETURN DSNAME                 */         
  8792. #define  DALRTORG   0x0057          /* RETURN D.S. ORGANIZATION      */         
  8793. #define  DUNDDNAM   0x0001          /* DDNAME                        */         
  8794. #define  DUNDSNAM   0x0002          /* DSNAME                        */         
  8795. #define  DUNUNALC   0x0007          /* UNALLOC OPTION                */         
  8796.                                                                                 
  8797. #define  SHR        0x08                                                        
  8798. #define  NEW        0x04                                                        
  8799. #define  MOD        0x02                                                        
  8800. #define  OLD        0x01                                                        
  8801. #define  KEEP       0x08                                                        
  8802. #define  DELETE     0x04                                                        
  8803. #define  CATLG      0x02                                                        
  8804. #define  UNCATLG    0x01                                                        
  8805. #define  RECFM_F    0x80                                                        
  8806. #define  RECFM_V    0x40                                                        
  8807. #define  RECFM_U    0xc0                                                        
  8808. #define  RECFM_D    0x20                                                        
  8809. #define  RECFM_T    0x20                                                        
  8810. #define  RECFM_B    0x10                                                        
  8811. #define  RECFM_S    0x08                                                        
  8812. #define  RECFM_A    0x04                                                        
  8813. #define  RECFM_M    0x02                                                        
  8814. #define  RECFM_FB   (RECFM_F | RECFM_B)                                         
  8815. #define  RECFM_VB   (RECFM_V | RECFM_B)                                         
  8816. #define  DSORG_PS   0x4000                                                      
  8817. #define  DSORG_PO   0x0200                                                      
  8818.                                                                                 
  8819.                                                                                 
  8820. /****** Data and structure definitions. ******************************/         
  8821.                                                                                 
  8822. typedef struct _textunit     TEXTUNIT;                                          
  8823. typedef unsigned int         IPADDRESS;                                         
  8824. typedef char                 gophertype;                                        
  8825.                                                                                 
  8826. enum socket_retval  {                                                           
  8827.                      SERVER_READ_OK,                                            
  8828.                      SERVER_READ_ERROR,                                         
  8829.                      SERVER_BUFFER_ERROR,                                       
  8830.                      SERVER_NO_MORE,                                            
  8831.                      SERVER_READ_NOTHING                                        
  8832.                     };                                                          
  8833.                                                                                 
  8834. enum data_set_type  {                                                           
  8835.                      PDS,                                                       
  8836.                      SEQ,                                                       
  8837.                      UNK                                                        
  8838.                     };                                                          
  8839.                                                                                 
  8840. enum user_option    {                                                           
  8841.                      OPTION_ALL,                                                
  8842.                      OPTION_VIEW,                                               
  8843.                      OPTION_OTHER                                               
  8844.                     };                                                          
  8845.                                                                                 
  8846. struct textline    {                                                            
  8847.                     struct textline    *next;                                   
  8848.                     short               text_length;                            
  8849.                     short               tab_expanded_text_length;               
  8850.                     char               *tab_expanded_text;                      
  8851.                     char                text[1];  /* dummy */                   
  8852.                    };                                                           
  8853.                                                                                 
  8854. struct texthdr     {                                                            
  8855.                     int                   text_line_count;                      
  8856.                     struct textline      *text_body_line;                       
  8857.                     short                 text_max_length;                      
  8858.                     short                 text_max_tab_expanded_length;         
  8859.                     struct textline      *first_text_line;                      
  8860.                     struct textline      *current_text_line;                    
  8861.                     struct textline      *last_text_line;                       
  8862.                    };                                                           
  8863.                                                                                 
  8864. struct cmddesc   {                                                              
  8865.                   char    command_name[COMMANDSIZE];                            
  8866.                   Bool    (*command_processor)();                               
  8867.                  };                                                             
  8868.                                                                                 
  8869. struct seldesc   {                                                              
  8870.                   char    selection_code;                                       
  8871.                   Bool    (*selection_processor)();                             
  8872.                  };                                                             
  8873.                                                                                 
  8874. struct tabledesc {                                                              
  8875.                   char   *command_variable;                                     
  8876.         struct cmddesc   *first_cmddesc;                                        
  8877.         struct seldesc   *first_seldesc;                                        
  8878.                  };                                                             
  8879.                                                                                 
  8880. struct _textunit {                                                              
  8881.                   unsigned short         key;                                   
  8882.                   unsigned short         num;                                   
  8883.                   struct {                                                      
  8884.                           unsigned short len;                                   
  8885.                           char           prm[80];                               
  8886.                          }               ent;                                   
  8887.                  };                                                             
  8888.                                                                                 
  8889. struct extraction {                                                             
  8890.                    int                   from_number;                           
  8891.                    int                   to_number;                             
  8892.                    int                   count;                                 
  8893.                    enum data_set_type    mode;                                  
  8894.                    Bool                  appending;                             
  8895.                    Bool                  blanking;                              
  8896.                    Bool                  tab_expanding;                         
  8897.                    char                  panelname     [9];                     
  8898.                    char                  dsname       [65];                     
  8899.                    char                  separator    [81];                     
  8900.                    char                  member_prefix [9];                     
  8901.                    char                  ddname        [9];                     
  8902.                   };                                                            
  8903.                                                                                 
  8904. struct gopherinfo {                                                             
  8905.                    gophertype            type;                                  
  8906.                    int                   port;                                  
  8907.                    struct texthdr        thdr;                                  
  8908.                    char                  path [GOPHER_PATH_LENGTH+1];           
  8909.                    char                  host [GOPHER_HOST_LENGTH+1];           
  8910.                    char                  desc [GOPHER_DESC_LENGTH+1];           
  8911.                   };                                                            
  8912.                                                                                 
  8913. struct recvstruct {                                                             
  8914.     int             sockfd;   /* socket descriptor for socket call */           
  8915.     int             outlen;                                                     
  8916.     FILE           *outfp;    /* used by local (non-socket) interface*/         
  8917.     char           *fileptr;                                                    
  8918.     char           *wargptr;                                                    
  8919.     FILE           *readfile;                 /* declare the file... */         
  8920.     struct hostent  clienthostent;                                              
  8921.     char            myname  [MAXHOSTNAMELEN+1];                                 
  8922.     char            hostname[MAXHOSTNAMELEN+1];  /* client host name */         
  8923.     char            hosttest[MAXHOSTNAMELEN+1];  /* client host name */         
  8924.     char            buffer  [RBUFSIZE]; /* client's character string */         
  8925.     char            dsname  [RBUFSIZE];                                         
  8926.     char            sockbuf [OUTBUFSIZE];    /* socket output buffer */         
  8927.    };                                                                           
  8928.                                                                                 
  8929. struct menuitem {                                                               
  8930.     char          type;                  /* type of record to send   */         
  8931.     char          desc     [GOPHER_DESC_LENGTH+1];                              
  8932.     char          select   [GOPHER_PATH_LENGTH+1];                              
  8933.     char          hostname [GOPHER_HOST_LENGTH+1];                              
  8934.     int           port;                  /* host port to connect to  */         
  8935.    };                                                                           
  8936.                                                                                 
  8937. struct ggcb {                                                                   
  8938.              char    *server_buf;                                               
  8939.              char    *client_buf;                                               
  8940.              char    *gopher_command;                                           
  8941.   struct recvstruct  *recvp;                                                    
  8942.              char    *extract_separator_line;                                   
  8943. #ifdef FETCH                                                                    
  8944.               int   (*isplink_pointer)();                                       
  8945.               int   (*ispexec_pointer)();                                       
  8946. #endif                                                                          
  8947.               int     ispfrc;                                                   
  8948.               int     socknum;                                                  
  8949.               int     g_bytes_returned;                                         
  8950.               int     g_buf_index;                                              
  8951.               int     brif_previous_recno;                                      
  8952.              FILE    *debug_file;                                               
  8953.              FILE    *extract_file;                                             
  8954.    struct texthdr    *brifp;                                                    
  8955.    struct texthdr     thdr;                                                     
  8956.    struct gopherinfo *ginfo;                                                    
  8957.              Bool     test_mode;                                                
  8958.              Bool     debug_mode;                                               
  8959.              Bool     quit;                                                     
  8960.              Bool     time_to_go_home;                                          
  8961.              Bool     server_has_something_pending;                             
  8962.              Bool     server_finished_replying;                                 
  8963.              Bool     sending_text;                                             
  8964.              Bool     receiving_text;                                           
  8965.              Bool     local_mode;                                               
  8966.              Bool     dont_read;                                                
  8967.              Bool     connected_to_server;                                      
  8968.              Bool     connection_broken;                                        
  8969.              Bool     closing_connection;                                       
  8970.              Bool     reconnect_in_progress;                                    
  8971.              Bool     extract_tab_expanding;                                    
  8972.              Bool     extract_appending;                                        
  8973.              Bool     extract_blank_before_separator;                           
  8974.              Bool     extract_write_error;                                      
  8975.              Bool     extract_close_error;                                      
  8976.              Bool     warn_overwrite;                                           
  8977.              Bool     warn_append;                                              
  8978.              Bool     setmsg;                                                   
  8979.              Bool     autoscroll;                                               
  8980.         IPADDRESS     client_ip_address;                                        
  8981.         IPADDRESS     server_ip_address;                                        
  8982.              char     ggserver            [MAXHOSTNAMELEN+1];                   
  8983.              char     ggclient            [MAXHOSTNAMELEN+1];                   
  8984.              char     client_hostname     [MAXHOSTNAMELEN+1];                   
  8985.              char     client_ip_addrstr   [16];                                 
  8986.              char     server_hostname     [MAXHOSTNAMELEN+1];                   
  8987.              char     server_ip_addrstr   [16];                                 
  8988.              char     g_buf               [READ_BYTES];                         
  8989.             };                                                                  
  8990.                                                                                 
  8991. #ifdef MVS                                                                      
  8992. #ifndef I370                                                                    
  8993. extern char                 ebcdictoascii[];                                    
  8994. extern char                 asciitoebcdic[];                                    
  8995. #endif                                                                          
  8996. #endif                                                                          
  8997.                                                                                 
  8998. #ifndef FETCH                                                                   
  8999. extern int                  isplink();                                          
  9000. extern int                  ispexec();                                          
  9001. #endif                                                                          
  9002.                                                                                 
  9003. #define  NOTIFY_MSG   1                                                         
  9004. #define  WARNING_MSG  2                                                         
  9005. #define  CRITICAL_MSG 3                                                         
  9006.                                                                                 
  9007. #define  WARN1(X)           GGMpmsg(gp,NOTIFY_MSG,NULL,X)                       
  9008. #define  WARN2(X,Y)         GGMpmsg(gp,NOTIFY_MSG,NULL,X,Y)                     
  9009. #define  WARN3(X,Y,Z)       GGMpmsg(gp,NOTIFY_MSG,NULL,X,Y,Z)                   
  9010. #define  WARN4(X,Y,Z,W)     GGMpmsg(gp,NOTIFY_MSG,NULL,X,Y,Z,W)                 
  9011. #define  ERR1(X)            GGMpmsg(gp,WARNING_MSG,NULL,X)                      
  9012. #define  ERR2(X,Y)          GGMpmsg(gp,WARNING_MSG,NULL,X,Y)                    
  9013. #define  ERR3(X,Y,Z)        GGMpmsg(gp,WARNING_MSG,NULL,X,Y,Z)                  
  9014. #define  ERR4(X,Y,Z,W)      GGMpmsg(gp,WARNING_MSG,NULL,X,Y,Z,W)                
  9015. #define  CRIT1(X)           GGMpmsg(gp,CRITICAL_MSG,NULL,X)                     
  9016. #define  CRIT2(X,Y)         GGMpmsg(gp,CRITICAL_MSG,NULL,X,Y)                   
  9017. #define  CRIT3(X,Y,Z)       GGMpmsg(gp,CRITICAL_MSG,NULL,X,Y,Z)                 
  9018.                                                                                 
  9019. #define  GETMAIN(Ptr,Typ,Siz,For) \                                             
  9020.          GGMgetm(gp,(char **)&(Ptr),(sizeof(Typ))*(Siz),For)                    
  9021.                                                                                 
  9022. #define  FREEMAIN(Ptr,For)    if (Ptr) {GGMfreem(gp,(char *)Ptr,For);}          
  9023.                                                                                 
  9024. #ifndef I370                                                                    
  9025.                                                                                 
  9026. #define  OPEN_TEXT_FILE_FOR_WRITE(F)  \                                         
  9027.          fopen((F),"w,recfm=vb,lrecl=259,blksize=6233")                         
  9028.                                                                                 
  9029. #define  OPEN_TEXT_FILE_FOR_APPEND(F)  \                                        
  9030.          fopen((F),"a,recfm=vb,lrecl=259,blksize=6233")                         
  9031.                                                                                 
  9032. #define  OPEN_TEXT_FILE_FOR_WRITE_OR_APPEND(F,B)  \                             
  9033.          fopen((F),(B) ? "a,recfm=vb,lrecl=259,blksize=6233"  \                 
  9034.                        : "w,recfm=vb,lrecl=259,blksize=6233")                   
  9035.                                                                                 
  9036. #else                                                                           
  9037.                                                                                 
  9038. #define  OPEN_TEXT_FILE_FOR_WRITE(F)  \                                         
  9039.          afopen((F),"w","seq","recfm=v,lrecl=255,blksize=6233")                 
  9040.                                                                                 
  9041. #define  OPEN_TEXT_FILE_FOR_APPEND(F)  \                                        
  9042.          afopen((F),"a","seq","recfm=v,lrecl=255,blksize=6233")                 
  9043.                                                                                 
  9044. #define  OPEN_TEXT_FILE_FOR_WRITE_OR_APPEND(F,B)  \                             
  9045.          afopen((F),(B)?"a":"w","seq","recfm=v,lrecl=255,blksize=6233")         
  9046.                                                                                 
  9047. #endif                                                                          
  9048.                                                                                 
  9049. #define ebdtoasc(C) {char *__cp;\                                               
  9050.                      for(__cp = C;*__cp;__cp++) *__cp = etoa(*__cp);}           
  9051.                                                                                 
  9052. #define asctoebd(C) {char *__cp;\                                               
  9053.                      for(__cp = C;*__cp;__cp++) *__cp = atoe(*__cp);}           
  9054.                                                                                 
  9055. #define uppercase_in_place(C) {char *__cp;\                                     
  9056.                      for(__cp=C;*__cp;__cp++) *__cp = toupper(*__cp);}          
  9057.                                                                                 
  9058. #define lowercase_in_place(C) {char *__cp;\                                     
  9059.                      for(__cp=C;*__cp;__cp++) *__cp = tolower(*__cp);}          
  9060.                                                                                 
  9061.                                                                                 
  9062. /****** Procedure and function declarations. *************************/         
  9063.                                                                                 
  9064. extern enum data_set_type  GGMalloc(char *, char *, enum data_set_type,         
  9065.                                                                   int);         
  9066. extern int                 GGMbrifr(char **, int *, int *, void *);             
  9067. extern int                 GGMbrifc(int *, void *);                             
  9068. extern void                GGMbtext(struct ggcb *, struct texthdr *,            
  9069.                                                                FILE *);         
  9070. extern void                GGMclrtx(struct ggcb *,struct gopherinfo *);         
  9071. extern Bool                GGMconn (struct ggcb *);                             
  9072. extern char               *GGMcopy (struct ggcb *, char *);                     
  9073. extern void                GGMdfail(int,__S99parms *);                          
  9074. extern Bool                GGMdir  (struct ggcb *,struct gopherinfo *,          
  9075.                                                                  Fool);         
  9076. extern void                GGMdisc (struct ggcb *);                             
  9077. extern int                 GGMdispl(struct ggcb *, char *);                     
  9078. extern void                GGMdump (struct ggcb *,char *, char *, int);         
  9079. extern void                GGMesrvr(struct ggcb *);                             
  9080. extern void                GGMfreem(struct ggcb *,char *,char *);               
  9081. extern FILE               *GGMgetds(struct ggcb *,struct extraction *);         
  9082. extern void                GGMgetm (struct ggcb *,char **,int,char *);          
  9083. extern Bool                GGMgofor(struct ggcb *,struct gopherinfo *,          
  9084.                                                                 Fool);          
  9085. extern Bool                GGMgsrvl(struct ggcb *, char **);                    
  9086. extern void                GGMierr (struct ggcb *);                             
  9087. extern int                 GGMiget (struct ggcb *, char *);                     
  9088. extern void                GGMimsg (struct ggcb *, char *);                     
  9089. extern Bool                GGMispf (struct ggcb *, char *);                     
  9090. extern Bool                GGMivget(struct ggcb *, char *, char *,int);         
  9091. extern Bool                GGMivput(struct ggcb *, char *, char *,int);         
  9092. extern void                GGMmtfer(int, char*);                                
  9093. extern struct textline    *GGMouttx(struct ggcb *, char *,                      
  9094.                                                   struct gopherinfo *);         
  9095. extern Bool                GGMouts (struct recvstruct *, char *);               
  9096. extern Bool                GGMproc (struct recvstruct *);                       
  9097. extern void                GGMrbfm (struct ggcb *);                             
  9098. extern void                GGMrperr(struct ggcb *);                             
  9099. extern Bool                GGMsockt(struct ggcb *);                             
  9100. extern void                GGMsopt (struct ggcb *,enum user_option);            
  9101. extern char               *GGMstrlc(char *, char *);                            
  9102. extern Bool                GGMtnet (struct ggcb *,struct gopherinfo *,          
  9103.                                                                  Fool);         
  9104. extern int                 GGMtso  (char *);                                    
  9105. extern char               *GGMtype (gophertype);                                
  9106. extern Bool                GGMunalc(char *);                                    
  9107. extern Bool                GGMvtx  (struct ggcb *,struct gopherinfo *,          
  9108.                                                                  Fool);         
  9109. extern Bool                GGMwais (struct ggcb *,struct gopherinfo *,          
  9110.                                                                  Fool);         
  9111. extern Bool                GGMwhois(struct ggcb *,struct gopherinfo *,          
  9112.                                                                  Fool);         
  9113. extern Bool                GGMxlist(struct ggcb *,char *);                      
  9114. extern Bool                GGMxtx  (struct ggcb *,struct gopherinfo *);         
  9115.                                                                                 
  9116. #ifndef SUPPRESS_V_DECLARATION                                                  
  9117. extern void                GGMpmsg (struct ggcb *,int,char *,char *,            
  9118.                                                                   ...);         
  9119. #endif                                                                          
  9120.                                                                                 
  9121. ./   ADD NAME=GGSASC,SSI=01000043                                               
  9122.                                                                                 
  9123.  /********************************************************************/         
  9124.  /*                                                                  */         
  9125.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  9126.  /*                                                                  */         
  9127.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  9128.  /*                                                                  */         
  9129.  /* SAS modifications due to Dale Ingold at SAS Institute, Inc.      */         
  9130.  /*                                                                  */         
  9131.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  9132.  /* including the implied warranties of merchantability and fitness, */         
  9133.  /* are expressly denied.                                            */         
  9134.  /*                                                                  */         
  9135.  /* Provided this copyright notice is included, this software may    */         
  9136.  /* be freely distributed and not offered for sale.                  */         
  9137.  /*                                                                  */         
  9138.  /* Changes or modifications may be made and used only by the maker  */         
  9139.  /* of same, and not further distributed.  Such modifications should */         
  9140.  /* be mailed to the author for consideration for addition to the    */         
  9141.  /* software and incorporation in subsequent releases.               */         
  9142.  /*                                                                  */         
  9143.  /********************************************************************/         
  9144.                                                                                 
  9145. /* ------------------- "ggsasc.h" include member ------------------- */         
  9146.                                                                                 
  9147. #ifdef SASC                                                                     
  9148.                                                                                 
  9149. #define I370                                                                    
  9150.                                                                                 
  9151. #include <dynam.h>                                                              
  9152.                                                                                 
  9153. #define FETCH                                                                   
  9154.                                                                                 
  9155.  __inline void (*fetch( const char *modname ))()                                
  9156.  {                                                                              
  9157.    void (*fpp)();                                                               
  9158.                                                                                 
  9159.    loadm( modname, &fpp );                                                      
  9160.    return( fpp );                                                               
  9161.  }                                                                              
  9162.                                                                                 
  9163.  __inline int (*release( void (*fpp)() ))                                       
  9164.  {                                                                              
  9165.    unloadm( fpp );                                                              
  9166.    return( 0 );                                                                 
  9167.  }                                                                              
  9168.                                                                                 
  9169.                                                                                 
  9170. #ifndef __SVC99                                                                 
  9171.                                                                                 
  9172.   #define __SVC99  1                                                            
  9173.                                                                                 
  9174.   #include <code.h>                                                             
  9175.                                                                                 
  9176.   struct __S99struc                                                             
  9177.     {                                                                           
  9178.       unsigned char   __S99RBLN;  /* length of request block..20      */        
  9179.       unsigned char   __S99VERB;  /* verb code                        */        
  9180.       unsigned short  __S99FLAG1; /* FLAGS1 field of SVC99 Req Block  */        
  9181.       unsigned short  __S99ERROR; /* error code field                 */        
  9182.       unsigned short  __S99INFO;  /* information reason code          */        
  9183.       void           *__S99TXTPP; /* address of text unit pointer list*/        
  9184.       int             __reserved; /* reserved..will always be 0       */        
  9185.       unsigned int    __S99FLAG2; /* FLAGS2 field..can only be filled */        
  9186.                                   /* in by APF authorized programs    */        
  9187.     };                                                                          
  9188.                                                                                 
  9189.   typedef struct __S99struc __S99parms;                                         
  9190.                                                                                 
  9191.   __inline int svc99(__S99parms* svc99parmlist)                                 
  9192.     { return( (_ldregs(R1, &svc99parmlist),                                     
  9193.                _code(0, 0x0a63),                                                
  9194.                _stregs(R15) ) );                                                
  9195.     }                                                                           
  9196.                                                                                 
  9197. #endif                                                                          
  9198.                                                                                 
  9199. #define FALSE 0                                                                 
  9200. #define TRUE  1                                                                 
  9201.                                                                                 
  9202. #include <lcio.h>                                                               
  9203.                                                                                 
  9204. #define  MAXHOSTNAMELEN     64                                                  
  9205.                                                                                 
  9206. #define  __ctest(X)  fprintf(stderr,\                                           
  9207.                      "GGMVS: CTEST is not supported by this compiler.")         
  9208.                                                                                 
  9209. #endif                                                                          
  9210.                                                                                 
  9211. ./   ADD NAME=GGUSER,SSI=01140048                                               
  9212.                                                                                 
  9213.  /********************************************************************/         
  9214.  /*                                                                  */         
  9215.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  9216.  /*                                                                  */         
  9217.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  9218.  /*                                                                  */         
  9219.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  9220.  /* including the implied warranties of merchantability and fitness, */         
  9221.  /* are expressly denied.                                            */         
  9222.  /*                                                                  */         
  9223.  /* Provided this copyright notice is included, this software may    */         
  9224.  /* be freely distributed and not offered for sale.                  */         
  9225.  /*                                                                  */         
  9226.  /* Changes or modifications may be made and used only by the maker  */         
  9227.  /* of same, and not further distributed.  Such modifications should */         
  9228.  /* be mailed to the author for consideration for addition to the    */         
  9229.  /* software and incorporation in subsequent releases.               */         
  9230.  /*                                                                  */         
  9231.  /********************************************************************/         
  9232.                                                                                 
  9233. /* ------------------- "gguser.h" include member ------------------- */         
  9234.                                                                                 
  9235. /* Include file for locally customized values. */                               
  9236.                                                                                 
  9237. /* Define levels of C/370 and TCP/IP.  This controls support for                
  9238.  * fetching of non-C load modules and socket error reporting.                   
  9239.  */                                                                             
  9240.                                                                                 
  9241. /* #define  C370V1    /* define this if C/370 Version 1 */                      
  9242.    #define  C370V2    /* define this if C/370 Version 2 or higher */            
  9243. /* #define  SASC      /* define this if SAS/C compiler */                       
  9244.                                                                                 
  9245. /* #define  TCPIPV1   /* define this if TCP/IP Version 1 */                     
  9246.    #define  TCPIPV2   /* define this if TCP/IP Version 2 or higher */           
  9247.                                                                                 
  9248. /* Define the following defaults for your installation. */                      
  9249. /* Use XTELNET if you like the CSOCK package from UCLA. */                      
  9250.                                                                                 
  9251.    #define  TELNET_COMMAND_NAME     "TELNET"                                    
  9252. /* #define  TELNET_COMMAND_NAME     "XTELNET" */                                
  9253.                                                                                 
  9254. /*                                                                              
  9255.  * Turn on for TCP-level debugging output (you probably don't want to           
  9256.  * unless your TCP/IP stuff is really broken and I can't help you).             
  9257.  */                                                                             
  9258.                                                                                 
  9259. /* #define DEBUG       */                                                       
  9260.    #undef  DEBUG                                                                
  9261.                                                                                 
  9262. /*                                                                              
  9263.  * Turn on for MTF-level debugging output.                                      
  9264.  */                                                                             
  9265.                                                                                 
  9266. /* #define DEBUGMTF    */                                                       
  9267.    #undef  DEBUGMTF                                                             
  9268.                                                                                 
  9269. /* Server and MTF stuff. */                                                     
  9270.                                                                                 
  9271. #define  MTF_TASKS           8                                                  
  9272. #define  TCP_QUEUE_LENGTH   20                                                  
  9273. #define  SERV_TCP_PORT      70                                                  
  9274. #define  CONNECT_TIME_OUT   60                                                  
  9275. #define  DEFAULT_DIRECTORY  "DD:GGGOPHER"                                       
  9276. #define  ACCESS_TABLE       "DD:GGACCESS"                                       
  9277. #define  MY_DOMAIN_SUFFIX   ".DRAPER.COM"                                       
  9278.                                                                                 
  9279. /* note: could get MY_DOMAIN_SUFFIX from TCPIP startup - what call? */          
  9280.                                                                                 
  9281. /* Client stuff. */                                                             
  9282.                                                                                 
  9283. #define  INITIAL_TYPE   GOPHER_DIRECTORY                                        
  9284. #define  INITIAL_PORT   GOPHER_PORT_NUMBER                                      
  9285. #define  INITIAL_PATH   ""                                                      
  9286. #define  INITIAL_HOST   "MVS.DRAPER.COM"                                        
  9287. #define  INITIAL_DESC   "Root"                                                  
  9288.                                                                                 
  9289. /* Server and client stuff. */                                                  
  9290.                                                                                 
  9291. #define  IDENT_HOST_FROB    "+"                                                 
  9292. #define  LOCAL_HOST_FROB    "-"                                                 
  9293.                                                                                 
  9294. /********************************************************************/          
  9295. /*  The following defines the module name for the MTF subtask.      */          
  9296. /********************************************************************/          
  9297.                                                                                 
  9298. #define GOPHER_PARALLEL_TASK "GGSTASK"                                          
  9299.                                                                                 
  9300. /********************************************************************/          
  9301. /*  following are "gopher" record types.   */                                   
  9302. /********************************************************************/          
  9303.                                                                                 
  9304. #define  GFILE    '0'                                                           
  9305. #define  MENU     '1'                                                           
  9306. #define  ERROR    '2'                                                           
  9307. #define  INDEX    '7'                                                           
  9308. #define  TELNET   '8'                                                           
  9309. #define  WHOIS    'w'                                                           
  9310.                                                                                 
  9311. /********************************************************************/          
  9312. /* following are MVS file type identifiers.  They must appear at the            
  9313.    beginning of the file they're identifying.                        */         
  9314. /********************************************************************/          
  9315.                                                                                 
  9316. #define  MENUIDENT    "GOPHER_MENU"                                             
  9317. #define  INDEXIDENT   "GOPHER_INDEX"                                            
  9318.                                                                                 
  9319. /********************************************************************/          
  9320. /*  following are tokens for menu GOPHER identifiers.    */                     
  9321. /********************************************************************/          
  9322.                                                                                 
  9323. #define  TOKTYPE      "TYPE"                                                    
  9324. #define  TYPETOK      0                                                         
  9325. #define  TOKNAME      "NAME"                                                    
  9326. #define  NAMETOK      1                                                         
  9327. #define  TOKPATH      "PATH"                                                    
  9328. #define  PATHTOK      2                                                         
  9329. #define  TOKHOST      "HOST"                                                    
  9330. #define  HOSTTOK      3                                                         
  9331. #define  TOKPORT      "PORT"                                                    
  9332. #define  PORTTOK      4                                                         
  9333. #define  TOKEND       "END"                                                     
  9334. #define  ENDTOK       5                                                         
  9335. #define  TOKCOMMENT   "*"                                                       
  9336. #define  COMMENTTOK   6                                                         
  9337.                                                                                 
  9338. #define  TOKDISPLAY   "DISPLAY"                                                 
  9339. #define  DISPLAYTOK   7                                                         
  9340. #define  TOKSELECT    "SELECTOR"                                                
  9341. #define  SELECTTOK    8                                                         
  9342.                                                                                 
  9343. /********************************************************************/          
  9344. /*  types of   "types" - operands of the TYPE keyword in directories.*/         
  9345. /********************************************************************/          
  9346.                                                                                 
  9347. #define  TYPEFILE    "FILE"                                                     
  9348. #define  TYPEMENU    "DIRECTORY"                                                
  9349. #define  TYPEINDEX   "INDEX"                                                    
  9350. #define  TYPETELNET  "TELNET"                                                   
  9351. #define  TYPEWHOIS   "WHOIS"                                                    
  9352.                                                                                 
  9353. /********************************************************************/          
  9354. /*  used by the REXX Interface                                      */          
  9355. /********************************************************************/          
  9356.                                                                                 
  9357.   /* Be sure to include all 8 bytes, including blanks, in below */              
  9358.                                                                                 
  9359. #define  REXX_EXEC_LIBRARY_DDNAME   "GGEXEC  "                                  
  9360. #define  REXX_EXEC_SUBCOM           "        "                                  
  9361.                                                                                 
  9362. ./ ENDUP                                                                        
  9363. ?!                                                                              
  9364. //PANELS   EXEC GGLOAD,TRK1='4',TO='PANELS'                                     
  9365. //SYSIN    DD DATA,DLM='?!'                                                     
  9366. ./   ADD NAME=GGM,SSI=01060053                                                  
  9367. )ATTR                                                                           
  9368. /*                                                                   /*         
  9369. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9370. /*                                                                   /*         
  9371. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9372. /* including the implied warranties of merchantability and fitness,  /*         
  9373. /* are expressly denied.                                             /*         
  9374. /*                                                                   /*         
  9375. /* Provided this copyright notice is included, this software may     /*         
  9376. /* be freely distributed and not offered for sale.                   /*         
  9377. /*                                                                   /*         
  9378. /* Changes or modifications may be made and used only by the maker   /*         
  9379. /* of same, and not further distributed.  Such modifications should  /*         
  9380. /* be mailed to the author for consideration for addition to the     /*         
  9381. /* software and incorporation in subsequent releases.                /*         
  9382. /*                                                                   /*         
  9383.  ^ TYPE(INPUT) INTENS(HIGH) COLOR(GREEN) CAPS(OFF)                              
  9384.  ! TYPE(TEXT)  INTENS(HIGH) COLOR(RED)                                          
  9385. )BODY EXPAND(``)                                                                
  9386. %-`-`-  MVS Gopher Client -`-`-                                                 
  9387. %COMMAND ===>_ZCMD                                                              
  9388. +                                                                               
  9389. %Gopher server host name+(or IP address) %===>_GGHOST                           
  9390. +                                                                               
  9391. %Initial path%===>^GGPATH                                                       
  9392. %Port number %===>_GGPORT                                                       
  9393. +                                                                               
  9394. +Note:  You may specify a dash%-+as the Gopher server host name if              
  9395.         you want to use your own private Gopher data without making             
  9396.         a connection to a server.  If you do, you must specify the              
  9397.         name of your private Gopher menu in the initial path.                   
  9398.         This name must be UNQUOTED AND FULLY QUALIFIED.                         
  9399.         Alternatively, you may allocate your initial Gopher menu                
  9400.         to file GGGOPHER.                                                       
  9401.                                                                                 
  9402.         Any menu entries must also specify a dash in the host field;            
  9403.         otherwise they will require server access, as usual.                    
  9404.                                                                                 
  9405.         To use the REXX interface, you must allocate file GGEXEC to             
  9406.         your library of Gopherable REXX execs.                                  
  9407.                                                                                 
  9408. +Press!END+key to leave this menu.                                              
  9409. )INIT                                                                           
  9410.  &ZCMD = &Z                                                                     
  9411.  IF (&GGPORT = &Z) &GGPORT = 70                                                 
  9412. )PROC                                                                           
  9413.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  9414.  VER (&GGHOST,NB)                                                               
  9415.  VER (&GGPORT,NUM)                                                              
  9416.  VPUT (GGHOST GGPATH GGPORT) PROFILE                                            
  9417. )END                                                                            
  9418. ./   ADD NAME=GGMDIR,SSI=01020021                                               
  9419. )ATTR                                                                           
  9420. /*                                                                   /*         
  9421. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9422. /*                                                                   /*         
  9423. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9424. /* including the implied warranties of merchantability and fitness,  /*         
  9425. /* are expressly denied.                                             /*         
  9426. /*                                                                   /*         
  9427. /* Provided this copyright notice is included, this software may     /*         
  9428. /* be freely distributed and not offered for sale.                   /*         
  9429. /*                                                                   /*         
  9430. /* Changes or modifications may be made and used only by the maker   /*         
  9431. /* of same, and not further distributed.  Such modifications should  /*         
  9432. /* be mailed to the author for consideration for addition to the     /*         
  9433. /* software and incorporation in subsequent releases.                /*         
  9434. /*                                                                   /*         
  9435.  ~ TYPE(INPUT) INTENS(HIGH)  CAPS(OFF) JUST(LEFT)                               
  9436.  ^ TYPE(INPUT) INTENS(HIGH)  CAPS(OFF) JUST(LEFT)                               
  9437.  ! TYPE(OUTPUT) INTENS(LOW)  CAPS(OFF) JUST(RIGHT) COLOR(YELLOW)                
  9438.  # TYPE(OUTPUT) INTENS(LOW)  CAPS(OFF) JUST(RIGHT) COLOR(BLUE)                  
  9439.  @ TYPE(OUTPUT) INTENS(HIGH) CAPS(OFF) JUST(RIGHT) COLOR(PINK)                  
  9440.  ? TYPE(OUTPUT) INTENS(LOW)  CAPS(OFF) JUST(LEFT)  COLOR(TURQ) PAD('.')         
  9441.  |  AREA(DYNAMIC) EXTEND(ON) SCROLL(ON)                                         
  9442.  \  AREA(DYNAMIC) EXTEND(OFF) SCROLL(OFF)                                       
  9443.  01 TYPE(DATAOUT) INTENS(LOW)                                                   
  9444.  02 TYPE(DATAOUT) INTENS(HIGH)                                                  
  9445.  03 TYPE(DATAIN)  INTENS(LOW)                                                   
  9446.  04 TYPE(DATAIN)  INTENS(HIGH)                                                  
  9447.  05 TYPE(DATAOUT) COLOR(GREEN)                                                  
  9448.  06 TYPE(DATAOUT) COLOR(PINK)                                                   
  9449.  07 TYPE(DATAOUT) COLOR(RED)                                                    
  9450.  08 TYPE(DATAOUT) COLOR(TURQ)                                                   
  9451.  09 TYPE(DATAOUT) COLOR(YELLOW)                                                 
  9452.  0A TYPE(DATAIN)  COLOR(BLUE)                                                   
  9453.  0B TYPE(DATAIN)  COLOR(PINK)                                                   
  9454.  0C TYPE(DATAIN)  COLOR(TURQ)                                                   
  9455.  0D TYPE(DATAIN)  COLOR(WHITE)                                                  
  9456.  0E TYPE(DATAIN)  COLOR(YELLOW)                                                 
  9457. )BODY EXPAND(``)                                                                
  9458. %&GGGHEAD                                                                       
  9459. %COMMAND ===>~GGGCMD                                          %SCROLL ===>^GAMT+
  9460. +                                                                               
  9461. +%S+Select%Q+Query%E+Extract                                                    
  9462.  -------------------------------------------------------------------------------
  9463. |GGGDYNA                                                                       |
  9464. )INIT                                                                           
  9465.  IF (&GAMT = &Z) &GAMT = CSR                                                    
  9466. )PROC                                                                           
  9467.  &GGGLVL = LVLINE(GGGDYNA)                                                      
  9468.  VPUT (GAMT) PROFILE                                                            
  9469. )END                                                                            
  9470. ./   ADD NAME=GGMLCONN,SSI=01000059                                             
  9471. )ATTR                                                                           
  9472. /*                                                                   /*         
  9473. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9474. /*                                                                   /*         
  9475. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9476. /* including the implied warranties of merchantability and fitness,  /*         
  9477. /* are expressly denied.                                             /*         
  9478. /*                                                                   /*         
  9479. /* Provided this copyright notice is included, this software may     /*         
  9480. /* be freely distributed and not offered for sale.                   /*         
  9481. /*                                                                   /*         
  9482. /* Changes or modifications may be made and used only by the maker   /*         
  9483. /* of same, and not further distributed.  Such modifications should  /*         
  9484. /* be mailed to the author for consideration for addition to the     /*         
  9485. /* software and incorporation in subsequent releases.                /*         
  9486. /*                                                                   /*         
  9487.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  9488.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  9489.  # TYPE(TEXT) INTENS(LOW)  COLOR(TURQ)                                          
  9490.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  9491.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  9492.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  9493.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  9494. )BODY EXPAND(``)                                                                
  9495. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  9496. +                                                                               
  9497. +             Client name: &GGCLIENT    Client IP address:  &GGCLIEIP           
  9498. +                                                                               
  9499. +                                                                               
  9500. +             Connection is in progress for Gopher server at:                   
  9501.               &GGSERVER (&GGSERVIP)                                             
  9502. +                                                                               
  9503. +                                                                               
  9504.                                  % Please wait.                                 
  9505. +                                                                               
  9506. +                                                                               
  9507. )INIT                                                                           
  9508. )PROC                                                                           
  9509. )END                                                                            
  9510. ./   ADD NAME=GGMLDISC,SSI=01000024                                             
  9511. )ATTR                                                                           
  9512. /*                                                                   /*         
  9513. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9514. /*                                                                   /*         
  9515. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9516. /* including the implied warranties of merchantability and fitness,  /*         
  9517. /* are expressly denied.                                             /*         
  9518. /*                                                                   /*         
  9519. /* Provided this copyright notice is included, this software may     /*         
  9520. /* be freely distributed and not offered for sale.                   /*         
  9521. /*                                                                   /*         
  9522. /* Changes or modifications may be made and used only by the maker   /*         
  9523. /* of same, and not further distributed.  Such modifications should  /*         
  9524. /* be mailed to the author for consideration for addition to the     /*         
  9525. /* software and incorporation in subsequent releases.                /*         
  9526. /*                                                                   /*         
  9527.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  9528.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  9529.  # TYPE(TEXT) INTENS(LOW)  COLOR(TURQ)                                          
  9530.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  9531.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  9532.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  9533.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  9534. )BODY EXPAND(``)                                                                
  9535. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  9536. +                                                                               
  9537. +                                                                               
  9538. +         Disconnection is in progress from the Gopher server at:               
  9539.           &GGSOLDER (&GGSOLDIP)                                                 
  9540. +                                                                               
  9541. +                                                                               
  9542.                                  % Please wait.                                 
  9543. +                                                                               
  9544. +                                                                               
  9545. )INIT                                                                           
  9546. )PROC                                                                           
  9547. )END                                                                            
  9548. ./   ADD NAME=GGMLEXN2,SSI=01000018                                             
  9549. )ATTR                                                                           
  9550. /*                                                                   /*         
  9551. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9552. /*                                                                   /*         
  9553. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9554. /* including the implied warranties of merchantability and fitness,  /*         
  9555. /* are expressly denied.                                             /*         
  9556. /*                                                                   /*         
  9557. /* Provided this copyright notice is included, this software may     /*         
  9558. /* be freely distributed and not offered for sale.                   /*         
  9559. /*                                                                   /*         
  9560. /* Changes or modifications may be made and used only by the maker   /*         
  9561. /* of same, and not further distributed.  Such modifications should  /*         
  9562. /* be mailed to the author for consideration for addition to the     /*         
  9563. /* software and incorporation in subsequent releases.                /*         
  9564. /*                                                                   /*         
  9565.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  9566.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  9567.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  9568.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  9569.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  9570.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  9571. )BODY EXPAND(``)                                                                
  9572. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  9573. +                                                                               
  9574. +Description: &GGTSUBJ                                                          
  9575. +                                                                               
  9576. +Extracting to: &GGEXDSN                                                        
  9577. +&MEMSTUFF                                                                      
  9578. +                                                                               
  9579.                                  % Please wait.                                 
  9580. +                                                                               
  9581. )INIT                                                                           
  9582.  IF (&GGEXMEM = &Z) &MEMSTUFF = &Z                                              
  9583.  ELSE               &MEMSTUFF = 'Member: &GGEXMEM'                              
  9584. )PROC                                                                           
  9585. )END                                                                            
  9586. ./   ADD NAME=GGMLRCON,SSI=01000048                                             
  9587. )ATTR                                                                           
  9588. /*                                                                   /*         
  9589. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9590. /*                                                                   /*         
  9591. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9592. /* including the implied warranties of merchantability and fitness,  /*         
  9593. /* are expressly denied.                                             /*         
  9594. /*                                                                   /*         
  9595. /* Provided this copyright notice is included, this software may     /*         
  9596. /* be freely distributed and not offered for sale.                   /*         
  9597. /*                                                                   /*         
  9598. /* Changes or modifications may be made and used only by the maker   /*         
  9599. /* of same, and not further distributed.  Such modifications should  /*         
  9600. /* be mailed to the author for consideration for addition to the     /*         
  9601. /* software and incorporation in subsequent releases.                /*         
  9602. /*                                                                   /*         
  9603.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  9604.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  9605.  # TYPE(TEXT) INTENS(LOW)  COLOR(TURQ)                                          
  9606.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  9607.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  9608.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  9609.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  9610. )BODY EXPAND(``)                                                                
  9611. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  9612. +                                                                               
  9613.         +Connection has apparently been lost to the Gopher server at:           
  9614.         &GGSERVER (&GGSERVIP)                                                   
  9615. +                                                                               
  9616.                 +Reconnection to the server is in progress.                     
  9617. +                                                                               
  9618.                                  % Please wait.                                 
  9619. +                                                                               
  9620. +                                                                               
  9621. )INIT                                                                           
  9622. )PROC                                                                           
  9623. )END                                                                            
  9624. ./   ADD NAME=GGMPEXDS,SSI=01000044                                             
  9625. )ATTR                                                                           
  9626. /*                                                                   /*         
  9627. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9628. /*                                                                   /*         
  9629. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9630. /* including the implied warranties of merchantability and fitness,  /*         
  9631. /* are expressly denied.                                             /*         
  9632. /*                                                                   /*         
  9633. /* Provided this copyright notice is included, this software may     /*         
  9634. /* be freely distributed and not offered for sale.                   /*         
  9635. /*                                                                   /*         
  9636. /* Changes or modifications may be made and used only by the maker   /*         
  9637. /* of same, and not further distributed.  Such modifications should  /*         
  9638. /* be mailed to the author for consideration for addition to the     /*         
  9639. /* software and incorporation in subsequent releases.                /*         
  9640. /*                                                                   /*         
  9641.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  9642. )BODY WINDOW(77,16)                                                             
  9643. +                                                                               
  9644. %Command ===>^ZCMD                                                              
  9645. +                                                                               
  9646. %&SUBJECT                                                                       
  9647. +                                                                               
  9648. +Save to data set ===>_GGEXDSN                                                  
  9649. +Expand tab characters?       ===>_Z  +                                         
  9650.                                                                                 
  9651. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  9652.                                                                                 
  9653. +Append to end of data set?   ===>_Z  +                                         
  9654. +Blank line after separator?  ===>_Z  +                                         
  9655. +Separator line between items (append mode only...blank for none):              
  9656. +>^Z                                                                       +<   
  9657.                                                                                 
  9658. +Press%&END (END)+to cancel the extract request.                                
  9659. )INIT                                                                           
  9660.  .ZVARS = '(GGEXTAB GGEXAPP GGEXBLK GGEXSEP)'                                   
  9661.  .CURSOR = GGEXDSN                                                              
  9662.  &ZWINTTL = 'Extract text'                                                      
  9663.  &SUBJECT = '&GGTSUBJ'                                                          
  9664.  &END = PFK(END)                                                                
  9665.  &ZCMD = &Z                                                                     
  9666.  VGET (GGEXDSN GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  9667.  &GGEXTAB = TRANS(&GGEXTAB Y,YES N,NO ' ',NO)                                   
  9668.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  9669.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  9670. )PROC                                                                           
  9671.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  9672.  VER(&GGEXDSN,NB,DSNAME)                                                        
  9673.  &GGEXTAB = TRUNC(&GGEXTAB,1)                                                   
  9674.  VER(&GGEXTAB,NB,LIST,Y,N)                                                      
  9675.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  9676.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  9677.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  9678.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  9679.  VPUT (GGEXDSN GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  9680. )END                                                                            
  9681. ./   ADD NAME=GGMPEXNG,SSI=01000027                                             
  9682. )ATTR                                                                           
  9683. /*                                                                   /*         
  9684. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9685. /*                                                                   /*         
  9686. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9687. /* including the implied warranties of merchantability and fitness,  /*         
  9688. /* are expressly denied.                                             /*         
  9689. /*                                                                   /*         
  9690. /* Provided this copyright notice is included, this software may     /*         
  9691. /* be freely distributed and not offered for sale.                   /*         
  9692. /*                                                                   /*         
  9693. /* Changes or modifications may be made and used only by the maker   /*         
  9694. /* of same, and not further distributed.  Such modifications should  /*         
  9695. /* be mailed to the author for consideration for addition to the     /*         
  9696. /* software and incorporation in subsequent releases.                /*         
  9697. /*                                                                   /*         
  9698.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  9699. )BODY WINDOW(77,14)                                                             
  9700. +                                                                               
  9701. %Command ===>^ZCMD                                                              
  9702. +                                                                               
  9703. +Save to data set ===>_GGEXDSN                                                  
  9704.                                                                                 
  9705. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  9706.                                                                                 
  9707. +Append to end of data set?   ===>_Z  +                                         
  9708. +Blank line after separator?  ===>_Z  +                                         
  9709. +Separator line between items (append mode only...blank for none):              
  9710. +>^Z                                                                       +<   
  9711.                                                                                 
  9712. +Press%&END (END)+to cancel the extract request.                                
  9713. )INIT                                                                           
  9714.  .ZVARS = '(GGEXAPP GGEXBLK GGEXSEP)'                                           
  9715.  .CURSOR = GGEXDSN                                                              
  9716.  &ZWINTTL = 'Extract item listing'                                              
  9717.  &END = PFK(END)                                                                
  9718.  &ZCMD = &Z                                                                     
  9719.  VGET (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  9720.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  9721.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  9722. )PROC                                                                           
  9723.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  9724.  VER(&GGEXDSN,NB,DSNAME)                                                        
  9725.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  9726.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  9727.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  9728.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  9729.  VPUT (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  9730. )END                                                                            
  9731. ./   ADD NAME=GGMPEXNP,SSI=01000026                                             
  9732. )ATTR                                                                           
  9733. /*                                                                   /*         
  9734. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9735. /*                                                                   /*         
  9736. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9737. /* including the implied warranties of merchantability and fitness,  /*         
  9738. /* are expressly denied.                                             /*         
  9739. /*                                                                   /*         
  9740. /* Provided this copyright notice is included, this software may     /*         
  9741. /* be freely distributed and not offered for sale.                   /*         
  9742. /*                                                                   /*         
  9743. /* Changes or modifications may be made and used only by the maker   /*         
  9744. /* of same, and not further distributed.  Such modifications should  /*         
  9745. /* be mailed to the author for consideration for addition to the     /*         
  9746. /* software and incorporation in subsequent releases.                /*         
  9747. /*                                                                   /*         
  9748.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  9749. )BODY EXPAND(``) WINDOW(77,14)                                                  
  9750. +                                                                               
  9751. %Command ===>^ZCMD                                                              
  9752. +                                                                               
  9753. +Data set name%===>_GGEXPDS                                                     
  9754. +Member prefix%===>_GGEXPMP + (item number appended - default is%#+)            
  9755.                                                                                 
  9756. +Note: The dataset must be a PDS (old or new) with RECFM=VB and LRECL=259.      
  9757.                                                                                 
  9758. +Expand tab characters?      %===>_Z  +                                         
  9759.                                                                                 
  9760. +From item number%===>_GGEXAN1         + (blank for first item in table)        
  9761. +To   item number%===>_GGEXAN2         + (blank for last item in table)         
  9762.                                                                                 
  9763. +Press%&END (END)+to cancel the extract request.                                
  9764. )INIT                                                                           
  9765.  .ZVARS = '(GGEXTAB)'                                                           
  9766.  .CURSOR = ZCMD                                                                 
  9767.  &ZWINTTL = 'Log text of items to PDS members'                                  
  9768.  &END = PFK(END)                                                                
  9769.  &ZCMD = &Z                                                                     
  9770.  VGET (GGEXPDS GGEXPMP GGEXTAB) PROFILE                                         
  9771.  &GGEXTAB = TRANS(&GGEXTAB Y,YES N,NO ' ',NO)                                   
  9772.  IF (&GGEXPMP = &Z) &GGEXPMP = '#'                                              
  9773.  &GGEXAN1 = &Z                                                                  
  9774.  &GGEXAN2 = &Z                                                                  
  9775. )PROC                                                                           
  9776.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  9777.  &GGEXTAB = TRUNC(&GGEXTAB,1)                                                   
  9778.  VER(&GGEXTAB,NB,LIST,Y,N)                                                      
  9779.  VER(&GGEXPDS,NB,DSNAME)                                                        
  9780.  &TEMP1 = TRUNC(&GGEXPDS,1)                                                     
  9781.  &TEMP2 = .TRAIL                                                                
  9782.  IF (&TEMP1 = '''')                                                             
  9783.   &GGEXDSN = TRUNC(&TEMP2,'''')                                                 
  9784.  ELSE                                                                           
  9785.   &GGEXDSN = '&ZPREFIX..&GGEXPDS'                                               
  9786.   VER(&GGEXPMP,NB,NAME)                                                         
  9787.  VER(&GGEXAN1,NUM)                                                              
  9788.  VER(&GGEXAN2,NUM)                                                              
  9789.  VPUT (GGEXPDS GGEXPMP GGEXTAB) PROFILE                                         
  9790. )END                                                                            
  9791. ./   ADD NAME=GGMPEXNS,SSI=01000057                                             
  9792. )ATTR                                                                           
  9793. /*                                                                   /*         
  9794. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9795. /*                                                                   /*         
  9796. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9797. /* including the implied warranties of merchantability and fitness,  /*         
  9798. /* are expressly denied.                                             /*         
  9799. /*                                                                   /*         
  9800. /* Provided this copyright notice is included, this software may     /*         
  9801. /* be freely distributed and not offered for sale.                   /*         
  9802. /*                                                                   /*         
  9803. /* Changes or modifications may be made and used only by the maker   /*         
  9804. /* of same, and not further distributed.  Such modifications should  /*         
  9805. /* be mailed to the author for consideration for addition to the     /*         
  9806. /* software and incorporation in subsequent releases.                /*         
  9807. /*                                                                   /*         
  9808.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  9809. )BODY EXPAND(``) WINDOW(77,17)                                                  
  9810. +                                                                               
  9811. %Command ===>^ZCMD                                                              
  9812. +                                                                               
  9813. +Data set name%===>_GGEXSEQ                                                     
  9814. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  9815. +                                                                               
  9816. +Expand tab characters?      %===>_Z  +                                         
  9817. +                                                                               
  9818. +Append to end of data set?  %===>_Z  +                                         
  9819. +Blank line after separator? %===>_Z  +                                         
  9820. +Separator line before each item (leave blank for none):                        
  9821. +>^Z                                                                       +<   
  9822.                                                                                 
  9823. +From item number%===>_GGEXAN1         + (blank for first item in table)        
  9824. +To   item number%===>_GGEXAN2         + (blank for last item in table)         
  9825.                                                                                 
  9826. +Press%&END (END)+to cancel the extract request.                                
  9827. )INIT                                                                           
  9828.  .ZVARS = '(GGEXTAB GGEXAPP GGEXBLK GGEXSEP)'                                   
  9829.  .CURSOR = ZCMD                                                                 
  9830.  &ZWINTTL = 'Log text of items to sequential file'                              
  9831.  &END = PFK(END)                                                                
  9832.  &ZCMD = &Z                                                                     
  9833.  VGET (GGEXSEQ GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  9834.  &GGEXTAB = TRANS(&GGEXTAB Y,YES N,NO ' ',NO)                                   
  9835.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  9836.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  9837.  &GGEXAN1 = &Z                                                                  
  9838.  &GGEXAN2 = &Z                                                                  
  9839. )PROC                                                                           
  9840.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  9841.  VER(&GGEXSEQ,NB,DSNAME)                                                        
  9842.  &GGEXDSN = &GGEXSEQ                                                            
  9843.  &GGEXTAB = TRUNC(&GGEXTAB,1)                                                   
  9844.  VER(&GGEXTAB,NB,LIST,Y,N)                                                      
  9845.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  9846.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  9847.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  9848.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  9849.  VER(&GGEXAN1,NUM)                                                              
  9850.  VER(&GGEXAN2,NUM)                                                              
  9851.  VPUT (GGEXSEQ GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  9852. )END                                                                            
  9853. ./   ADD NAME=GGMPEXNT,SSI=01000035                                             
  9854. )ATTR                                                                           
  9855. /*                                                                   /*         
  9856. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9857. /*                                                                   /*         
  9858. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9859. /* including the implied warranties of merchantability and fitness,  /*         
  9860. /* are expressly denied.                                             /*         
  9861. /*                                                                   /*         
  9862. /* Provided this copyright notice is included, this software may     /*         
  9863. /* be freely distributed and not offered for sale.                   /*         
  9864. /*                                                                   /*         
  9865. /* Changes or modifications may be made and used only by the maker   /*         
  9866. /* of same, and not further distributed.  Such modifications should  /*         
  9867. /* be mailed to the author for consideration for addition to the     /*         
  9868. /* software and incorporation in subsequent releases.                /*         
  9869. /*                                                                   /*         
  9870.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  9871. )BODY WINDOW(77,10)                                                             
  9872. +                                                                               
  9873. %Command ===>^ZCMD                                                              
  9874. +                                                                               
  9875. +Move cursor to choice (or type%S+next to choice) and press%ENTER+to select:    
  9876. +                                                                               
  9877. _A%1+- List%titles+of items in table                                            
  9878. _B%2+- Log %text  +of items to%sequential file+                                 
  9879. _C%3+- Log %text  +of items to%members of PDS+                                  
  9880. +                                                                               
  9881. +Press%&END (END)+to cancel the extract request.                                
  9882. )INIT                                                                           
  9883.  .CURSOR = ZCMD                                                                 
  9884.  &ZWINTTL = 'Extract Gopher items - titles or text'                             
  9885.  &END = PFK(END)                                                                
  9886.  &ZCMD = &Z                                                                     
  9887.  &A = &Z                                                                        
  9888.  &B = &Z                                                                        
  9889.  &C = &Z                                                                        
  9890. )PROC                                                                           
  9891.  VER(&ZCMD,LIST,1,2,3)                                                          
  9892.  IF (&ZCMD ^= &Z)                                                               
  9893.   &GGCHOICE = TRANS(&ZCMD 1 1 2 2 3 3 * ?)                                      
  9894.  ELSE                                                                           
  9895.   &TEMP = '&A/&B/&C'                                                            
  9896.   IF (&TEMP = '//')                                                             
  9897.    &GGCHOICE = TRANS(.CURSOR A 1 B 2 C 3 * ?)                                   
  9898.   ELSE                                                                          
  9899.    &GGCHOICE = TRANS(&TEMP  'S//' 1                                             
  9900.                             '1//' 1                                             
  9901.                             '/S/' 2                                             
  9902.                             '/2/' 2                                             
  9903.                             '//S' 3                                             
  9904.                             '//3' 3                                             
  9905.                                * ?                                              
  9906.                    )                                                            
  9907. )END                                                                            
  9908. ./   ADD NAME=GGMPEXN1,SSI=01000007                                             
  9909. )ATTR                                                                           
  9910. /*                                                                   /*         
  9911. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9912. /*                                                                   /*         
  9913. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9914. /* including the implied warranties of merchantability and fitness,  /*         
  9915. /* are expressly denied.                                             /*         
  9916. /*                                                                   /*         
  9917. /* Provided this copyright notice is included, this software may     /*         
  9918. /* be freely distributed and not offered for sale.                   /*         
  9919. /*                                                                   /*         
  9920. /* Changes or modifications may be made and used only by the maker   /*         
  9921. /* of same, and not further distributed.  Such modifications should  /*         
  9922. /* be mailed to the author for consideration for addition to the     /*         
  9923. /* software and incorporation in subsequent releases.                /*         
  9924. /*                                                                   /*         
  9925.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  9926. )BODY WINDOW(77,14)                                                             
  9927. +                                                                               
  9928. %Command ===>^ZCMD                                                              
  9929. +                                                                               
  9930. +Save to data set ===>_GGEXDSN                                                  
  9931.                                                                                 
  9932. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  9933.                                                                                 
  9934. +Append to end of data set?   ===>_Z  +                                         
  9935. +Blank line after separator?  ===>_Z  +                                         
  9936. +Separator line between items (append mode only...blank for none):              
  9937. +>^Z                                                                       +<   
  9938.                                                                                 
  9939. +Press%&END (END)+to cancel the extract request.                                
  9940. )INIT                                                                           
  9941.  .ZVARS = '(GGEXAPP GGEXBLK GGEXSEP)'                                           
  9942.  .CURSOR = GGEXDSN                                                              
  9943.  &ZWINTTL = 'Extract Gopher item listing'                                       
  9944.  &END = PFK(END)                                                                
  9945.  &ZCMD = &Z                                                                     
  9946.  VGET (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  9947.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  9948.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  9949. )PROC                                                                           
  9950.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  9951.  VER(&GGEXDSN,NB,DSNAME)                                                        
  9952.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  9953.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  9954.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  9955.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  9956.  VPUT (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  9957. )END                                                                            
  9958. ./   ADD NAME=GGMPEXOW,SSI=01000030                                             
  9959. )ATTR                                                                           
  9960. /*                                                                   /*         
  9961. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  9962. /*                                                                   /*         
  9963. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  9964. /* including the implied warranties of merchantability and fitness,  /*         
  9965. /* are expressly denied.                                             /*         
  9966. /*                                                                   /*         
  9967. /* Provided this copyright notice is included, this software may     /*         
  9968. /* be freely distributed and not offered for sale.                   /*         
  9969. /*                                                                   /*         
  9970. /* Changes or modifications may be made and used only by the maker   /*         
  9971. /* of same, and not further distributed.  Such modifications should  /*         
  9972. /* be mailed to the author for consideration for addition to the     /*         
  9973. /* software and incorporation in subsequent releases.                /*         
  9974. /*                                                                   /*         
  9975.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  9976. )BODY WINDOW(58,10)                                                             
  9977. +                                                                               
  9978. %Command ===>^ZCMD                                                              
  9979. +                                                                               
  9980. +Dataset already exists:                                                        
  9981. +                                                                               
  9982. %&GGEXDSN                                                                       
  9983. +                                                                               
  9984. +Press%ENTER+to%&ACTION                                                         
  9985. +Press%&END (END)+to cancel the request.                                        
  9986. +                                                                               
  9987. )INIT                                                                           
  9988.  .ALARM = YES                                                                   
  9989.  &ZWINTTL = 'Extract To Existing Data Set'                                      
  9990.  &END = PFK(END)                                                                
  9991.  &APP = TRUNC(&GGEXAPP,1)                                                       
  9992.  IF (&APP = Y) &ACTION = 'append to the end of the data set.'                   
  9993.  ELSE          &ACTION = 'overwrite the current data set.'                      
  9994. )PROC                                                                           
  9995.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  9996. )END                                                                            
  9997. ./   ADD NAME=GGMPEXPW,SSI=01000053                                             
  9998. )ATTR                                                                           
  9999. /*                                                                   /*         
  10000. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10001. /*                                                                   /*         
  10002. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10003. /* including the implied warranties of merchantability and fitness,  /*         
  10004. /* are expressly denied.                                             /*         
  10005. /*                                                                   /*         
  10006. /* Provided this copyright notice is included, this software may     /*         
  10007. /* be freely distributed and not offered for sale.                   /*         
  10008. /*                                                                   /*         
  10009. /* Changes or modifications may be made and used only by the maker   /*         
  10010. /* of same, and not further distributed.  Such modifications should  /*         
  10011. /* be mailed to the author for consideration for addition to the     /*         
  10012. /* software and incorporation in subsequent releases.                /*         
  10013. /*                                                                   /*         
  10014.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10015. )BODY WINDOW(58,13)                                                             
  10016. +                                                                               
  10017. %Command ===>^ZCMD                                                              
  10018. +                                                                               
  10019. +Paritioned dataset already exists:                                             
  10020. +                                                                               
  10021. %&GGEXDSN                                                                       
  10022. +                                                                               
  10023. +If member names are generated that match existing members                      
  10024. +of this PDS, they will be%overwritten.+                                        
  10025. +                                                                               
  10026. +Press%ENTER+to proceed to use this PDS.                                        
  10027. +Press%&END (END)+to cancel the request.                                        
  10028. +                                                                               
  10029. )INIT                                                                           
  10030.  .ALARM = YES                                                                   
  10031.  &ZWINTTL = 'Extract To Members of Existing PDS'                                
  10032.  &END = PFK(END)                                                                
  10033. )PROC                                                                           
  10034.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10035. )END                                                                            
  10036. ./   ADD NAME=GGMPWAIS,SSI=01020012                                             
  10037. )ATTR                                                                           
  10038. /*                                                                   /*         
  10039. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10040. /*                                                                   /*         
  10041. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10042. /* including the implied warranties of merchantability and fitness,  /*         
  10043. /* are expressly denied.                                             /*         
  10044. /*                                                                   /*         
  10045. /* Provided this copyright notice is included, this software may     /*         
  10046. /* be freely distributed and not offered for sale.                   /*         
  10047. /*                                                                   /*         
  10048. /* Changes or modifications may be made and used only by the maker   /*         
  10049. /* of same, and not further distributed.  Such modifications should  /*         
  10050. /* be mailed to the author for consideration for addition to the     /*         
  10051. /* software and incorporation in subsequent releases.                /*         
  10052. /*                                                                   /*         
  10053.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10054. )BODY WINDOW(58,10)                                                             
  10055. +                                                                               
  10056. %Command ===>^ZCMD                                                              
  10057. +                                                                               
  10058. +Enter index search query:                                                      
  10059. +                                                                               
  10060. %===>^GGWAISQ                                                                   
  10061.                                                                                 
  10062. +Press%ENTER+to submit search request.                                          
  10063. +Press%&END (END)+to cancel the request.                                        
  10064. +                                                                               
  10065. )INIT                                                                           
  10066.  &ZWINTTL = 'GOPHER Full Text Index Search'                                     
  10067.  &END = PFK(END)                                                                
  10068.  .CURSOR = GGWAISQ                                                              
  10069. )PROC                                                                           
  10070.  IF  (&ZCMD ^= &Z) .MSG = ISPZ001                                               
  10071.  VER (&GGWAISQ,NB)                                                              
  10072.  VPUT (GGWAISQ) PROFILE                                                         
  10073. )END                                                                            
  10074. ./   ADD NAME=GGMPWHOI,SSI=01000019                                             
  10075. )ATTR                                                                           
  10076. /*                                                                   /*         
  10077. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10078. /*                                                                   /*         
  10079. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10080. /* including the implied warranties of merchantability and fitness,  /*         
  10081. /* are expressly denied.                                             /*         
  10082. /*                                                                   /*         
  10083. /* Provided this copyright notice is included, this software may     /*         
  10084. /* be freely distributed and not offered for sale.                   /*         
  10085. /*                                                                   /*         
  10086. /* Changes or modifications may be made and used only by the maker   /*         
  10087. /* of same, and not further distributed.  Such modifications should  /*         
  10088. /* be mailed to the author for consideration for addition to the     /*         
  10089. /* software and incorporation in subsequent releases.                /*         
  10090. /*                                                                   /*         
  10091.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10092. )BODY WINDOW(58,10)                                                             
  10093. +                                                                               
  10094. %Command ===>^ZCMD                                                              
  10095. +                                                                               
  10096. +Enter name to search for:                                                      
  10097. +                                                                               
  10098. %===>^GGWHOISQ                                                                  
  10099.                                                                                 
  10100. +Press%ENTER+to submit search request.                                          
  10101. +Press%&END (END)+to cancel the request.                                        
  10102. +                                                                               
  10103. )INIT                                                                           
  10104.  &ZWINTTL = 'WHOIS/FINGER User Name Search'                                     
  10105.  &END = PFK(END)                                                                
  10106.  .CURSOR = GGWHOISQ                                                             
  10107. )PROC                                                                           
  10108.  IF  (&ZCMD ^= &Z) .MSG = ISPZ001                                               
  10109.  VER (&GGWHOISQ,NB)                                                             
  10110.  VPUT (GGWHOISQ) PROFILE                                                        
  10111. )END                                                                            
  10112. ./ ENDUP                                                                        
  10113. ?!                                                                              
  10114.