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