home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / srev13h.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  2002-01-13  |  78KB  |  2,363 lines

  1. /* this is the SRE-http installation program */
  2.  
  3. call init_it
  4. crlf='0d0a'x
  5.  
  6. cls
  7. say  " " ; say
  8.  
  9. call lineout, bold cy_ye
  10. call lineout, "This is the SRE-http  (v 1.3h) installation program (15 January 2002)."
  11. call lineout, "... an HTTP/1.1 compliant filter for the GoServe OS/2 Internet Server "
  12. call lineout, normal
  13.  
  14.  
  15. say " This program will ask for the names of a few directories,"
  16. say " and will copy a number of files to these directories."
  17. say "  "
  18.  
  19. if yesno(" Are you ready to continue ")=1 then
  20.  nop
  21. else do
  22.  say " See you later?.. "
  23.  exit
  24. end
  25.  
  26. say cy_ye"  Short disclaimer: "normal
  27. say "    SRE-http is free, it's open source, and we want to hear"
  28. say "    comments & complaints. However, it is NOT warranteed against "
  29. say "    misuse, abuse, security related problems, and other forms of failure."
  30. say " "
  31. say " Note: The GoServe based line of SREhttp products is being phased out,"
  32. say "       as we switch over to those based on SRE2002. "
  33. say "       Please see www.srehttp.org/SRE2002/ for the details "
  34. say " "
  35. if yesno(" Would you like to view the full disclaimer?")=1 then
  36.    call show_disclaim
  37.  
  38.  
  39. /* first, check tcp/ip version -- suggest upgrade */
  40. '@inetver | rxqueue '
  41. oy=''
  42. do until queued()=0
  43.    pull oy 1
  44.    oy=oy||oy1
  45. end /* do */
  46. parse var oy . ':' aver 
  47. parse var aver mainver '.' subver
  48. if mainver='4' then do
  49.   if subver<'02T' then do
  50.       say
  51.       say bold"WARNING: " normal" Your TCP/IP version is "aver
  52.       say "           We "bold"STRONGLY"normal" recommend upgrading to 4.02t (or above)"
  53.      if yesno(" Continue installing SRE-http (and upgrade TCP/IP later)?")=1 then do
  54.         say "   Okay, but you may experience sporadic errors."
  55.         say '   (Please see SREHTTP.FAQ for a discussion of "why is response time so slow") '
  56.         say ' '
  57.      end
  58.      else do
  59.         say "As of 10 Dec 1998, 4.02t info can be found at: "
  60.         say "   ftp://ps.software.ibm.com/ps/products/tcpip/rsu/stack/latestv4.html"
  61.         say " (see SREHTTP.FAQ for more info on upgrading tcp/ip) "
  62.         say
  63.         say "See you later.... "
  64.         exit
  65.      end /* do */
  66.   end
  67. end
  68.  
  69. hh=yesno(" Install (I), or review the installation notes (R)",,'I R')
  70. if hh=0 then do
  71.     say " okay, reviewing installation notes.  ... "
  72.     say ' '
  73.    signal gonotes
  74. end
  75.  
  76. /* check status of goserve and macrospace routines */
  77. a=dospidlist(l1,l2)
  78. do mm=1 to a
  79.  foo=upper(strip(filespec('n',l2.mm)))
  80.  if foo='GOSERVE.EXE' then do
  81.      say bold " GOSERVE appears to be running " normal
  82.      say " Please shut down GOSERVE  before you (re) install SRE-http! "
  83.       exit
  84.   end  /* Do */
  85. end /* do */
  86.  
  87. adir=filespec("drive",nowdir)
  88. defname=adir||'\GOSERVE'
  89. defname2=adir||'\WWW'
  90.  
  91. call check_macro
  92.  
  93. install_counter=1
  94. install_new=yesno(normal" Is this a: "bold" New installation (N), or an upgrade (U)",,'N U')
  95.  
  96. if install_new=0 then do
  97.   call make_def_dirs 1
  98.   useoo=result
  99.   say ' '
  100.   say " Parameter files will NOT be modified (please see the upgraders notes)"
  101.  
  102.   crx=stream(addon_dir||'\COUNTER.RXX','c','query size')
  103.   if crx<>0 & crx<>'' then do  /* check vintage of counter.rxx */
  104.       ain=charin(addon_dir||'\COUNTER.RXX',1,crx)
  105.       fcrx=stream(addon_dir||'\COUNTER.RXX','c','close')
  106.       ii=pos('COUNTER_RXX_DIR',ain)
  107.       if ii=0 then do           /* it's pre 1.3d */ 
  108.         say
  109.         say " An old (pre 1.3d) version of COUNTER.RXX was detected "
  110.         install_counter=yesno(normal'   'bold'  Install the latest version of COUNTER.RXX?')
  111.         if install_counter=1 then do
  112.             say "    Note: the new copy of COUNTER.RXX (that will be installed) "
  113.             say "           contains parameters you might need to customize."
  114.          end
  115.          else do
  116.             say "  Warning: HOST specific COUNTER_DIR requires ver 1.3d (or above) of COUNTER.RXX "
  117.          end
  118.        end              /* detected old counter.rxx */
  119.        else do
  120.          install_counter=0
  121.         end
  122.    end                  /* deteced a counter.rxx */
  123. end
  124. else do
  125.   call make_def_dirs 0
  126.   useoo=result
  127. end /* do */
  128.  
  129.  
  130. /*** NOt currently needed 
  131. if useoo<>'' then do    
  132.   call read_initfilt_dirs useoo
  133. end
  134. ****/
  135.  
  136. /* -- Done with directory creation -- copy files ... */
  137.  
  138. /* but first, backup? */
  139. if gmaking=1 then signal oy1   /* if totally new, no need to archive */
  140.  
  141.   say " "
  142.  if install_new=1 then  call lineout, re_wh "Are you re-installing SRE-http?  " normal
  143.  foo=yesno(normal"     "re_wh"Would you like to archive the various configuration files")
  144.  if foo=1 then do
  145.       say  " Where should SRE-http archive these files"
  146.       aa="\BK"||space(translate(date('o'),' ','/\'),0)
  147.       backup_dir=get_dir(workdir||aa)
  148.  
  149. /* files to backup*/
  150.       in_workdir=' SREFILTR.80 RENLOGS.CMD LOGFAIL.HTM MAXFAIL.HTM ACCFAIL.HTM INIT_STA.80 INITFILT.80 MEDIATYP.RXX USERCHK.RXX '
  151.       in_workdir=in_workdir||'PREFILTR.80 POSTFILT.80 POSTRCRD.80 POSTMAIL.80 PMPRINTF.RXX SREFMON.CMD '
  152.       in_sdatadir='ALL_FILE.CTL ALIASES.IN VIRTUAL.IN USERS.IN SENDFILE.CNT RECRDALL.CNT  PUBURLS.IN '
  153.       in_sdatadir=in_sdatadir||'COUNTER.CNT SREFLOGS.INI REPSTRGS.IN  HITMETER.CNT'
  154.       in_cfgsdir='INIT_STA.80 INITFILT.80 SCHEDULE.CFG EVENTS.CFG ACCESS.IN ALL_FILE.CTL ALIASES.IN VIRTUAL.IN USERS.IN  SREFLOGS.INI REPSTRGS.IN PUBURLS.IN CFGLIST.CFG ATTRIBS.CFG'
  155.       in_mboxdir='ANYONE.LOG '
  156.       in_adddir='COUNTER.RXX BYBROWSR.RXX '
  157.       in_datadir='INDEX.HTML INDEX.HTM INDEX.SHTML INDEX.SHT DYNPWD.HTM '
  158.       call dobackup
  159.       say bold' Note:'normal" you might be asked to backup a few other files  "
  160.       say "       (for storage in their 'own' directory)"
  161.       yooba=sysfiletree(workdir||'\BK*','goos','OD')
  162.       if goos.0>1  then do
  163.           say bold' Reminder:'normal' you have 'goos.0 ' SRE archive directories; you might want to '
  164.           say '          remove some of the older ones. '
  165.       end /* do */
  166.  end
  167.  else do
  168.     say " "
  169.  end  /* Do */
  170.  
  171.  
  172. oy1:                    /* skip here if new directory ! */
  173. foo=yesno(" SRE-http will now be installed. Are you ready? ")
  174. if foo=0 then do
  175.   say " Try again later ??? "
  176.   exit
  177. end
  178.  
  179. say " "
  180. say " Copying dynamic link libraries and helper executables .. "
  181. if gotrxlib=1 then do
  182.    say " Note: a copy of REXXLIB seems to be on your system "
  183. end  /* Do */
  184. foo=copy_if_newer('REXXLIB.DLL',workdir)
  185. if dropunz=0 then do
  186.    say " Note: a copy of UNZIPAPI seems to be on your system "
  187. end  /* Do */
  188. foo=copy_if_newer('UNZIPAPI.DLL',workdir)
  189. say " "
  190. foo=copy_if_newer('FILEREXX.DLL',workdir)
  191. foo=copy_if_newer('SRXFUNC.DLL',workdir)
  192.  
  193. foo=copy_if_newer('rxgzlib.dll',workdir)
  194. foo=copy_if_newer('MD5.EXE',workdir)
  195.  
  196. say " "
  197.  
  198.  
  199. say " Copying  SRE-http main and misc. program files files to " workdir
  200.  
  201.  
  202. foo=check_copy('*.80' ,workdir,,1)  
  203. foo=check_copy('SREFMON.CMD' ,workdir,,1)
  204. foo=check_copy('SREINIT1.CMD' ,workdir,,1)
  205. foo=check_copy('PREREP.CMD' ,workdir,,1)
  206. foo=check_copy('SRERSYNC.CMD' ,workdir,,1)
  207. foo=check_copy('DE_SREA.CMD' ,workdir,,1)
  208. foo=check_copy('DE_SREBF.CMD' ,workdir,,1)
  209. foo=check_copy('SREDOMD5.CMD' ,workdir,,1)
  210. foo=check_copy('NEGOT.CMD' ,workdir,,1)
  211.  
  212. goo=cfgsdir||'\init_sta.80'
  213. issta=STREAM(goo,'c','query exists')
  214. if issta='' & install_new=0 then do
  215.     say " INIT_STA.80  is new to sre-http (as of 20 March 1999)  "
  216.     say " -- it contains "bold"static-parameters"normal" that used to be set in  SREFILTR.80"
  217.     say " ... copying INIT_STA.80 to "cfgsdir
  218.     foo=check_copy('INIT_STA.A80' ,goo,,1)
  219. end /* do */
  220. else do
  221.    if install_new=1 then do
  222.        foo=check_copy('INIT_STA.A80' ,goo,' This is your "static parameters file". Are you sure? ')
  223.    end
  224. end
  225. INIT_STA_FILE=goo
  226.  
  227. foo=check_copy('DO*.CMD' ,workdir,,1)
  228. foo=check_copy('FREEUP.CMD' ,workdir,,1)
  229. foo=check_copy('STATUS.CMD' ,addon_dir,,1)
  230. foo=check_copy('MULTSEND.CMD' ,addon_dir,,1)
  231. foo=check_copy('TRYMAX.CMD' ,addon_dir,,1)
  232.  
  233. foo=check_copy('BROWSERS.CMD' ,addon_dir,,1)
  234. foo=check_copy('CONFIG2.CMD' ,addon_dir,,1)
  235. foo=check_copy('TSTDIGIT.CMD' ,addon_dir,,1)
  236. foo=check_copy('ENC_TEST.CMD' ,addon_dir,,1)
  237. foo=check_copy('CONFCOLR.CMD' ,addon_dir,,1)
  238. foo=check_copy('SREFCONF.CMD' ,addon_dir,,1)
  239. foo=check_copy('ADV_OPTS.CMD' ,workdir,,1)
  240. foo=check_copy('EDITSREF.CMD' ,workdir,,1)
  241. foo=check_copy('EDITINIT.CMD' ,workdir,,1)
  242.  
  243. foo=check_copy('USERCFG.CMD',addon_dir,,1)
  244. foo=check_copy('ALIASCFG.CMD',addon_dir,,1)
  245. foo=check_copy('REALMCFG.CMD',addon_dir,,1)
  246. foo=check_copy('ACCESCFG.CMD',addon_dir,,1)
  247. foo=check_copy('HTACCFG.CMD',addon_dir,,1)
  248. foo=check_copy('VIRTCFG.CMD',addon_dir,,1)
  249.  
  250. foo=check_copy('TESTVALU.CMD',addon_dir,,1)
  251. foo=check_copy('CHECKSEL.CMD',addon_dir,,1)
  252. if install_new=1 then do
  253.    foo=check_copy('LOGFAIL.HT0' ,workdir||'\LOGFAIL.HTM',' This is your "logon failure response file". Are you sure? ')
  254.    foo=check_copy('ACCFAIL.HT0' ,workdir||'\ACCFAIL.HTM',' This is your "access failure  response file". Are you sure?')
  255.    foo=check_copy('MAXFAIL.HT0' ,workdir||'\MAXFAIL.HTM',' This is your "MAXUSER failure response file". Are you sure? ')
  256.    foo=check_copy('DYNPWD.RSP',datadir,,'This is your "dynamic passwords" response file. Are you sure?')
  257.    foo=check_copy('ENC_SREB.RSP',datadir,,'This is your "SRE_B encryption" response file. Are you sure?')
  258.    foo=check_copy('ENC_FORM.RSP',datadir,,'This is your "encrypted_FORMS" response file. Are you sure?')
  259. end
  260.  
  261.  
  262. say " "
  263. say " Installing simple SRE-http configurator (CONFIG0.HTM) "
  264. foo=check_copy('CONFIGUR.HT0',datadir||'\CONFIGUR.HTM',,1)
  265. foo=check_copy('CONFIG0.HT0',datadir||'\CONFIG0.HTM',,1)
  266. foo=check_copy('CONFIG2a.HT0',datadir||'\CONFIG2a.HTM',,1)
  267. foo=check_copy('CONFIG2b.HT0',datadir||'\CONFIG2b.HTM',,1)
  268. foo=check_copy('CONFIG3.HT0',datadir||'\CONFIG3.HTM',,1)
  269. foo=check_copy('CONFCOLR.HTM' ,datadir,,1)
  270.  
  271. foo=check_copy('DE_SREA.CMD' ,datadir,,1)
  272. foo=check_copy('DE_SREBF.CMD' ,datadir,,1)
  273.  
  274.  
  275. if install_new=1 then do
  276.  foo=check_copy('BYBROWSR.RX0',addon_dir||'\BYBROWSR.RXX',,1)
  277. end
  278.  
  279. if install_counter=1 then do
  280.     say " Copying COUNTER.RXX to "addon_dir
  281.    foo=check_copy('COUNTER.RX0',addon_dir||'\COUNTER.RXX',,1) 
  282. end /* do */
  283.  
  284.  
  285. foo=check_copy('MTCHFILE.RX0',addon_dir||'\MTCHFILE.RXX',,1)
  286.  
  287. foo=check_copy('ADDPRIVS.RX0',addon_dir||'\ADDPRIVS.RXX',,1)
  288.  
  289.  
  290. foo=check_copy('USETABL2.RX0',addon_dir||'\USETABL2.RXX',,1)
  291. foo=check_copy('DIRINFO.RX0',addon_dir||'\DIRINFO.RXX',,1)
  292. foo=check_copy('SAMPCOOK.RX0',addon_dir||'\SAMPCOOK.RXX',,1)
  293.  
  294.  
  295. foo=check_copy('*.RXX',workdir,,1)
  296.  
  297. if install_new=1 then do
  298.    say " "
  299.    say " Copying  user configurable parameter files to " cfgsdir
  300.  
  301.    foo=check_copy('CFGLIST.CFG', cfgsdir,' *** This contains HOST configuration information: Are you sure?')
  302.    foo=check_copy('EVENTS.CFG', cfgsdir,' *** This contains HOST configuration information: Are you sure?')
  303.  
  304.    foo=check_copy('ATTRIBS.CFG', cfgsdir,' *** This contains selector-specific options: Are you sure?')
  305.  
  306.    foo=check_copy('*.IN', cfgsdir,' *** THESE ARE PARAMETER & CONFIGURATION FILES : Are you sure?')
  307.  
  308.    say " "
  309.  
  310.    say " Copying common-log-audit-file configuration file, to " cfgsdir
  311.    foo=check_copy('SREFLOGS.INI', cfgsdir,' *** This is the common-log configuration file: Are you sure?')
  312.    foo=check_copy('SCHEDULE.CFG', cfgsdir,' *** This is the scheduled-events configuration file: Are you sure?')
  313.  
  314.    say " "
  315.    say " Copying  audit files and advanced options files to " sdatadir
  316.  
  317.    foo1=check_COPY('ADV_OPTS.CTL',sdatadir,,1)
  318.    foo1=check_COPY('FAQ.CTL',sdatadir,,1)
  319.    foo1=check_COPY('*.SEC',sdatadir,,1)
  320.  
  321.    say ' '
  322.  
  323.    say " Copying  log-file-archiving program to " workdir
  324.    foo=check_copy('RENLOGS.CMD', workdir,' *** This is the log-file archiver: Are you sure?')
  325.  
  326.  
  327.    foo=check_COPY('*.CNT', sdatadir,' These are your "hit-counter" files: Are you sure?')
  328.  
  329.    say " "
  330.    say " Copying sample message box file to " mboxdir
  331.    foo=check_COPY('ANYONE.LOG', mboxdir,' This is your default "message box": Are you sure?')
  332.    say " "
  333. end
  334.  
  335. /* if no .cfg files in cfgsdir, copy them there */
  336. if stream(cfgsdir'\SCHEDULE.CFG','c','query exists')='' then
  337.   foo=check_copy('SCHEDULE.CFG',cfgsdir,,1)
  338.  
  339. if stream(cfgsdir'\CFGLIST.CFG','c','query exists')='' then
  340.   foo=check_copy('CFGLIST.CFG',cfgsdir,,1)
  341.  
  342. if stream(cfgsdir'\EVENTS.CFG','c','query exists')='' then
  343.   foo=check_copy('EVENTS.CFG',cfgsdir,,1)
  344.  
  345.  
  346. if stream(cfgsdir'\ATTRIBS.CFG','c','query exists')='' then
  347.   foo=check_copy('ATTRIBS.CFG',cfgsdir,,1)
  348.  
  349. say " Copying sample and help files to " helpdir
  350. foo1=check_COPY('*.HTM',helpdir,,1)
  351. foo1=check_COPY('*.SHT',helpdir,,1)
  352. foo=checK_COPY('SAMPMAP.*',helpdir,,foo1)
  353. foo=check_COPY('TESTTABL.TBL',HELPDIR,,foo1)
  354. foo=check_COPY('TESTTABL.DEF',HELPDIR,,foo1)
  355.  
  356. foo=check_copy('INTERPET.IN0',sdatadir'\INTERPET.IN',,1)
  357.  
  358. foo=check_copy('*.IDX',sdatadir,,1)
  359.  
  360. say " Copying Sample CGI-Bin programs to " cgibin_dir
  361. foo1=check_copy('*.PL',cgibin_dir,,1)
  362. foo=check_copy('XCOUNT.CMD',cgibin_dir,,foo1)
  363. foo=check_copy('JCOUNT.CMD',cgibin_dir,,foo1)
  364. foo=check_copy('TEST-CGI.CMD',cgibin_dir,,foo1)
  365.  
  366. foo=check_COPY('*.DOC',helpdir,,foo1)
  367. foo=check_COPY('HISTORY.TXT',helpdir,,foo1)
  368.  
  369. foo=check_COPY('*.FAQ',helpdir,,foo1)
  370.  
  371.  
  372. say " "
  373. SAY ' Copying GIF file archive to  ' gifdir
  374. foo=check_COPY('GIFS.ZIP',gifdir,,1)
  375.  
  376. say " "
  377. SAY ' Copying GIF-DIGITS file archive to  ' digitsdir
  378. foo=check_COPY('DIGITS.ZIP',digitsdir,,1)
  379.  
  380.  
  381. say " Copying simple mode configuration files to " config_dir
  382. foo=check_COPY('CONFIGS.ZIP',config_dir,,1)
  383.  
  384. say " Copying library configuration files to " lib_dir
  385. foo=check_COPY('SREFPRC.ZIP',lib_dir,,1)
  386.  
  387.  
  388. if gotunz=0 then do
  389.     say " "
  390.     say bold " UZUNZIP.DLL could not be found " normal
  391.     say "          * you will need to unzip GIFS.ZIP (in " gifdir
  392.     say "          * you will need to unzip DIGITS.ZIP (in " digitsdir
  393.     say '          * you will need to unzip CONFIGS.ZIP (in ' config_dir
  394.     say '          * you will need to unzip SREFPRC.ZIP (in ' lib_dir
  395.     call charout , cy_ye ' (hit any key to continue) ' normal
  396.     foo=SYSGETKEY("NOECHO")
  397.     signal nogotuz
  398. end  /* Do */
  399.  
  400. meis=directory()
  401.  
  402. aa1=suzunzip(gifdir,'GIFS.ZIP')
  403. aa2=suzunzip(digitsdir,'DIGITS.ZIP')
  404. aa3=suzunzip(config_dir,'CONFIGS.ZIP')
  405. aa4=suzunzip(lib_dir,'SREFPRC.ZIP')
  406.  
  407. meis=directory(meis)
  408.  
  409. if aa1*aa2*aa3*aa4=0 then do
  410.      say " "
  411.     say bold "WARNING: " normal
  412.     say " A problem with the UNZIP dll has occurred (can not find UZUNZIP). "
  413.     say " You can either: "
  414.     say "    a) ^C, shutdown, and try again (that seems to work) "
  415.     say "    b) Complete the installation, and then from an OS/2 prompt: "
  416.     say "        i) UNZIP GIFS.ZIP (in " gifdir
  417.     say "       ii) UNZIP DIGITS.ZIP (in " digitsdir
  418.     say "      iii) UNZIP CONFIGS.ZIP (in " config_dir
  419.     say "       iv) UNZIP fSREFPRC.ZIP (in " lib_dir
  420.  
  421.     say " I know this is a tedious solution, but it is a very flakey problem!"
  422.     call charout , cy_ye ' (hit any key to continue) ' normal
  423.     foo=sysgetkey("noecho")
  424. end  /* Do */
  425.  
  426.  
  427. nogotuz:  nop
  428.  
  429. IF install_new=0 then SIGNAL DONE1A
  430.  
  431. say " "
  432. call lineout, cy_ye ' ------------ Configuration: ' normal
  433. say " "
  434.  
  435. call get_ip_address
  436.  
  437. say " "
  438. uu=set_params(0)
  439.  
  440. /* -- add entry to users.in file */
  441. foo=add_user(cfgsdir)
  442.  
  443.  
  444. /* --- customize index.htm  -- */
  445. say " "
  446. call lineout, cy_ye  " ... customizing files ... " normal
  447. say " "
  448. say ' Copying sample home page to ' datadir
  449. thefh=grab_file("INDEX.HT0")
  450. if thefh=0 then do
  451.    Say " ERROR : Could not find sample home page "
  452.    say "         You may need to unzip SRE-http  again? "
  453.    signal done1
  454. end
  455. parse var helpdir foo (datadir) thesamp
  456. thesamp=strip(translate(thesamp,'/','\'),,'/')
  457. thefh=replacestrg(thefh,'helpdirectory',thesamp,'ALL')
  458. dog=datadir||'\INDEX.SHT'
  459.  
  460. drop foo1
  461. tmp=sysfiletree(dog,foo1,'F')
  462. ok=1
  463. if foo1.0>0 & copyall=0 then
  464.   ok=yesno(" Overwrite "||dog"?")
  465.  
  466. if ok=1 then do
  467.   if foo1.0>0 then do 
  468.     toydog=dostempname(datadir||'\INDEX.???')
  469.     foo=dosrename(dog,toydog)
  470.     say bold " Note: "normal " just to be safe, your old INDEX.SHT has been moved to"
  471.     say      "                " toydog
  472.     call syssleep(2)
  473.   end
  474.   aa=stream(dog,'c','open write')
  475.   if aa<>'READY:' then do
  476.     say " ERROR: could not write " dog
  477.     signal done1
  478.   end
  479.   foo=charout(dog,thefh)
  480.   if foo>0 then do
  481.      say " ERROR: Problem writing " dog
  482.      signal done1
  483.   end
  484.   aa=stream(dog,'c','close')
  485.   useindex='INDEX.SHT'
  486. end
  487. else do
  488.    dog2=dostempname(datadir||'\SINDX???.HTM')
  489.    foo=charout(dog2,thefh)
  490.    if foo=0 then do
  491.      say bold " Note: "normal " A sample SRE-http home page has been"
  492.      say "    copied to " dog2
  493.      say "It contains links to several useful configuration tools, "
  494.      say " as well as links to SRE-http demos."
  495.      call syssleep(2)
  496.      useindex=filespec('n',dog2)
  497.    end
  498. end
  499.  
  500. /* --- customize mediatyp.rxx -- */
  501. say " "
  502. say ' Copying the user defined MIME type file (MEDIATYP.RXX) to ' workdir
  503. thefh=grab_file("MEDIATYP.RX0")
  504. if thefh=0 then do
  505.    Say " ERROR : Could not find user-defined MEDIATYPE file"
  506.    say "         You may need to unzip SRE-http  again? "
  507.    signal done1
  508. end
  509. dog=workdir||'\MEDIATYP.RXX'
  510.  
  511. drop foo1
  512. tmp=sysfiletree(dog,foo1,'F')
  513. ok=1
  514. if foo1.0>0 & copyall=0 then do
  515.   say " Overwrite " dog " -- your customized MIME types list? "
  516.   ok=yesno(" Overwrite "||dog"?")
  517. end
  518. if ok=1 then do
  519.   foo=sysfiledelete(dog)          /* delete any prior version */
  520.   aa=stream(dog,'c','open write')
  521.   if aa<>'READY:' then do
  522.     say " ERROR: could not write " dog
  523.     signal done1
  524.   end
  525.   foo=charout(dog,thefh)
  526.   if foo>0 then do
  527.      say " ERROR: Problem writing " dog
  528.      signal done1
  529.   end
  530.   aa=stream(dog,'c','close')
  531. end
  532.  
  533.  
  534.  
  535.  
  536. /*-- Modifying the INITFILT.80 file -- */
  537.  
  538. say " "
  539.  
  540. say " Modifying the INITFILT.80 parameters file "
  541. thefh=grab_file("INITFILT.A80")
  542. if thefh=0 then do
  543.    Say " ERROR : Could not find  INITFILT.A80 parameters file. "
  544.    say "         You may need to unzip SRE-http  again? "
  545.    signal done1
  546. end
  547.  
  548. thefh=replacestrg(thefh,'workingdirectory',workdir,'ALL')
  549. thefh=replacestrg(thefh,'workingdir',workdir,'ALL')
  550.  
  551. thefh=replacestrg(thefh,'cfgsdirectory',cfgsdir,'ALL')
  552.  
  553. thefh=replacestrg(thefh,'messageboxdir',mboxdir,'ALL')
  554.  
  555. thefh=replacestrg(thefh,'mailboxdir',mailboxdir,'ALL')
  556.  
  557. thefh=replacestrg(thefh,'workingdatadir',sdatadir,'ALL')
  558. thefh=replacestrg(thefh,'temporarydir',tempdir,'ALL')
  559. thefh=replacestrg(thefh,'tempdatadir',tempdatadir,'ALL')
  560. thefh=replacestrg(thefh,'userinfodir',userinfodir,'ALL')
  561.  
  562. thefh=replacestrg(thefh,'owneraddress',ipaddr,'ALL')
  563. thefh=replacestrg(thefh,'uploaddir',upload_dir,'ALL')
  564. thefh=replacestrg(thefh,'cgibindirectory',cgibin_dir,'ALL')
  565. thefh=replacestrg(thefh,'addondirectory',addon_dir,'ALL')
  566.  
  567.  
  568.  
  569. thefh=replacestrg(thefh,'configuredir',config_dir,'ALL')
  570.  
  571.  
  572. /* Set some  "common parameters" */
  573. thefh=replacestrg(thefh,'aautoname',aautoname,'ALL')
  574. thefh=replacestrg(thefh,'adefault',adefault,'ALL')
  575. thefh=replacestrg(thefh,'assishtml',assi,'ALL')
  576. thefh=replacestrg(thefh,'ahomename',ahomename,'ALL')
  577. thefh=replacestrg(thefh,'arealm',arealm,'ALL')
  578. thefh=replacestrg(thefh,'awebmaster',awebmaster,'ALL')
  579. thefh=replacestrg(thefh,'assicache',assicache,'ALL')
  580. thefh=replacestrg(thefh,'ahomedir',ahomedir,'ALL')
  581.  
  582. dog=cfgsdir||'\INITFILT.80'
  583. initfilt_File=dog
  584. drop foo1
  585. tmp=sysfiletree(dog,foo1,'F')
  586. ok=1
  587. if foo1.0>0  & copyall=0 then do
  588.   ok=yesno(" Overwrite "||dog"?")
  589.   if ok=1 then do
  590.       say dog " is your SRE-http configuration file... "
  591.       ok=yesno(normal"       "re_wh" are you sure you want to overwrite it?")
  592.   end
  593. end
  594.  
  595. if ok=1 then do
  596.   isadog=stream(dog,'c','query exists')
  597.   if isadog<>'' then do
  598.      dog2=dostempname(cfgsdir||'\INITFILT.B??')
  599.      foo=dosrename(dog,dog2)
  600.      say bold "Note: " normal " The old INITFILT.80 file has been moved to: "
  601.      say      "          " dog2
  602.      foo=sysfiledelete(dog)          /* delete any prior version */
  603.   end
  604.   aa=stream(dog,'c','open write')
  605.   if aa<>'READY:' then do
  606.      say " ERROR: could not write " dog
  607.      signal done1
  608.   end
  609.   foo=charout(dog,thefh)
  610.   if foo>0 then do
  611.      say " ERROR: Problem writing " dog
  612.      signal done1
  613.   end
  614.   aa=stream(dog,'c','close')
  615. end
  616.  
  617.  
  618. done1: nop
  619.  
  620. call charout , cy_ye ' (hit any key to continue) ' normal
  621. foo=sysgetkey("noecho")
  622.  
  623. done1A: nop
  624.  
  625. a=scrclear()
  626.  
  627. call lineout, bold cy_ye  " SRE-http has been installed... " normal
  628. say " "
  629. say ' Your web site is now ready to be built!  '
  630. say '      (just add documents, images, links, etc...)'
  631. say ' '
  632. say ' Notes:'
  633. say '    * 'useindex ', the sample SRE-http home page, contains a number of '
  634. say '      useful links to configuration tools, demos, and on-line documentation.'
  635. say "      It's located in your GoServe data directory ("datadir")"
  636. say '    * If you use a  different File name as your "home page",'
  637. say "      be sure to change SRE-http's " bold "DEFAULT " normal " initialization parameter."
  638. if issta='' & install_new=0 then do
  639.   say "    * SREFILTR.80 no longer contains parameters: please edit INIT_STA.80 "
  640. end 
  641. signal on syntax name gogo
  642. signal on error name gogo
  643. gonotes:
  644. say " "
  645. say bold " Would you like to read some additional configuration hints? "normal
  646. say " "bold"1"normal") Setting up GoServe "
  647. say " "bold"2"normal") Configuring SRE-http "
  648. say " "bold"3"normal") Finding Help on SRE-http "
  649. say " "bold"4"normal") A note on ports "
  650. say " "bold"5"normal") A note on SRE-http addons "
  651. say " "bold"6"normal") Notes for upgraders "bold"&"normal" notes on modifying configuration files"
  652. say " "bold"7"normal") INITFILT.80 and INIT_STA.80 "bold" comparator!" normal
  653. say " "bold"8"normal") Cleaning up and removing SRE-http "
  654. say " "bold"9"normal") Viewing SRE-http status-information and error-log"
  655. say " "bold"A"normal") Run the "cy_ye" INIT_STA.80 "normal" or "cy_ye" INITFILT.80"normal" editor. "
  656. say " "bold"X"normal") Exit installation program ."
  657. gonotes2:
  658. call charout, reverse " Select an option from the above: " normal
  659. pull anopt
  660.  
  661. select
  662.    when  anopt="1" then signal note1
  663.    when  anopt="2" then signal note2
  664.    when  anopt="3" then signal note3
  665.    when  anopt="4" then signal note4
  666.    when  anopt="5" then signal note5
  667.    when  anopt="6" then signal note6
  668.    when  anopt="7" then signal note7
  669.    when  anopt="8" then signal note8
  670.    when  anopt="9" then signal note9
  671.    when  anopt="A" then signal noteA
  672.  
  673.  
  674.    when  anopt="X" then do
  675.       if dropunz=1 then foo=zdropfunc()
  676.       if droprxlib=1 then foo=rexxlibderegister()
  677.       say " bye .. "
  678.       exit
  679.    end
  680.    otherwise
  681.         signal gonotes2
  682. end  /* select */
  683.  
  684. gogo:
  685. signal  off syntax
  686.  
  687.  
  688. exit
  689.  
  690. note1: nop
  691. say cy_ye " -----  Configuring GoServe:" normal
  692. say "                 **  "bold "  Are you using GoServe 2.52? "normal " **"
  693. say       " If not, you'll need to download it from http://www2.hursley.ibm.com/goserve"
  694. say "" 
  695. say " 1) Instruct GoServe that SREFILTR.80 is the working filter. To do this: "
  696. say '     enter ' bold 'http filter srefiltr.80' normal ' in the'
  697. say "  " bold " optional parameters line " normal " in GoServe's settings window,"
  698. say "     (right-mouse click on the GoServe icon ...) "
  699. say " 2) Make sure that GoServe knows your data directory "
  700. say "     (use the OPTIONS-DataDir tab in the GoServe status window) "
  701. say " 3) Set a few GoServe limits: "
  702. say    " *  You must set the Options-Limit-Connection_maintain to some positive" 
  703. say    "    number (say, 15)." 
  704. say " 4)  You must have a properly defined TZ variable in your OS/2 CONFIG.SYS file"
  705. say "     (TZ is used to set the time zone relative to Greenwich Mean Time)."
  706. say " " 
  707. say    " Advanced Users Note:"
  708. say    "    If you are willing to sacrfice full compliance with http/1.1, you"  
  709. say    "    can force SRE-http to ignore some of these prerequisites by" 
  710. say    "    setting the CHECK_COMPLIANCE parameter in SREFMON.CMD. "
  711.  
  712.  
  713.  
  714. call charout , cy_ye ' (hit any key to continue) ' normal
  715. foo=sysgetkey("noecho") 
  716. a= scrclear()
  717. signal gonotes 
  718.  
  719.  
  720.  
  721.  
  722. note2:
  723. say cy_ye " -----  Configuring SRE-http:" normal
  724.  
  725. if thishost="" then thishost=get_hostname()
  726. say ' To further configure SRE-http, you can run CONFIGUR.HTM '
  727. say " (actually, you should probably read the documentation first!) "
  728. say "  "
  729. say " To do this: "
  730. say "   a) Fire up your favorite web browser"
  731. say '   b) Point it a http://'thishost'/CONFIGUR.HTM'
  732. say '      (Note: you can also use /CONFIGURE, which is "aliased" to CONFIGUR.HTM)'
  733. say '   c) You can then choose one of three configuration modes:'
  734. say '      i) Simple mode: A well-documented, form based tool for modifying '
  735. say '         the more important SRE-http parameters'
  736. say '     ii) Intermediate mode: A less well-documented, but more powerful, '
  737. say '         form based tool for modifying almost all of the parameters '
  738. say '    iii) Expert mode: Edit the various text files containing the parameters'
  739. say 'Notes: '
  740. say '   * 'bold'parameters'normal' include: usernames, redirection aliases,'
  741. say '     SEL-specific access controls, virtual directories, and HTACCESS files.'
  742. say '   * the EDITSREF.CMD utility can be used to edit parameters contained '
  743. say '     in INIT_STA.80'
  744. say '   * It is a good idea to copy the .DLL (REXXLIB, UNZIPAPI, and FILEREXX) '
  745. foo=value('system_ini',,'os2environment')
  746. goo=filespec('d',foo)||filespec('p',foo)||'DLL'
  747. say '     files to somewhere in your LIBPATH (i.e.; ' GOO ')'
  748. say " "
  749. call charout , cy_ye ' (hit any key to continue) ' normal
  750. foo=sysgetkey("noecho")
  751.  
  752. say bold " A Note on Security: " normal
  753. say "   SRE-http checks for SUPERUSER privileges before allowing access to "
  754. say "   the configurator.  Note that the OWNER address (that you entered at the  "
  755. say "   beginning of this installation), and the user you (may) have added"
  756. say "   are both granted SUPERUSER status. "
  757. say " "
  758. say "  If you are "bold"very security conscious"normal", you can limit "
  759. say "  configuration to requests issued from the server itself "
  760. say '  by modifying the NO_REMOTE_CONFIGURE parameter in INIT_STA.80 '
  761. say "  If you are " reverse "EXTREMELY " normal "cautious, you can use NO_REMOTE_CONFIGURE to "
  762. say "  "bold"totally disable " normal " remote configuration (in which case, modification"
  763. say "  of SRE-http parameters requires editing of ascii configuration files)"
  764. say  ""
  765. call charout , cy_ye ' (hit any key to continue) ' normal
  766. foo=sysgetkey("noecho")
  767. a= scrclear()
  768. signal gonotes
  769.  
  770.  
  771.  
  772. note3:
  773. say cy_ye " -----  Finding Help on SRE-http:" normal
  774. say ' SRE-http comes with numerous help documents (you can find them '
  775. say ' in ' helpdir ')'
  776. say ' '
  777. say ' The following are the more important help documents: '
  778. say '   * INTRO.DOC    -- a 1 page description of SRE-http'
  779. say '   * GUIDE.HTM    -- the Users Guide  ' bold ' -- A good place to start ' normal
  780. say '   * SREHTTP.HTM -- the SRE-http manual'
  781. say '   * SREHTTP.FAQ -- some frequently asked questions '
  782. say "   * INITFILT.DOC -- a detailed description of SRE-http's initialization"
  783. say '                     parameters, with possible choices described for each. '
  784. say '   * HISTORY.TXT  -- history of changes '
  785. say '   * IN_FILES.DOC -- description of selector-specific attributes files.'
  786. say '   * OUTLINE.HTM  -- a technical outline of how SRE-http processes a request'
  787. say '   * HELPLIST.HTM  -- a list of the SRE-http help documents. '
  788. say "   * ENCRYPT.DOC   -- a discussion of SRE-http's encryption facility "
  789. say ' '
  790. say " Hint: the users guide is a good place to start (there's a link to it"
  791. say '       on the SRE-http sample home page) '
  792. say " For tough problems, you can contact DANIELH@CROSSLINK.NET "
  793. say " "
  794. call charout , cy_ye ' (hit any key to continue) ' normal
  795. foo=sysgetkey("noecho")
  796. a= scrclear()
  797. signal gonotes
  798.  
  799. note4:
  800. say cy_ye " -----  A Note on Ports:" normal
  801. say '  If you can not use port 80, all you need to do is '
  802. say '  change all the *.80 files (to *.new_port_number) -- see the '
  803. say '  documentation for details '
  804. call charout , cy_ye ' (hit any key to continue) ' normal
  805. foo=sysgetkey("noecho")
  806. a= scrclear()
  807. signal gonotes
  808.  
  809. note5:
  810. say cy_ye " -----  A Note on SRE-http addons:" normal
  811. say ' SRE-http has a number of addons avaiable. You can download them '
  812. say ' from the SRE-http home page at http://www.srehttp.org  '
  813. say ' For example, you may be interested in: '
  814. say '   'bold'GoSwish:'normal' A directory-indexer/search-engine '
  815. say '   'bold'FORUM:'normal' A  "news-group and list-server" discussion-group package '
  816. say '   'bold'BBS:'normal' A full featured "web based bulletin board system" '
  817. say '   'bold'GETAFILE:'normal' A  directory displayer, with user-settable display features'
  818. say '   'bold'CALC:'normal' A character-mode scientific calculator with a web interface '
  819. say '   'bold'CUSTOMIZ:'normal' Client customization tools (for the personal touch) '
  820. say ' '
  821. call charout , cy_ye ' (hit any key to continue) ' normal
  822. foo=sysgetkey("noecho")
  823. a= scrclear()
  824. signal gonotes
  825.  
  826.  
  827. /* */
  828.  
  829. note6: nop
  830. say cy_ye " -----  Notes for Upgraders:" normal
  831. say " A few of the recent changes included in ver 1.3h:"
  832. say ''
  833. say ' Support for delta-encoding and rsync differencing'
  834. say ' Monitoring of administrator specified events using EVENTS.CFG'
  835. say ' Support for hit-meter trees '
  836. say ' Improved support for Transparent Content Negotiation'
  837. say ' Support for XSSI "apache-style" server side includes '
  838. say ' Many changes to the configurator '
  839. say ' ATTRIBS.CFG can be used to define REALMS (instead of using the .IN files)'
  840. say ' SRE-http can now encrypt responses (using a proprietary, non-SSL, algorithim)'
  841. say ' The default subdirectory for initializations file is CFGS\ (instead of DATA\)'
  842. say ' Host & port specific configuration info can be specified in CFGLIST.CFG'
  843. say'  SCHEDULE.CFG can be used to specify scheduled events'
  844. say ' Static-parameters are no longer set in SREFILTR.80; use INIT_STA.80 instead '
  845. say ' "Secret-privileges" can now be defined (i.e.; for use in secondary logons) '
  846. say ' A "pre-reply" hook is now available (PREREPLY.DOC)'
  847. say ' A find-filename-matches variant of a 404 response is available (MTCHFILE.DOC)'
  848. say ' sreLite (a smaller/quicker) version of SRE-http is now available'
  849. say " SRE-http 1.3h is  http/1.1 compliant"
  850. say " SRE-http 1.3h is  Y2K compliant"
  851. say " "
  852. say bold">>> The new home page for SRE-http is www.srehttp.org <<<"normal ' (38.152.44.14)'
  853. SAY " "
  854. IF YESNO(normal||'HISTORY.TXT documents the latest changes to SRE-http.'||bold||' View it?')=1 then do
  855.     say " Okay, viewing the history of changes ... "
  856.      '@START  "The SRE-http history of changesl" /C /F /WIN E HISTORY.TXT'
  857. end
  858. say ' '
  859.  
  860. say  cy_ye" Moving files to the CFG\ subdirectory "normal
  861. say ""
  862. say " As of SRE-http version 1.3d, the recommended subdirectory for "
  863. say " configuration files is CFGS\ (the CFGS\ subdirectory of "GODIR')'
  864. say
  865. say " We also recommend using the host & port specific configuration files"
  866. say " (as specified in CFGLIST.CFG) instead of using host-specific entries "
  867. say " in a configuration file (such as INITFILT.80, ALIASES.IN and USERS.IN)"
  868. SAY
  869. say  " Alternatively, you should consider using the combined selector-specific-"
  870. say  " options file (ATTRIBS.CFG) instead of the various .IN files"
  871. say
  872. say '  Please see: '
  873. say "     * "cy_ye"USE_CFGS.DOC"normal" for details on using CFGLIST.CFG, "
  874. say "     * "cy_ye"IN_FILES.DOC"normal" for info on using ATTRIBS.CFG  "
  875. say
  876. say
  877. IF YESNO(normal||'    '||bold||"Would you like to view USE_CFGS.DOC")=1 then do
  878.     say " Okay, viewing the description of host & port specific configuration files ..."
  879.      '@START  "The SRE-http USE_CFGS documentation!" /C /F /WIN E USE_CFGS.DOC'
  880. end
  881. say
  882. IF YESNO(normal||'    '||bold||"Would you like to view IN_FILES.DOC")=1 then do
  883.     say " Okay, viewing the description of selector-specific parameters ... "
  884.      '@START  "The SRE-http IN_FILES.DOC documentationl" /C /F /WIN E IN_FILES.DOC'
  885. end
  886.  
  887. say ''
  888.  
  889. call charout , cy_ye ' (hit any key to continue) ' normal
  890. foo=sysgetkey("noecho")
  891. a= scrclear()
  892. signal gonotes
  893.  
  894. /* */
  895.  
  896. note7: nop
  897.  
  898.  
  899. say " "
  900. say " "
  901. say  cy_ye ' Scan your INITFILT.80 initialization file? ' normal
  902. say " If you did "bold"not"normal" update the INITFILT.80 file, there may be parameters "
  903. say " that you'll need to add (or remove) by hand. "
  904. say " To facilitate this process, you can search for all required parameters "
  905. say " that are missing from the "bold"currently active initialization file"normal
  906. say " It will also find incorrect (and obsolete) parameters."
  907. say " "
  908.  
  909. if initfilt_file='' then do 
  910.    oof=directory()
  911.    ddr=filespec('d',oof)
  912.    initfilt_file=ddr'\GOSERVE\CFGS\INITFILT.80'
  913. end /* do */
  914.  
  915.  
  916. say " Note: the "bold"currently active initialization file"normal" is: " 
  917. say "                  " initfilt_file
  918. say " "
  919. ok=yesno(" Would you like to view these differences?")
  920.  
  921. if ok=1 then do
  922.   a=sref_fileread('initfilt.a80',newl,,'E')
  923.   if newl.0=0 | A<0 then do
  924.     say "ERROR: Default INITFILT.80 file not found (error code= "a
  925.     exit
  926.   end
  927.   IF A=" " then DO
  928.        SAy " Error in FILEREAD procedure (are you using REXXFILE.DLL ?)"
  929.        exit
  930.   end  /* Do */
  931.   else
  932.   n1=0
  933.   do nn=1 to newl.0
  934.     aline=strip(newl.nn)
  935.     if aline=' ' | abbrev(aline,';')=1 then iterate
  936.     n1=n1+1
  937.     parse var aline  atmp '=' news.n1.!stuff
  938.     parse upper var atmp news.n1 '.' . ; news.n1=strip(news.n1)
  939.   end /* do */
  940.   news.0=n1
  941.  
  942.   do forever
  943.     aa=initfilt_file
  944.     if aa<>' ' then  aa=stream(aa,'c','query exists')
  945.     if aa<>' ' then leave
  946.     say  bold 'Could not find the old INITFILT.80 file ('initfilt_file')' normal
  947.     say " Please enter its (fully qualified) name: "
  948.     parse pull initfilt_file
  949.   end
  950.  
  951.   a=sref_fileread(initfilt_file,oldl,,'E')
  952.   n2=0
  953.   do nn=1 to oldl.0
  954.      aline=strip(oldl.nn)
  955.      if aline=' ' | abbrev(aline,';')=1 then iterate
  956.      n2=n2+1
  957.      parse var aline  atmp '=' olds.n2.!stuff
  958.      parse upper var atmp  olds.n2 '.' . ;olds.n2=strip(olds.n2)
  959.   end /* do */
  960.   olds.0=n2
  961.  
  962.   Say reverse " ----- " normal " Looking for required parameters: "
  963.  
  964.   do iu=1 to news.0
  965.      lookfor=strip(news.iu)
  966.      okay=0
  967.      do iu2=1 to olds.0
  968.       if olds.iu2=lookfor then  do
  969.         iterate iu
  970.       end
  971.     end /* do */
  972. /* if here, could not find */
  973.     parse var news.iu.!stuff goob '/*' .
  974.  
  975.      thefh=replacestrg(goob,'messageboxdir',mboxdir,'ALL')
  976.      thefh=replacestrg(thefh,'mailboxdir',mailboxdir,'ALL')
  977.      thefh=replacestrg(thefh,'workingdatadir',sdatadir,'ALL')
  978.      thefh=replacestrg(thefh,'temporarydir',tempdir,'ALL')
  979.      thefh=replacestrg(thefh,'tempdatadir',tempdatadir,'ALL')
  980.      thefh=replacestrg(thefh,'userinfodir',userinfodir,'ALL')
  981.  
  982.      thefh=replacestrg(thefh,'uploaddir',upload_dir,'ALL')
  983.      thefh=replacestrg(thefh,'cgibindirectory',cgibin_dir,'ALL')
  984.      thefh=replacestrg(thefh,'addondirectory',addon_dir,'ALL')
  985.  
  986.      thefh=replacestrg(thefh,'aautoname',aautoname,'ALL')
  987.     thefh =replacestrg(thefh,'adefault',adefault,'ALL')
  988.     thefh=replacestrg(thefh,'assishtml',assi,'ALL')
  989.     thefh=replacestrg(thefh,'ahomename',ahomename,'ALL')
  990.     thefh=replacestrg(thefh,'arealm',arealm,'ALL')
  991.     thefh=replacestrg(thefh,'awebmaster',awebmaster,'ALL')
  992.    thefh=replacestrg(thefh,'assicache',assicache,'ALL')
  993.    thefh=replacestrg(thefh,'ahomedir',ahomedir,'ALL')
  994.  
  995.      goob=replacestrg(thefh,'configuredir',config_dir,'ALL')
  996.  
  997.     say '    Could not find ' lookfor '(recommended value= 'goob
  998.   end /* do */
  999.  
  1000.   call charout,  cy_ye ' (hit any key to continue) ' normal
  1001.   foo=sysgetkey("noecho")
  1002.   say " "
  1003.  
  1004.   say reverse " -------------" normal " Looking for incorrect & obsolete parameters "
  1005.   do iu=1 to olds.0
  1006.     lookfor=strip(olds.iu)
  1007.     if abbrev(lookfor,'$')=1 then do
  1008.        parse var lookfor . lookfor ; lookfor=strip(lookfor)
  1009.     end
  1010.     okay=0
  1011.     do iu2=1 to news.0
  1012.        if news.iu2=lookfor then  do
  1013.          iterate iu
  1014.        end
  1015.     end /* do */
  1016. /* if here, could not find */
  1017.     parse var olds.iu.!stuff goob '/*' .
  1018.     say '    Unused variable: ' lookfor '= ' goob
  1019.   end /* do */
  1020. say reverse " ------------- "normal
  1021. say " "
  1022. call charout,'Hint: if the above contain any entries, you can...'
  1023.   call charout , cy_ye ' (any key to continue) ' normal
  1024.   foo=sysgetkey("noecho")
  1025. say
  1026. say cy_ye'*'normal'   i) open a text editor in another OS/2 window (keep this window open)'
  1027. say cy_ye'*'normal'  ii) edit ' initfilt_file 
  1028. say cy_ye'*'normal' iii) make the changes '
  1029. call charout,cy_ye'*'normal'  iv) reselect the 'reverse"notes and hints for upgraders"normal" option",
  1030. cy_ye'(any key to continue)'normal
  1031. foo=sysgetkey("noecho")
  1032. say " "
  1033.  
  1034. end
  1035.  
  1036. a= scrclear()
  1037.  
  1038.  
  1039. /********** here for init_sta.80 */
  1040. say " "
  1041. say " "
  1042. say  cy_ye ' Scan your INIT_STA.80 initialization file? ' normal
  1043. say " If you did "bold"not"normal" update the INIT_STA.80 file, there may be parameters "
  1044. say " that you'll need to add (or remove) by hand. "
  1045. say " To facilitate this process, you can search for all required parameters "
  1046. say " that are missing from the "bold"currently active initialization file"normal
  1047. say " It will also find incorrect (and obsolete) parameters."
  1048. say " "
  1049.  
  1050. if init_sta_file='' then do 
  1051.    oof=directory()
  1052.    ddr=filespec('d',oof)
  1053.    init_sta_file=ddr'\GOSERVE\CFGS\INIT_STA.80'
  1054. end /* do */
  1055.  
  1056. say " Note: the "bold"currently active initialization file"normal" is: " 
  1057. say "                  " init_sta_file
  1058.  
  1059. say " "
  1060. ok=yesno(" Would you like to view these differences?")
  1061.  
  1062. if ok=1 then do
  1063.  
  1064. /*  a=sref_fileread('init_Sta.a80',newl,,'E') */
  1065.   newl.=0
  1066.   kijj=stream('init_sta.a80','c','query size')
  1067.   gg=charin('init_sta.a80',1,kijj)
  1068.   gg0=''                /* remove comments */
  1069.   do until gg=''
  1070.      parse var gg a1 '/*' . '*/' gg
  1071.      gg0=gg0||a1
  1072.   end /* do */
  1073.   newl.0=0
  1074.   do until gg0=''       /* fill in "NEWL" array */
  1075.     parse var gg0 aline '0d0a'x gg0
  1076.     if aline='' then iterate
  1077.     mbn=newl.0+1
  1078.     newl.mbn=aline
  1079.     newl.0=mbn
  1080.   end
  1081.  
  1082.   if newl.0=0 then do
  1083.     say "ERROR: Default INIT_sta.80 file not found "
  1084.     exit
  1085.   end
  1086.   n1=0
  1087.   do nn=1 to newl.0
  1088.     aline=strip(newl.nn)
  1089.     if aline=' ' then iterate
  1090.     n1=n1+1
  1091.     parse var aline  atmp '=' news.n1.!stuff
  1092.     parse upper var atmp news.n1 '.' . ; news.n1=strip(news.n1)
  1093.   end /* do */
  1094.   news.0=n1
  1095.  
  1096.   do forever
  1097.     aa=init_sta_file
  1098.     if aa<>' ' then  aa=stream(aa,'c','query exists')
  1099.     if aa<>' ' then leave
  1100.     say  bold 'Could not find the old INIT_STA.80 file ('init_sta_file')' normal
  1101.     say " Please enter its (fully qualified) name: "
  1102.     parse pull init_sta_file
  1103.   end
  1104.  
  1105.   kijj=stream(init_sta_file,'c','query size')
  1106.   gg=charin(init_sta_file,1,kijj)
  1107.   gg0=''                /* remove comments */
  1108.   do until gg=''
  1109.      parse var gg a1 '/*' . '*/' gg
  1110.      gg0=gg0||a1
  1111.   end /* do */
  1112.   oldl.=0
  1113.   do until gg0=''       /* fill in "OLDL" array */
  1114.     parse var gg0 aline '0d0a'x gg0
  1115.     if aline='' then iterate
  1116.     mbn=oldl.0+1
  1117.     oldl.mbn=aline
  1118.     oldl.0=mbn
  1119.   end
  1120.   
  1121. /*  a=sref_fileread(init_sta_file,oldl,,'E') */
  1122.   n2=0
  1123.   do nn=1 to oldl.0
  1124.      aline=strip(oldl.nn)
  1125.      if aline=' ' then iterate
  1126.      n2=n2+1
  1127.      parse var aline  atmp '=' olds.n2.!stuff
  1128.      parse upper var atmp  olds.n2 '.' . ;olds.n2=strip(olds.n2)
  1129.   end /* do */
  1130.   olds.0=n2
  1131.  
  1132.   Say reverse " ----- " normal " Looking for required parameters: "
  1133.  
  1134.   do iu=1 to news.0
  1135.      lookfor=strip(news.iu)
  1136.      okay=0
  1137.      do iu2=1 to olds.0
  1138.       if olds.iu2=lookfor then  do
  1139.         iterate iu
  1140.       end
  1141.     end /* do */
  1142. /* if here, could not find */
  1143.     parse var news.iu.!stuff goob '/*' .
  1144.  
  1145.     say '    Could not find ' lookfor '(recommended value= 'goob
  1146.   end /* do */
  1147.  
  1148.   call charout,  cy_ye ' (hit any key to continue) ' normal
  1149.   foo=sysgetkey("noecho")
  1150.   say " "
  1151.  
  1152.   say reverse " -------------" normal " Looking for incorrect & obsolete parameters "
  1153.   do iu=1 to olds.0
  1154.     lookfor=strip(olds.iu)
  1155.     if abbrev(lookfor,'$')=1 then do
  1156.        parse var lookfor . lookfor ; lookfor=strip(lookfor)
  1157.     end
  1158.     okay=0
  1159.     do iu2=1 to news.0
  1160.        if news.iu2=lookfor then  do
  1161.          iterate iu
  1162.        end
  1163.     end /* do */
  1164. /* if here, could not find */
  1165.     parse var olds.iu.!stuff goob '/*' .
  1166.     say '    Unused variable: ' lookfor '= ' goob
  1167.   end /* do */
  1168. say reverse " ------------- "normal
  1169. say cy_ye'(hit any key to continue)'normal
  1170. foo=sysgetkey("noecho")
  1171. say " "
  1172.  
  1173. end
  1174.  
  1175.  
  1176. a= scrclear()
  1177. signal gonotes
  1178.  
  1179.  
  1180.  
  1181.  
  1182. /* */
  1183.  
  1184. note8: nop
  1185. say cy_ye " -----  Cleaning up and Removing SRE-http:" normal
  1186. say " After you have finished installing SRE-http, you can delete the contents"
  1187. say " of the temporary directory ("nowdir"). "
  1188. say bold " *** "normal" You may be told that "bold"a process is locked .."normal
  1189. say " This refers to the DLL's used in the install process. At your convenience, "
  1190. say " you should  reboot, and then delete, to complete this cleanup process "
  1191. say " (sorry, but I don't want to bother using OS/2 locked files facility)"
  1192. say " "
  1193. say " To remove SRE-http, just delete the contents of:"
  1194. say "    " bold "*" normal " the GoServe working directory:"  reverse workdir normal
  1195. say "      before you do this, you may first want to back up the GOSERVE.* "
  1196. say "      (and MAKEICON.CMD) files in the " reverse workdir normal
  1197. say " and you may want to clean up the:"
  1198. say "    " bold "*" normal "  GoServe data directory:" reverse datadir normal
  1199.  
  1200.  
  1201. call charout , cy_ye ' (hit any key to continue) ' normal
  1202. foo=sysgetkey("noecho")
  1203. say " "
  1204.  
  1205. a= scrclear()
  1206. signal gonotes
  1207.  
  1208. note9: nop
  1209. say cy_ye " -----  SRE-http Status Information" normal
  1210. say " If you want to keep an eye on what's happening on your web-server "
  1211. say " we recommend obtaining the PMPRINTF facility. You can download it from:"
  1212. say "     http://www2.hursley.ibm.com/goserve/pmprtf.zip"
  1213. say " PMPRINTF will open a window within which status information will be shown, "
  1214. say " with optional save-to-file features."
  1215. say " "
  1216. say " We especially recommend the use of PMPRINTF if you intend to "
  1217. say " monkey with the innards of SRE-http, or if you take a crack at writing "
  1218. say " your own addons -- it's really the only way to find out where the bugs are! "
  1219. say " "
  1220. say " You can also set SRE-http's VERBOSE variable to set the amount of "
  1221. say " information SRE-http displays (0 means very little, 4 means too much)."
  1222. say " "
  1223. say " We also recommend examining the ERROR.LOG file (in the DATA subdirectory)."
  1224. say " SRE-http will write warnings and errors to this file. "
  1225. say " "
  1226. say " GOSERVE's AUDIT facility also contains useful (if somewhat arcane) information  "
  1227. say " (see GOSERVE.DOC for details on how to configure the AUDIT facility)."
  1228. say " "
  1229.  
  1230.  
  1231. call charout , cy_ye ' (hit any key to continue) ' normal
  1232. foo=sysgetkey("noecho")
  1233. say " "
  1234.  
  1235. a= scrclear()
  1236. signal gonotes
  1237.  
  1238.  
  1239. notea: nop
  1240. say 
  1241. say cy_ye " -----  The INITFILT.80 and INIT_STA.80 editors" normal
  1242. say " INITFILT.80 and INIT_STA.80 contain a number of configuration parameters."
  1243. say "    > INITFILT.80  contains dynamic-parameters."
  1244. say "      It is designed to be modified by the on-line configurator. "
  1245. say "      As a rule, it contains parameters that are more likely to be "
  1246. say "      changed by a typical server administrator."
  1247. say "    >  INIT_STA.80 contains static-parameters (that used to be set in "
  1248. say "       SREFILTR.80).It contains more advanced parameters; in many cases  "
  1249. say "       the default values need never be changed. "
  1250. say 
  1251. say "  Although you can edit these files with a text editor, you can also use two "
  1252. say "  special parameter-editor utilities."
  1253. say "  Would you like to: "
  1254. say "     1) Run the INIT_STA.80 editor (EDITSREF.CMD)"
  1255. say "        Note: you can use EDITSREF.CMD to edit COUNTER.RXX; just enter "
  1256. say "        "addon_dir"\COUNTER.RXX when asked for a filename."
  1257. say "     2) Run the INITFILT.80 editor (EDITINIT.CMD)"
  1258. call charout, reverse " Select 1  or 2: " normal
  1259. pull whiched
  1260.  
  1261.  
  1262. if whiched=1 then do
  1263.    if workdir_Notset=1 then  do
  1264.       say  ' '
  1265.         say " What is the GoServe working directory (where SREFILTR.80 is instalelled)"
  1266.         parse pull workdir
  1267.    end
  1268.    aa=directory(workdir)
  1269.    foo=EDITSREF('noexit ')
  1270.     foo=directory(nowdir)
  1271.  
  1272. end /* do */
  1273. if whiched=2 then do 
  1274.    if workdir_Notset=1 then  do
  1275.         say ' '
  1276.         say " What is the GoServe working directory (where SREFILTR.80 is instalelled)"
  1277.         parse pull workdir
  1278.    end
  1279.     aa=directory(workdir)
  1280.     foo=EDITINIT('noexit')
  1281.     foo=directory(nowdir)
  1282. end /* do */
  1283.  
  1284.  
  1285.  
  1286.  
  1287. /*call charout , cy_ye ' (hit any key to continue) ' normal
  1288. foo=sysgetkey("noecho")*/
  1289. say " "
  1290.  
  1291. a= scrclear()
  1292. signal gonotes
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298. exit
  1299.  
  1300.  
  1301.  
  1302. /********/
  1303. /* copy files to backup directory  */
  1304. dobackup:
  1305.  
  1306. do mm=1 to words(in_workdir)
  1307.      a1=strip(word(in_workdir,mm))
  1308.  
  1309.      cto=backup_dir||'\'||a1
  1310.      cfrom=workdir||'\'||a1
  1311.      if stream(cfrom,'c','query exists')<>"" then do
  1312.          call lineout,' Archiving ' cfrom ' ... '
  1313.          'COPY 'cfrom ' ' cto ' > nul '
  1314.      end  /* Do */
  1315.  
  1316. end /* do */
  1317. do mm=1 to words(in_sdatadir)
  1318.      a1=strip(word(in_sdatadir,mm))
  1319.      cto=backup_dir||'\'||a1
  1320.      cfrom=sdatadir||'\'||a1
  1321.      if stream(cfrom,'c','query exists')<>"" then do
  1322.          call lineout,' Archiving ' cfrom ' ... '
  1323.          'COPY 'cfrom ' ' cto  ' > nul '
  1324.      end
  1325. end /* do */
  1326.  
  1327. do mm=1 to words(in_cfgsdir)
  1328.      a1=strip(word(in_cfgsdir,mm))
  1329.      cto=backup_dir||'\'||a1
  1330.      cfrom=cfgsdir||'\'||a1
  1331.      if stream(cfrom,'c','query exists')<>"" then do
  1332.          call lineout,' Archiving ' cfrom ' ... '
  1333.          'COPY 'cfrom ' ' cto  ' > nul '
  1334.      end
  1335. end /* do */
  1336.  
  1337. do mm=1 to words(in_mboxdir)
  1338.      a1=strip(word(in_mboxdir,mm))
  1339.      cto=backup_dir||'\'||a1
  1340.      cfrom=mboxdir||'\'||a1
  1341.      if stream(cfrom,'c','query exists')<>"" then do
  1342.          call lineout,' Archiving ' cfrom ' ... '
  1343.          'COPY 'cfrom ' ' cto  ' >nul'
  1344.      end  /* Do */
  1345. end
  1346.  
  1347. do mm=1 to words(in_datadir)
  1348.      a1=strip(word(in_datadir,mm))
  1349.      cto=backup_dir||'\'||a1
  1350.      cfrom=datadir||'\'||a1
  1351.      if stream(cfrom,'c','query exists')<>"" then do
  1352.          call lineout,' Copying ' cfrom ' ... '
  1353.          'COPY 'cfrom ' ' cto  ' > nul '
  1354.      end
  1355. end /* do */
  1356.  
  1357. do mm=1 to words(in_adddir)
  1358.      a1=strip(word(in_adddir,mm))
  1359.      cto=backup_dir||'\'||a1
  1360.      cfrom=addon_dir||'\'||a1
  1361.      if stream(cfrom,'c','query exists')<>"" then do
  1362.          call lineout,' Copying ' cfrom ' ... '
  1363.          'COPY 'cfrom ' ' cto  ' > nul '
  1364.      end
  1365. end /* do */
  1366.  
  1367.  
  1368.  
  1369. return 0
  1370.  
  1371.  
  1372.  
  1373.  
  1374. /*****************/
  1375. /* Add an entry to the users.in file */
  1376. add_user:procedure expose ipaddr expose reverse bold normal re_wh cy_ye aesc
  1377.  
  1378. parse arg sdatadir
  1379.  
  1380. say " "
  1381. say  bold " Add a SUPERUSER to the UserName database " normal
  1382. say " "
  1383. say " To facilitate remote configuration, we recommend that you add a "
  1384. say " user, with SUPERUSER privileges, to the SRE-http UserName database."
  1385.  
  1386. ok=yesno(normal'    're_wh' Would you like add a SUPERUSER ')
  1387. say " "
  1388. if ok=0 then do
  1389.  
  1390.     say ' Note: To run the SRE-http configurator, you will need to use a  '
  1391.     say '      browser on the computer with the OWNERS (' ipaddr ")IP address."
  1392.     return 0
  1393. end
  1394.  
  1395. bugs: nop
  1396.  call charout, bold " Enter a username: " normal
  1397.  uname=stringin(,23," ",80)
  1398.  say " "
  1399.  
  1400.  call charout, bold " Enter a password: " normal
  1401.  pwd=stringin(,23," ",80)
  1402.  say " "
  1403.  
  1404.  call charout, bold " Enter a shared-secret:      " normal
  1405.  epwd=stringin(,27," ",80)
  1406.  epwd=translate(epwd)
  1407.  say " "
  1408.  
  1409.  
  1410. if uname="" | pwd="" | epwd='' then do
  1411.     say " missing username or password: please reenter "
  1412.     signal bugs
  1413. end  /* Do */
  1414.  
  1415.  
  1416. /* read users.in, append uname pwd , write it*/
  1417. afile=strip(sdatadir,'t','\')||'\USERS.IN'
  1418. foo=sref_fileread(afile,inl,,'E')
  1419. oof=uname' 'pwd' SUPERUSER ?ENCRYPT:'||epwd
  1420. ii=inl.0+1
  1421. inl.ii=oof
  1422. inl.0=ii
  1423. foo=filewrite(afile,inl,'R')
  1424. if foo=0 then do
  1425.    say " Error: could not modify usernames database file: " afile
  1426. end
  1427. else do
  1428.    say "* If the configurator asks for a username & password, you can use"
  1429.    say bold uname normal " for the username, and " bold pwd normal " for the password "
  1430.    say "* When decrypting, you should use a shared-secret of: "epwd
  1431. end
  1432. return 1
  1433.  
  1434.  
  1435.  
  1436. /* ----------------------------------------------------------------------- */
  1437. /* HOST -- return the result of a HOST command  (a ping )                  */
  1438. /* ----------------------------------------------------------------------- */
  1439. /* This need not be in the main filter program                             */
  1440. /* It returns the GoServe command to send back the result                  */
  1441.   host: procedure
  1442.    parse arg eek
  1443.     do queued(); pull .; end                   /* flush */
  1444.     address cmd '@host' eek '| rxqueue'     /* execute the command */
  1445.     parse pull hostresult                      /* get result */
  1446.     return hostresult
  1447. /*
  1448.     crlf='0d0a'x
  1449.     return 'STRING host' arg(1)':'crlf crlf''hostresult
  1450. */
  1451.  
  1452. /* -------------------- */
  1453. /* get a yes or no , return 1 if yes */
  1454. yesno0:procedure expose normal reverse bold
  1455. parse arg fooa , allopt
  1456. ayn='  '||bold||'Y'||normal||'es\'||bold||'N'||normal||'o'
  1457. if allopt=1 then
  1458.    ayn=ayn||'\'||bold||'A'||normal||'ll'
  1459. do forever
  1460.  foo1=normal||reverse||fooa||normal||ayn
  1461.  call charout,  foo1 normal ':'
  1462.  pull anans
  1463.  if abbrev(anans,'Y')=1 then return 1
  1464.  if abbrev(anans,'N')=1 then return 0
  1465.  if allopt=1 & abbrev(anans,'A')=1 then return 2
  1466.  
  1467. end
  1468.  
  1469. /* -------------------- */
  1470. /* get a yes or no , return 1 if yes */
  1471. yesno:procedure expose normal reverse bold
  1472. parse arg fooa , allopt,altans
  1473. if altans<>" " & words(altans)>1 then do
  1474.    w1=strip(word(altans,1))
  1475.    w2=strip(word(altans,2))
  1476.    a1=left(w1,1) ; a2=left(w2,1)
  1477.    a1a=substr(w1,2) ; a2a=substr(w2,2)
  1478. end
  1479. else do
  1480.     a1='Y' ; a1a='es'
  1481.     a2='N' ; a2a='o'
  1482. end  /* Do */
  1483. ayn='  '||bold||a1||normal||a1a||'\'||bold||a2||normal||a2a
  1484. if allopt=1 then  ayn=ayn||'\'||bold||'A'||normal||'ll'
  1485.  
  1486. do forever
  1487.  foo1=normal||reverse||fooa||normal||ayn
  1488.  call charout,  foo1 normal ':'
  1489.  pull anans
  1490.  if abbrev(anans,a1)=1 then return 1
  1491.  if abbrev(anans,a2)=1 then return 0
  1492.  if allopt=1 & abbrev(anans,'A')=1 then return 2
  1493. end
  1494.  
  1495.  
  1496. /* ------------------------ */
  1497. /* ask for directory name,use defname2 as default */
  1498. /* give user opportunity to create it */
  1499.  
  1500. get_dir:procedure expose normal reverse bold re_wh making
  1501. /* procedure expose reverse normal bold */
  1502. parse arg defname2 , mustsub
  1503. defname0=defname2
  1504.  
  1505. n2:
  1506. call charout ,  reverse ' <ENTER>=' defname2  normal ' ?'
  1507. pull godir
  1508.  
  1509. if godir=" " then godir=defname2
  1510. if godir="n.a." then signal n2
  1511.  
  1512.  
  1513. if mustsub<>"" then do    /* check 'must be subdirectory' option */
  1514.   if abbrev(godir,mustsub)=0 then do
  1515.      say " This directory MUST be under the " mustsub " directory! "
  1516.      say "  .. please re enter ! "
  1517.      signal n2
  1518.   end
  1519. end
  1520.  
  1521. godir=strip(godir,'t','\')
  1522. gdname=godir||"\*.*"
  1523.  
  1524.  
  1525. isme=directory()
  1526.  
  1527. isnew=directory(godir)
  1528. if isnew="" then do
  1529.    say "    Could not find  " godir
  1530.    if yesno(normal"        "re_wh"Would you like to create it")=1 then do
  1531.         making=1
  1532.         oo=sysmkdir2(godir)
  1533.         if oo=0  then
  1534.            say "      Directory created: " godir
  1535.         else do
  1536.            say "      Could not create " godir "(error = " oo
  1537.            if godir=defname2 then defname2= "n.a."
  1538.            signal n2
  1539.         end
  1540.    end
  1541.    else do
  1542.         say " please reenter directory name ... "
  1543.         if godir=defname2 then defname2= "n.a."
  1544.         signal n2
  1545.    end
  1546. end  /* Do */
  1547.  
  1548.  
  1549. isme=directory(isme)
  1550.  
  1551.  
  1552.  
  1553. return godir
  1554.  
  1555. /* ------------- */
  1556. sysmkdir2:procedure
  1557. parse arg adir
  1558.  
  1559. adir=strip(adir,'t','\')
  1560. ff=sysmkdir(adir)
  1561. if ff=0 then return ff
  1562.  
  1563. /* make the tree */
  1564. f2=adir'\'
  1565. dd=filespec('d',f2)
  1566. pp=filespec('p',f2)
  1567. if pp='\' | pp='' then return -1
  1568.  
  1569. pp2=strip(translate(pp,' ','\'))
  1570.  
  1571. do mm=1 to words(pp2)
  1572.    a1=subword(pp2,1,mm)
  1573.    a1=translate(a1,'\',' ')
  1574.    dd2=dd'\'a1
  1575.    hoo=sysmkdir(dd2)
  1576.    if hoo=0 then say ' ... creating: 'dd2  
  1577. end /* do */
  1578.  
  1579. return hoo
  1580.  
  1581.  
  1582. /* ------------- */
  1583. /* ----------------------------------------------------------------------- */
  1584. /* REPLACESTRG: In string astring, find first occurence substring target and
  1585. .   replace it with substring putme
  1586. .      if no target, return unchanged astring
  1587. .      if no putme, then remove target
  1588. .      if type=backward, then find/change LAST occurence
  1589. .      if type=all, find/change all occurences
  1590. .      if exactmatch=yes, then do not capitalize during search (exact match only */
  1591. /* ----------------------------------------------------------------------- */
  1592.  
  1593. replacestrg: procedure
  1594.  
  1595. exactmatch=0
  1596. backward=0 ; doall=0
  1597.  
  1598. parse arg astring ,  target   , putme , type , exactmatch
  1599.  
  1600. type = translate(type)
  1601. if type="BACKWARD" then backward="YES"
  1602. if type="ALL" then doall="YES"
  1603.  
  1604. iat=1
  1605. joelen=length(target)
  1606. joelen2=length(putme)
  1607.  
  1608. doagain:                /* here if doall=yes */
  1609.  if exactmatch="YES" then do
  1610.     if   backward="YES" then
  1611.         joe= lastpos(target,astring)
  1612.     else
  1613.         joe= pos(target,astring,iat)
  1614.  end
  1615.  else do
  1616.    if   backward="YES" then
  1617.         joe= lastpos(translate(target),translate(astring))
  1618.     else
  1619.         joe= pos(translate(target),translate(astring),iat)
  1620.  end
  1621.  if joe=0 then
  1622.          return astring
  1623.  
  1624.  astring=delstr(astring,joe,joelen)
  1625.  if putme<>' ' then
  1626.     astring=insert(putme,astring,joe-1)
  1627.  
  1628.  if doall="YES" then do
  1629.      iat=joe+joelen2
  1630.      signal doagain
  1631.  end
  1632. /* else, all done */
  1633.  return astring
  1634.  
  1635. /* ----------------------------------------------------------------------- */
  1636. /* GRAB_FILE read in a file, but first check to see if openable, and if
  1637. .   openable, open and read it.
  1638. .    Returns with the file, or with 0 if file not obtainable.
  1639. .    Note that file is closed before returning
  1640. .   in,
  1641. .    usage:   afile_string=grab_file(the_file,seconds_to_try_for)
  1642. */
  1643. /* ----------------------------------------------------------------------- */
  1644.  
  1645.  
  1646. grab_file: procedure
  1647.  
  1648. parse arg afile
  1649.  
  1650. ause=stream(afile,'c','open read')
  1651. if ause<>"READY:" then
  1652.   return 0
  1653.  
  1654. ll=stream(afile,'c','query size')
  1655. goo=charin(afile,1,ll)
  1656.  
  1657. /* get rid of ending ctl-z */
  1658. if c2d(right(goo,1))=26 then
  1659.   goo=left(goo,length(goo)-1)
  1660.  
  1661. return goo
  1662.  
  1663.  
  1664. /*******************************************/
  1665. /* copy a file only if it's newer then preexisting version (or
  1666. if no such preexisting version */
  1667. copy_if_newer: procedure 
  1668. parse arg file1, dest1 , amess , noask
  1669.  
  1670. dest2=strip(dest1,'t','\')||'\'
  1671.  
  1672. filename=dest1
  1673. if pos('.',dest1)=0 then filename=dest2||file1
  1674. aa=sysfiletree(filename,isit,'F')
  1675. ok=0
  1676. if aa<>0 then do
  1677.    say " Warning: error when looking for pre-existing copy of: " filename
  1678.    ok=yesno(" Do you want to copy this file (or files) anyways? ")
  1679.    if ok=1 & amess<>""  then
  1680.       ok=yesno(amess)     /* choose to copy */
  1681. end
  1682. if ok=0 then do
  1683.    if isit.0=0 then ok=1                /* no preexisting copy */
  1684. end /* do */
  1685.  
  1686. if ok=0 then do         /* check dates */
  1687.  aa=sysfiletree(dest2,'nn','FT')
  1688.  bb=sysfiletree(file1,'oo','FT')
  1689.  
  1690.  isnn=strip(word(nn.1,1)) 
  1691.  is1=left(isnn,2)
  1692.  if is1<80 then  
  1693.    isnn="20"||isnn
  1694.  else
  1695.     isnn="19"||isnn
  1696.  
  1697.  isoo=strip(word(oo.1,1)) 
  1698.  is1=left(isoo,2)
  1699.  if is1<80 then  
  1700.    isoo="20"||isoo
  1701.  else
  1702.    isoo="19"||isoo
  1703.  
  1704.  if isnn>isoo then ok=1
  1705. end
  1706.  
  1707. if ok=0 then return 0
  1708.  
  1709. 'COPY ' file1 dest1 ' > NUL '
  1710.  
  1711. return 1
  1712.  
  1713.  
  1714.  
  1715. /*******************************************/
  1716. /* check for existence of file, then ask user to copy or not */
  1717. /* note that for X.* type copies, it only checks once
  1718.    (not for each file, but just for any one of them */
  1719. /********************************************/
  1720. check_copy: procedure expose copyall reverse bold normal re_wh
  1721. parse arg file1, dest1 , amess , noask
  1722.  
  1723. dest2=strip(dest1,'t','\')||'\'
  1724.  
  1725. filename=dest1
  1726. if pos('.',dest1)=0 then filename=dest2||file1
  1727.  
  1728.  
  1729. if copyall=1 then signal doit3
  1730.  
  1731. aa=sysfiletree(filename,isit,'F')
  1732. ok=1
  1733. if aa<>0 then do
  1734.    say " Warning: error when looking for pre-existing copy of: " filename
  1735.    ok=yesno(" Do you want to copy this file (or files) anyways? ")
  1736.    if ok=1 & amess<>""  then
  1737.       ok=yesno(amess)
  1738. end
  1739.  
  1740. if noask=1 then signal doit3
  1741.  
  1742. if isit.0>0 then do
  1743.   if pos('*',file1)=0 then do
  1744.       say " "
  1745.       say " A file exists with the name: " filename
  1746.       ok=yesno(" Do you want to overwrite this file? ",1)
  1747.       if ok=1 & amess<>""  then
  1748.            ok=yesno(amess)
  1749.   end
  1750.   else do
  1751.     say " "
  1752.       say " There is at least one file that matches: " filename
  1753.       say "  (this match may " bold " not " normal " be one of the files that will be copied!) "
  1754.       ok=yesno(" Do you want to copy these files? ",1)
  1755.       if ok=1 & amess<>""  then
  1756.            ok=yesno(amess)
  1757.   end  /* Do */
  1758.  
  1759. end
  1760.  
  1761. if ok=2 then do
  1762.   say " "
  1763.   say "SRE-http will overwrite all of its configuration, etc. files. "
  1764.   copyall=yesno(normal"   ..."re_wh" Are you sure you want to do this?")
  1765.   if copyall=0 then
  1766.       ok=yesno(" Do you want to overwrite the current file (or files)? ")
  1767. end
  1768.  
  1769. if ok=0  then return 0
  1770.  
  1771. doit3:          /* jump here if copyall is on, or noask=1 */
  1772. 'COPY ' file1 dest1 ' > NUL '
  1773.  
  1774. return 1
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  /* ------------------------------------------------------------------ */
  1780.  /* function: Check if ANSI is activated                               */
  1781.  /*                                                                    */
  1782.  /* call:     CheckAnsi                                                */
  1783.  /*                                                                    */
  1784.  /* where:    -                                                        */
  1785.  /*                                                                    */
  1786.  /* returns:  1 - ANSI support detected                                */
  1787.  /*           0 - no ANSI support available                            */
  1788.  /*          -1 - error detecting ansi                                 */
  1789.  /*                                                                    */
  1790.  /* note:     Tested with the German and the US version of OS/2 3.0    */
  1791.  /*                                                                    */
  1792.  /*                                                                    */
  1793.  CheckAnsi: PROCEDURE
  1794.    thisRC = -1
  1795.  
  1796.    trace off
  1797.                          /* install a local error handler              */
  1798.    SIGNAL ON ERROR Name InitAnsiEnd
  1799.  
  1800.    "@ANSI 2>NUL | rxqueue 2>NUL"
  1801.  
  1802.    thisRC = 0
  1803.  
  1804.    do while queued() <> 0
  1805.      queueLine = lineIN( "QUEUE:" )
  1806.      if pos( " on.", queueLine ) <> 0 | ,                       /* USA */
  1807.         pos( " (ON).", queueLine ) <> 0 then                    /* GER */
  1808.        thisRC = 1
  1809.    end /* do while queued() <> 0 */
  1810.  
  1811.  InitAnsiEnd:
  1812.  signal off error
  1813.  RETURN thisRC
  1814.  
  1815.  
  1816.  
  1817.  
  1818. /* get the hostname (aa.bb.cc) for this machine */
  1819. get_hostname: procedure expose re_wh
  1820.     do queued(); pull .; end                   /* flush */
  1821.     address cmd '@hostname | rxqueue'
  1822.  
  1823.     parse pull hostname
  1824.     return hostname
  1825.  
  1826.  
  1827. set_params:procedure expose adefault aautoname awebmaster arealm ahomename assi ,
  1828.                 CY_YE BOLD NORMAL REVERSE thishost assicache ahomedir re_wh
  1829.  
  1830. /* Set some  "common parameters" */
  1831. enterparams:
  1832. say " If you like, you can customize a few of the initialization parameters."
  1833. say " If you choose not to, default values will be used "
  1834. adefault='INDEX.SHTML INDEX.HTML INDEX.SHT INDEX.HTM '
  1835. aautoname=' *.HTML *.HTM  INDEX.HTML INDEX.HTM !CREATE '
  1836. awebmaster='The Webmaster '
  1837. parse var thishost  arealm '.' .
  1838. assi=0
  1839. ahomename='Our WWW site '
  1840. ahomedir='homedir/'
  1841. assicache='1'
  1842. ok=yesno(normal"   "re_wh'Would you like to customize a few initialization parameters')
  1843.  
  1844. if ok=1 then do
  1845.     say ' You will be asked to enter the values of several "initialization" parameters.'
  1846.     say ' You can edit the default values by using arrow keys, etc. '
  1847.    say ' '
  1848.  
  1849.    say bold "DEFAULT" normal " should be a (list of) HTML document to use as your site's Home Page. "
  1850.    say "    The " bold "DEFAULT" normal "is used when requests to the root directory "
  1851.    say "    of your server are recieved (that is, empty request selectors, "
  1852.    say "    as would be  generated by a URL of  http://xxx.yy.zzz/ )"
  1853.    thedef=adefault
  1854.     say reverse "DEFAULT? " normal
  1855.     adefault=stringin(,2,thedef,70)
  1856.     say " "
  1857.     say " "
  1858.  
  1859.    say bold "AUTO_NAME" normal " should contain a list of HTML documents that may be used as"
  1860.    say " the default document for a directory. These are used when requests to the "
  1861.    say " root of a" bold "directory" normal " are recieved. "
  1862.    say " For example: a URL of " bold " http://xxx.yy.zzz/books/classics/ " normal
  1863.    say "              would generate a request selector of: " bold "books/classics " normal
  1864.    say "              -- and SRE-http would use AUTO_NAME to determine which file "
  1865.    say "                 (in the books/classics/ subdirectory) to use. "
  1866.    thedef="INDEX.SHT INDEX.SHTML INDEX.HTM INDEX.HTML "
  1867.     say reverse "AUTO_NAME? " normal
  1868.     fooauto=stringin(,2,thedef,70)
  1869.     aautoname=fooauto
  1870.     say " "
  1871.     say " Before trying these files, SRE-http can look for  dirname.HTML (and .SHTML, "
  1872.     say " .HTM, and .SHT); where " bold "dirname" normal 'is the last subdirectory name '
  1873.     say "      For example, using the above example ( " bold " books/classics/" normal
  1874.     say "      SRE-http would first look for " bold "CLASSICS.HTML" normal "(& CLASSICS.SHTML, etc.)"
  1875.     if length(fooauto) < 30 then do
  1876.         say "    ("fooauto " would be tried only if CLASSICS.HTML (etc.)  "
  1877.         say "     did not exist)"
  1878.     end
  1879.     else do
  1880.         say "       ("fooauto
  1881.         say "        would be tried only if CLASSICS.HTML (etc.) did not exist)"
  1882.     end  /* Do */
  1883.     isdname=yesno(' Should SRE-http attempt this "directory name matching"?')
  1884.     if isdname=1 then aautoname="*.HTML *.SHTML *.HTM *.SHT "||aautoname
  1885.     say " Lastly, if none of the above work, SRE-http can display a list "
  1886.     say " of files and subdirectories. "
  1887.     isflist=yesno(' When all else fails, should SRE-http display a file listing?')
  1888.     if isflist=1 then aautoname=aautoname||' !CREATE '
  1889.     if isflist=1 then
  1890.         say " Note: by default, this file listing will NOT contain descriptions. "
  1891.     say ' '
  1892.  
  1893.  
  1894.     say  bold " WEBMASTER " normal " should contain the name (and address) of a contact person. "
  1895.     thedef=' <a href="mailto:webmaster@'thishost'">The WebMaster</a> '
  1896.     say reverse " WEBMASTER? " normal
  1897.     awebmaster=stringin(,2,thedef,80)
  1898.     awebmaster=replacestrg(awebmaster,"'","''",'ALL')
  1899.  
  1900.     say " ";say " "
  1901.  
  1902.     say bold " THE_REALM " normal "is used as your site's default " bold " realm. " normal
  1903.     say "       (the" bold "Realm" normal "is displayed when clients are asked to  "
  1904.     say "        enter a username and password). "
  1905.     parse var thishost thedef '.'
  1906.     say reverse " THE_REALM? " normal
  1907.     arealm=stringin(,2,thedef,40)
  1908.     arealm=replacestrg(arealm,"'","''",'ALL')
  1909.  
  1910.     say " "
  1911.     say " "
  1912.  
  1913.     say  bold " SSI_SHTML_ONLY " normal "is used to limit " bold " server side includes"
  1914.     say  normal  " to files that have " bold ' .SHTML ' normal "(or " bold " .SHT" normal ") extensions. "
  1915.     say  "      If SSI_SHTML_ONLY is not turned on, then all HTML document will "
  1916.     say  "      be checked for " bold "server side includes. " normal
  1917.     assi=yesno(' Only check .SHTML and .SHT files for server side includes? ')
  1918.     assi=word('NO YES',assi+1)
  1919.     say " "
  1920.  
  1921.  
  1922.     say  bold " SSI_CACHE_ON " normal "is used to enable the "bold"SSI-cache."normal
  1923.     say "The  "bold"SSI-cache"normal" is used to store pre-compiled versions of HTML documents "
  1924.     say "that contain server side includes (SSIs). When appropriate, "
  1925.     say "SRE-http will return these documents (perhaps with further modifications)."
  1926.     say  "    The use of the " bold"SSI-CACHE"normal" can significantly improve "
  1927.     say  "    response time. However, on very dynamic sites, there is a small "
  1928.     say  "    chance that an out-of-date document will be returned.  "
  1929.     assicache=yesno(' Enable the SSI-CACHE (YES), or disable it (NO)? ')
  1930.     assicache=word('NO YES',assicache+1)
  1931.     say " " ; say " "
  1932.  
  1933.     say   bold " HOME_NAME " normal " should contain the colloquial name of your site."
  1934.     say  bold "        HOME_NAME " normal "  is used in certain descriptive responses,  "
  1935.     say       "         such as when a client asks for a non-existent file. "
  1936.     thedef="Our WWW site "
  1937.     say reverse " HOME_NAME? " normal
  1938.     ahomename=stringin(,2,thedef,70)
  1939.     ahomename=replacestrg(ahomename,"'","''",'ALL')
  1940.  
  1941.     say " " ;    say " "
  1942.  
  1943.     say   bold " HOME_DIR " normal " should contain which subdirectory (of your Goserve "
  1944.     say   "  directory) to use  when resolving requests containing a ~ character. "
  1945.     say   '  For example, if ' bold ' HOME_DIR=students/personal/ ' normal
  1946.     say   '  then a request selector of ~gerry.htm' normal 'would be equivalent '
  1947.     say   '  to ' bold 'students/personal/gerry.htm ' normal
  1948.     thedef="HOMEDIR/ "
  1949.     say reverse " HOME_DIR " normal
  1950.     ahomedir=stringin(,2,thedef,40)
  1951.     say " "
  1952.     say " "
  1953.  
  1954.   say  cy_ye " You have chosen the following settings: " normal
  1955.   say  " " reverse "DEFAULT:" normal adefault
  1956.   say  " " reverse "AUTO_NAME:" normal fooauto
  1957.  
  1958.   select
  1959.    when isdname=1 & isflist=1 then
  1960.      say          "         (with dirname.HTML, etc. checking, and file-listing if all else fails)"
  1961.    when isdname=1 then
  1962.      say          "            (with dirname.HTML checking)"
  1963.    when isflist=1 then
  1964.      say          "            (with file-listing if none of these exists)"
  1965.    otherwise
  1966.      nop
  1967.   end
  1968.   say " " reverse "HOME_DIR:" normal ahomedir
  1969.   say " " reverse "WEBMASTER:" normal awebmaster
  1970.   say " " reverse "THE_REALM:" normal arealm
  1971.   say " " reverse "HOME_NAME:" normal ahomename
  1972.   say " " reverse "SSI_SHTML_ONLY:" normal  assi
  1973.   say " " reverse "SSI_CACHE_ON:" normal  assicache
  1974.  
  1975.   say " "
  1976.   foo=yesno(" Are these okay? ")
  1977.   if foo=0 then signal enterparams
  1978. end
  1979. return 0
  1980.  
  1981.  
  1982. /*************/
  1983. /* unzip stuff */
  1984. suzunzip:procedure
  1985. parse arg adir,azip
  1986.  
  1987. signal on error name foobar1
  1988. signal on syntax name foobar1
  1989. say " Unzipping " azip
  1990.  
  1991. hh=strip(adir,'t','\')
  1992. hh2=hh'\'azip
  1993.  
  1994. rc=uzunzip(' -q -o 'hh2 ' -d 'hh,foos)
  1995.  
  1996. return 1
  1997.  
  1998. foobar1:
  1999. signal off error ;signal off syntax
  2000. say "  >> could not use unzip procedure, trying UNZIP.EXE instead...."
  2001. /* if here, problem. try using unzip */
  2002. aa='UNZIP -q -o 'hh2 ' -d 'hh
  2003. address cmd aa
  2004.  
  2005. if rc<>0 then do
  2006.    say " Problem with UNZIP, error= " rc
  2007.    return 0
  2008. end /* do */
  2009.  
  2010. return 1
  2011.  
  2012.  
  2013. /******/
  2014. get_goserve_dir:
  2015. parse arg chk
  2016.  
  2017. say ' ' 
  2018. call lineout, bold  " What is GOSERVE's "working" directory? " normal
  2019. say "    *  The SRE-http program files will be written there. "
  2020. say "    *  This does "bold"not"normal"  have to be the directory that contains GOSERVE.EXE"
  2021.  
  2022. n1:
  2023. godir=get_dir(defname)
  2024.  
  2025. if godir=" " then godir=defname
  2026. if godir="n.a." then signal n1
  2027.  
  2028. godir=strip(godir,'t','\')
  2029. gsname=godir||"\GOSERVE.EXE"
  2030.  
  2031. call sysfiletree gsname,gname2,'F'
  2032. if gname2.0=0 then do
  2033.    say " Note: GOSERVE.EXE is not currently installed in "godir
  2034. end  /* Do */
  2035.  
  2036. if chk=0 then return ''         /* new install, no need to check for /cggs */
  2037.  
  2038. oo=stream(godir'\cfgs\initfilt.80','c','query exists')
  2039. if oo='' then do
  2040.    oo2=stream(godir'\initfilt.80','c','query exists')
  2041. end /* do */
  2042. select 
  2043.    when oo2='' & oo='' then do
  2044.        say 'Warning: could not find INITFILT.80 in 'Godir
  2045.        say bold' Are you sure this is the correct directory??' 
  2046.        exit
  2047.    end /* do */
  2048.    when oo='' then do
  2049.        say
  2050.        say "        "cy_ye' ------------ Recommendation:'normal
  2051.        say "   As of ver 1.3.0399e, we highly recommend moving all of your "
  2052.        say '   configuration files (including INITFILT.80) to 'godir'\cfgs'
  2053.        say bold' Please see the upgraders notes for more details! 'normal
  2054.        say "   ... hit any key to continue ";
  2055.        foo=SYSGETKEY("NOECHO")
  2056.    end /* do */
  2057.    otherwise nop
  2058. end
  2059.  
  2060. return ' '
  2061.  
  2062. /*** not currently used 
  2063. if useoo='' then return ''
  2064. say "    INSTALL can read file & dir info from: "useoo
  2065. aav=yesno(normal'   'bold' Use Defaults (D), or Read info from INITFILT.80 (R):',,'D R')
  2066. if aav=1 then return ''
  2067. return useoo
  2068. *****/
  2069.  
  2070.  
  2071.  
  2072. /**********/
  2073. get_www_dir:
  2074.  
  2075. say " "
  2076. call lineout, cy_ye" + + + + "normal BOLD " What is your data directory ?" normal
  2077. say  '    .. this is  the location of your "home page" document. '
  2078.  
  2079. datadir=get_dir(defname2)
  2080.  
  2081. return 0
  2082.  
  2083. /*********/
  2084. get_ip_address:
  2085. say "What is your IP address (it will be given OWNERS status)"
  2086. ipaddr=" "
  2087. thishost=get_hostname()
  2088. sagain:
  2089. call charout , BOLD "What is your IP address (ENTER="thishost "):? " normal
  2090. pull youraddr
  2091. if youraddr=' ' then youraddr=thishost
  2092.  
  2093. parse var youraddr t1 '.' .
  2094. isnum=0
  2095. if  datatype(t1)='NUM' then
  2096.   isnum=1
  2097. say " wait while that address is checked ... "
  2098. chk=host(youraddr)
  2099. if translate(word(chk,2))<>"IS" &  word(chk,2)<>"=" then do
  2100.     call lineout,re_wh " Unable to find  address: " youraddr normal
  2101.     say "    OWNER variable not assigned (but you can assign it later)"
  2102.     ipaddr=" "
  2103. end  /* Do */
  2104. else do
  2105.    if isnum then
  2106.      ipaddr=word(chk,1)
  2107.    else
  2108.      ipaddr=word(chk,3)
  2109.  
  2110.    say " Your IP address: " ipaddr
  2111. end
  2112. return 0
  2113.  
  2114. /***************/
  2115. init_it:
  2116.  
  2117. /* Load up advanced REXX functions */
  2118. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  2119. call SysLoadFuncs
  2120.  
  2121. nowdir=directory()
  2122.  
  2123. initfilt_file=''
  2124. init_sta_file=''
  2125. copyall=0
  2126. echo off
  2127.  
  2128.  
  2129. /* --- Load the tcp/ip function library, if necessary --- */
  2130. if RxFuncQuery("SockLoadFuncs")=1 then  do    /* not there */
  2131.   call RxFuncAdd "SockLoadFuncs","rxSock","SockLoadFuncs"
  2132.   call SockLoadFuncs
  2133. end
  2134.  
  2135. thishost=' '
  2136.  
  2137.  
  2138. parse version  atype .
  2139. if atype<>"REXXSAA" then do
  2140.  say    " WARNING: SRE-http ver 1.3h is designed to work under Classic Rexx "
  2141.  say     " In particular, it does NOT work under Object Rexx. "
  2142.  say     " Other versions of REXX, such as Quercus's REXX, have not been tested."
  2143.  say " Note: You are using REXX version: " atype
  2144.  say " (hit ENTER to continue) "
  2145.   pull .
  2146. end  /* Do */
  2147.  
  2148.  
  2149. dropunz=0 ;
  2150. foo=rxfuncquery('UZLoadFuncs')   /* load UNZIP dll */
  2151. if foo=1 then do
  2152.   dropunz=1
  2153.   call RxFuncAdd 'UZLoadFuncs', 'UNZIPAPI', 'UZLoadFuncs'
  2154.   call UZLoadFuncs
  2155. end
  2156. foo=rxfuncquery('UZLoadFuncs')
  2157. gotunz=1
  2158. if foo=1 then do
  2159.     say " Can not find UNZIP procedure library: UNZIPAPI.DLL"
  2160.     say "  Did you download it? "
  2161.     say " (hit ENTER to continue)"
  2162.     parse pull gunk
  2163.     gotunz=0 ; dropunz=0
  2164. end  /* Do */
  2165.  
  2166. /*---- load the rexxlib library */
  2167. droprxlib=0 ; gotrxlib=1
  2168. foo=rxfuncquery('rexxlibregister')
  2169. if foo=1 then do
  2170.  droprxlib=1 ; gotrxlib=0
  2171.  call rxfuncadd 'rexxlibregister','rexxlib', 'rexxlibregister'
  2172.  call rexxlibregister
  2173. end
  2174. foo=rxfuncquery('rexxlibregister')
  2175. if foo=1 then do
  2176.     say " Could not find the REXXLIB procedure library (REXXLIB.DLL). "
  2177.     say "  Did you download it? "
  2178.     exit
  2179. end  /* Do */
  2180.  
  2181. if rxfuncquery('sref_fileread')<>0 then do
  2182.   ik=rxfuncadd('sref_fileread','rexxlib','LIB_FILEREAD')
  2183.   if ik<>0 then call pmprintf_sref(' SRE-http Monitor: Warning: unable to register SREF_FILEREAD')
  2184. end
  2185.  
  2186. ansion=checkansi()
  2187. if ansion=1 then do
  2188.   aesc='1B'x
  2189.   cy_ye=aesc||'[38;46;m'
  2190.   normal=aesc||'[0;m'
  2191.   bold=aesc||'[1;m'
  2192.   re_wh=aesc||'[31;47;m'
  2193.   reverse=aesc||'[7;m'
  2194. end
  2195. else do
  2196.   say " Warning: Could not detect ANSI....  Install will look ugly ! "
  2197.   cy_ye="" ; normal="" ; bold="" ;re_wh="" ;
  2198.   reverse=""
  2199. end  /* Do */
  2200.  
  2201. /* some defaults */
  2202.     datadir="your GoServe Data-directory"
  2203.     workdir="your GoServe Working-directory"
  2204.    workdir_notset=1
  2205.     helpdir='the SAMPLES/ subdirectory of the GoServe Data-directory'
  2206.     useindex='  '
  2207.  
  2208.  
  2209. return 0
  2210.  
  2211.  
  2212. /*********/
  2213. check_macro:
  2214. if macroquery('SREF_VERSION')<>"" then do
  2215.      say " "
  2216.      say bold "A prior version of the SRE-http macrospace  procedures " normal " was detected."
  2217.      say " We recommend clearing macrospace before you install SRE-http."
  2218.      say " However, this might adversely impact other programs (that may also "
  2219.      say " use REXX's macrospace). "
  2220.      ok=yesno(" Clear macrospace now (Y) ?")
  2221.      if ok=1 then do
  2222.         say " .... clearing macrospace "
  2223.         foo=macroclear()
  2224.         say " "
  2225.      end  /* Do */
  2226.      else do
  2227.           say " "
  2228.         say  bold " Macrospace will not be cleared. " normal
  2229.         say " When you are ready to run GOSERVE with SRE-http, we recommend "
  2230.         say " that you first reboot your server (otherwise SRE-http will,"
  2231.         say " inappropriately, attempt to use the old procedure library)."
  2232.           say " "
  2233.      end  /* Do */
  2234. end  /* Do */
  2235. return 0
  2236.  
  2237.  
  2238. /************/
  2239. make_def_dirs:
  2240. parse arg checkcfg
  2241.  
  2242.     adir=filespec("drive",nowdir)
  2243.     defname=adir||'\GOSERVE'
  2244.     defname2=adir||'\WWW'
  2245.     call get_goserve_dir checkcfg  /* but ask for a few directories */
  2246.     useoo=result
  2247.     gmaking=making
  2248.  
  2249.     call get_www_dir
  2250.     workdir=godir
  2251.     addon_dir=workdir'\addon'
  2252.     sdatadir=workdir||'\DATA'
  2253.     mboxdir=workdir||'\MESSAGE'
  2254.     cgibin_dir=workdir||'\cgi-bin'
  2255.     lib_dir=workdir||'\lib'
  2256.     gifdir=datadir'\imgs'
  2257.     digitsdir=datadir'\digits'
  2258.     tempdir=datadir'\temp'
  2259.  
  2260.     helpdir=datadir'\samples'
  2261.     config_dir=workdir'\configs'
  2262.     cfgsdir=workdir'\cfgs'
  2263.  
  2264.     upload_dir=workdir'\upload'
  2265.     tempdatadir=workdir'\temp'
  2266.     mailboxdir=workdir'\MAIL'
  2267.     userinfodir=workdir'\userinfo'
  2268.     workdir_notset=0
  2269.     gosds='TEMP TEMP\DELTAS DATA  DATA\OLDDATA MESSAGE MAIL CONFIGS LIB UPLOAD CGI-BIN ADDON USERINFO CFGS CFGS\OLDCFGS'
  2270.     wwwds='IMGS DIGITS SAMPLES TEMP'
  2271.     do ii=1 to words(gosds)
  2272.        a1=strip(word(gosds,ii))
  2273.        mdd=workdir'\'a1
  2274.        if dosisdir(mdd)=0 then do
  2275.           oo=sysmkdir(mdd)
  2276.           if oo<>0 then do 
  2277.             say 'ERROR: Could not create 'mdd ', error code= ' oo
  2278.             exit
  2279.          end /* do */
  2280.        end
  2281.     end /* do */
  2282.     do ii=1 to words(wwwds)
  2283.        a1=strip(word(wwwds,ii))
  2284.        mdd=datadir'\'a1
  2285.        if dosisdir(mdd)=0 then do
  2286.           oo=sysmkdir(mdd)
  2287.           if oo<>0 then do then
  2288.             say 'ERROR: Could not create 'mdd ', error code= ' oo
  2289.             exit
  2290.           end /* do */
  2291.        end
  2292.     end /* do */
  2293. return useoo
  2294.  
  2295.  
  2296.  
  2297. /************/
  2298. read_initfilt_dirs:
  2299. parse arg theinit
  2300.  
  2301. isz=stream(theinit,'c','query size')
  2302. if isz='' | isz=0 then do
  2303.     say "ERROR: could not find "theinit
  2304.     exit
  2305. end /* do */
  2306.  
  2307. aa=stream(theinit,'c','open read')
  2308. if abbrev(translate(aa),'READY')=0 then do
  2309.    say "UNABLE TO OPEN: " theinit
  2310.    exit
  2311. end /* do */
  2312. goop=charin(theinit,1,isz)
  2313. foo=stream(theinit,'c','close')
  2314.  
  2315. crlf='0d0a'x
  2316. do forever
  2317.    if goop='' then leave
  2318.    parse var goop aline (crlf) goop
  2319.    aline=strip(aline)
  2320.    if abbrev(aline,';')=1 then iterate
  2321.    if aline=''  then iterate
  2322.    parse var aline avar '=' avalue ; avar=strip(translate(avar))
  2323.    avalue=translate(space(translate(avalue,' ',"'"||'"'),0))
  2324. say avar 
  2325.    select   
  2326.       when avar='ADDON_DIR' then addon_dir=avalue
  2327.       when avar='WORKDATA_DIR' then sdatadir=avalue
  2328.       when avar='MESSBOX_DIR' then mboxdir=avalue
  2329.       when avar='CGI_BIN_DIR' then cgibin_Dir=avalue
  2330.       when avar='TEMPFILE_DIR' then tempdir=avalue
  2331.       when avar='CFGS_DIR' then cfgsdir=avalue
  2332.       when avar="MAILBOX_DIR" then mailboxdir=avalue
  2333.       when avar="USERINFO_DIR" then userinfodir=avalue
  2334.    otherwise nop
  2335.    end  /* select */
  2336. end
  2337. return 1
  2338.  
  2339. /*********************************/
  2340. /* display the disclaimer */
  2341.  
  2342. show_disclaim:
  2343. say
  2344. say reverse "          Summary of the SRE-http disclaimer"normal
  2345. say bold"The complete disclaimer is  contained in READ.ME"normal
  2346. say "  With some provisos, permission to use this program for any "
  2347. say "  purpose is hereby granted without fee. These provisos include:" 
  2348. say "   * the author's name may not be used in advertising or "
  2349. say "     publicity pertaining to distribution of the software "
  2350. say "     without specific written prior permision."
  2351. say "   * The authors of SRE-http, and any potentially affiliated institutions,"
  2352. say "     disclaim any and all liability for damages due to the use, misuse, or"
  2353. say "     failure of this product or related products."
  2354. say "         In particular, SRE-http and related products are NOT "
  2355. say "         guaranteed to be secure.  Although we design and code our "
  2356. say "         product with attention to potential security holes, "
  2357. say "         we can NOT guarantee security."
  2358.  
  2359.     call charout , cy_ye ' (hit any key to continue) ' normal
  2360.     foo=SYSGETKEY("NOECHO")
  2361. say
  2362. return
  2363.