home *** CD-ROM | disk | FTP | other *** search
/ Enter 1999 April - Disc 1 / enter_04_1999_1.iso / OS2 / XFREE86 / XBASE.ZIP / XFree86 / bin / checkinstall.cmd next >
Encoding:
Text File  |  1998-11-15  |  20.6 KB  |  665 lines

  1. /* OS/2 REXX */
  2. /* Copyright (C)1996 by Holger.Veit@gmd.de */
  3. /* This utility checks whether you have set up your XFree86/OS2 correctly
  4.  */
  5. '@echo off'
  6. ADDRESS CMD
  7. parse arg OS2BootDrive
  8. OS2BootDrive = substr( translate( strip( OS2BootDrive ) ),1,2 )
  9. if OS2BootDrive <> '' then
  10.     if stream( OS2BootDrive || '\CONFIG.SYS', 'c', 'QUERY EXIST' ) = '' then
  11.     do
  12.         /* show the usage                             */
  13.         say 'Usage: checkinstall {os2BootDrive}'
  14.         say ''
  15.         say 'Default: Search the OS/2 boot drive'
  16.         exit 1
  17.     end /* if stream( ... */
  18.  
  19. /* IF POS(':',OS2BootDrive)=0 THEN OS2BootDrive=OS2BootDrive':' */
  20.  
  21. /* signal on halt name UserAbort */
  22. signal on syntax name RexxUtilNotFound
  23.  
  24. /*say ' Loading REXXUTIL ... '*/
  25.   
  26. /* load REXXUTIL                              */
  27. call rxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  28. call SysLoadFuncs
  29.  
  30. /* turn on the default error handler again    */
  31. signal off Syntax
  32.  
  33. /* search the OS/2 boot drive                 */
  34. if OS2BootDrive = '' then
  35. do
  36.     say ' Searching the boot drive. Please wait ...'
  37.     OS2BootDrive = SearchbootDrive()
  38.  
  39.     say ' ... Bootdrive "' || OS2BootDrive || '" found.'
  40. end /* if OS2BootDrive = '' then */
  41.  
  42.  
  43. env = 'OS2ENVIRONMENT'
  44. errcnt = 0
  45. warncnt = 0
  46. runxconfig = 0
  47. DateSep = SysIni(,'PM_National','sDate') /* '.' in German and '-' in US OS/2. */
  48.                                          /* Change this if your CMD.EXE doesn't handle this correctly. */
  49. DateSep = LEFT(DateSep, 1)    /* SysIni return '. ' instead of '.' ?!? */
  50.  
  51. HPFSDirCol = 41 /* usually a dir on HPFS drives shows the name of a file starting with Column 41 */
  52.         /* It would be better to perform a dir, queue it, parse it and thus determine the */
  53.         /* correct column. */
  54. HPFSDirIdentCol = 22 /* where '<DIR>' starts - see above */
  55.  
  56. x11root = VALUE('X11ROOT',,env)
  57. CALL envexchk '001','X11ROOT','c:'
  58. CALL direxchk '002','X11ROOT'
  59. CALL direxchk1 '003',x11root'/XFree86/bin','X11ROOT'
  60. CALL direxchk1 '004',x11root'/XFree86/lib','X11ROOT'
  61. CALL direxchk1 '005',x11root'/XFree86/lib/X11','X11ROOT'
  62. CALL fwdslchk '006','X11ROOT'
  63. CALL hpfschk '007','X11ROOT'
  64.  
  65. CALL envexchk '010','HOME','c:\home\x11user'
  66. CALL direxchk '011','HOME'
  67. CALL backslchk '012','HOME'
  68. CALL hpfschk '013','HOME'
  69. CALL casechk '014','HOME'
  70.  
  71. etc = VALUE('ETC',,env)
  72. CALL envexchk '020','ETC','c:\tcpip\etc'
  73. CALL direxchk '021','ETC'
  74. CALL backslchk '022','ETC'
  75. CALL filexchk '023',etc'\hosts','ETC'
  76.  
  77. tmp = VALUE('TMP',,env)
  78. CALL envexchk '030','TMP','f:\tcpip\tmp'
  79. CALL direxchk '031','TMP'
  80. CALL backslchk '032','TMP'
  81. CALL trailchk '033','TMP'
  82. CALL hpfschk '034','TMP'
  83.  
  84. hostname = VALUE('HOSTNAME',,env)
  85. CALL envexchk '040','HOSTNAME','myhost'
  86. CALL envexchk '041','USER','user123'
  87. CALL envexchk '042','LOGNAME','user123'
  88. user = VALUE('USER',,env)
  89. logname = VALUE('LOGNAME',,env)
  90. CALL userchk1 '043',user,logname
  91.  
  92. termcap = VALUE('TERMCAP',,env)
  93. CALL envexchk '050','TERMCAP','d:/emx/etc/termcap.x11'
  94. CALL filexchk '051',termcap,'TERMCAP'
  95. CALL fwdslchk '052','TERMCAP'
  96. term = VALUE('TERM',,env)
  97. CALL envexchk '053','TERM','ansi'
  98. CALL termcapchk1 termcap,term    /* 054,055 */
  99.  
  100. xserver = VALUE('XSERVER',,env)
  101. CALL envexchk '060','XSERVER','D:/XFree86/bin/XF86_SVGA.EXE'
  102. CALL filexchk '061',xserver,'XSERVER'
  103. CALL fwdslchk '062','XSERVER'
  104.  
  105. CALL envexchk '070','DISPLAY','myhost:0.0'
  106. CALL dispchk    /* 071,072,073 */
  107.  
  108. CALL hostchk /* 080,081 */
  109. CALL pathchk '082','xf86config.exe',x11root'\XFree86\bin'
  110. CALL libpathchk '083','xaw.dll',x11root'\XFree86\lib'
  111. CALL localchk /* 084,085 */
  112.  
  113. CALL manpathchk /* 090,091 */
  114. CALL xconfigchk /* 092,100 */
  115. CALL emxchk /* 093,094,095,096 */
  116. CALL xf86supchk /* 097,098,099 */
  117.  
  118. SAY ""
  119. SAY ""
  120. IF errcnt=0 THEN DO
  121.     CALL BEEP 440,250
  122.     SAY "***CHECK: Your system seems to be setup correctly for XFree86/OS2"
  123.     IF warncnt > 0 THEN DO
  124.         SAY "          however, you should look at the warnings."
  125.     END
  126.     CALL xconfig
  127. END 
  128. ELSE DO
  129.     CALL BEEP 440,250
  130.     SAY "***CHECK: There were "errcnt" error(s) detected. Please correct them"
  131.     SAY "   before attempting to run XFree86/OS2."
  132.     IF runxconfig=1 THEN DO
  133.         SAY ""
  134.         SAY "***CHECK: xf86config won't be run, because errors were found."
  135.     END
  136. END
  137.  
  138. EXIT 0
  139.  
  140. /* helper functions */
  141.  
  142. notexists_file: PROCEDURE
  143.     ARG file
  144.     IF file='' THEN RETURN 0
  145.     RETURN STREAM(file,'C','QUERY EXISTS') = ''
  146.  
  147. exists_file: PROCEDURE
  148.     ARG file
  149.     IF file='' THEN RETURN 0
  150.     RETURN STREAM(file,'C','QUERY EXISTS') \= ''
  151.  
  152. notexists_dir: PROCEDURE
  153.     ARG dir
  154.     direc = TRANSLATE(dir,'\','/')
  155.     'DIR "'direc'" >NUL 2>&1'
  156.     IF RC = 0 THEN RETURN 0
  157.     RETURN 1
  158.  
  159. notbackslash: PROCEDURE
  160.     ARG path
  161.     IF POS('/',path) = 0 THEN RETURN 0
  162.     RETURN 1
  163.  
  164. notfwdslash: PROCEDURE
  165.     ARG path
  166.     IF POS('\',path) = 0 THEN RETURN 0
  167.     RETURN 1
  168.  
  169. backslchk: PROCEDURE EXPOSE env errcnt
  170.     ARG err,var
  171.     envvar = VALUE(var,,env)
  172.     IF envvar='' THEN RETURN
  173.     IF notbackslash(envvar) THEN DO
  174.         SAY "***XFERR"err": The "envvar" directory (derived from variable "var")"
  175.         SAY "   must have backslashes as a directory separator."
  176.         SAY "   Please correct this."
  177.         errcnt = errcnt+1
  178.     END
  179.     RETURN
  180.  
  181. fwdslchk: PROCEDURE EXPOSE env errcnt
  182.     ARG err,var
  183.     envvar = VALUE(var,,env)
  184.     IF envvar='' THEN RETURN
  185.     IF notfwdslash(envvar) THEN DO
  186.         SAY "***XFERR"err": The "envvar" directory (derived from variable "var")"
  187.         SAY "   must have forward slashes as a directory separator."
  188.         SAY "   Please correct this."
  189.         errcnt = errcnt+1
  190.     END
  191.     RETURN
  192.  
  193. direxchk: PROCEDURE EXPOSE env errcnt
  194.     ARG err,var
  195.     envvar = VALUE(var,,env)
  196.     if notexists_dir(envvar) THEN DO
  197.         SAY "***XFERR"err": The directory specified in the variable "var" does not exist"
  198.         SAY "   Please create it or specify another directory in the variable"
  199.         errcnt = errcnt+1
  200.     END
  201.     RETURN
  202.  
  203. direxchk1: PROCEDURE EXPOSE env errcnt
  204.     ARG err,dir,var
  205.     if notexists_dir(dir) THEN DO
  206.         SAY "***XFERR"err": The directory "dir" (derived from variable "var")"
  207.         SAY "   does not exist."
  208.         SAY "   Your XFree86 installation seems to be incomplete."
  209.         errcnt = errcnt+1
  210.     END
  211.     RETURN
  212.  
  213. envexchk: PROCEDURE EXPOSE env errcnt
  214.     ARG err,var,val
  215.     envvar = VALUE(var,,env)
  216.     IF envvar='' THEN DO
  217.         SAY "***XFERR"err": The environment variable "var" is not set."
  218.         SAY "   Please set it in CONFIG.SYS, for example:"
  219.         SAY "       SET "var"="val
  220.         errcnt = errcnt+1
  221.     END
  222.     RETURN
  223.  
  224. filexchk: PROCEDURE EXPOSE env errcnt
  225.     ARG err,file,var
  226.     if notexists_file(file) THEN DO
  227.         SAY "***XFERR"err": The file "file" (derived from variable "var")"
  228.         SAY "   does not exist. Please create one."
  229.         errcnt = errcnt+1
  230.     END
  231.     RETURN
  232.  
  233. filexchk1: PROCEDURE EXPOSE env errcnt
  234.     ARG err,file
  235.     file1 = WORD(TRANSLATE(file,' ','/'),1)
  236.     if notexists_file(file1) THEN DO
  237.         SAY "***XFERR"err": The file "file1" (derived from DEVICE section)"
  238.         SAY "   does not exist. You must install it."
  239.         errcnt = errcnt+1
  240.     END
  241.     RETURN
  242.  
  243. nothpfs: PROCEDURE
  244.     ARG dir
  245.     testfile = TRANSLATE(dir,'\','/')
  246.     IF LENGTH(testfile) \= LASTPOS('\',testfile) THEN testfile=testfile||'\'
  247.     testfile = testfile||'very.long.file.name'
  248.     CALL LINEOUT testfile,'test',1
  249.     CALL LINEOUT testfile
  250.     rc = SysFileDelete(testfile)
  251.     IF rc = 0 THEN RETURN 0
  252.     RETURN 1
  253.  
  254. hpfschk: PROCEDURE EXPOSE env errcnt
  255.     ARG err,var
  256.     envvar = VALUE(var,,env)
  257.     if nothpfs(envvar) THEN DO
  258.         SAY "***XFERR"err": The directory "envvar" (derived from variable "var")"
  259.         SAY "   must reside on a file system which understands long file names"
  260.         SAY "   (e.g. HPFS, NFS, Linux-ext2) because some software relies on this."
  261.         SAY "   Please move this directory."
  262.         errcnt = errcnt+1
  263.     END
  264.     RETURN
  265.  
  266. userchk1: PROCEDURE EXPOSE errcnt
  267.     ARG err,usr,log
  268.     IF usr \= log THEN DO
  269.         SAY "***XFERR"err": The variables USER and LOGNAME must be present and"
  270.         SAY "   match. It will cause problems if they are different or missing."
  271.         SAY "   Please correct this."
  272.         errcnt = errcnt+1
  273.     END
  274.     RETURN
  275.  
  276. searchstring: PROCEDURE
  277.     ARG file,str
  278.     rc = SysFileSearch(str,file,'res.')
  279.     IF (rc \= 0) | (res.0>0) THEN RETURN 1
  280.     RETURN 0
  281.  
  282. termcapchk1: PROCEDURE EXPOSE errcnt x11root
  283.     ARG file,str
  284.     found = searchstring(file,'xterm')
  285.     if found=0 THEN DO
  286.         SAY "***XFERR054: The termcap file specified in TERMCAP does not"
  287.         SAY "   contain an entry for 'xterm'. It is possibly outdated. Please"
  288.         SAY "   use the file "x11root"/XFree86/lib/X11/etc/emx.termcap.x11 instead."
  289.         errcnt = errcnt+1
  290.     END
  291.     if str \= '' THEN DO
  292.         found = searchstring(file,str)
  293.         if found=0 THEN DO
  294.             SAY "***XFERR055: The termcap file specified in TERMCAP does not"
  295.             SAY "   contain an entry for the value "str" specified in the TERM variable."
  296.             SAY "   Please set TERM to a correct value."
  297.             errcnt = errcnt+1
  298.         END
  299.     END
  300.     RETURN
  301.  
  302. dispchk: PROCEDURE EXPOSE env errcnt hostname warncnt
  303.     display = VALUE('DISPLAY',,env)
  304.     IF hostname \= '' & (POS(hostname,display)=0) THEN DO
  305.         SAY "***XFWARN071: The DISPLAY variable contains a different value"
  306.         SAY "   than the HOSTNAME variable. This is okay provided you want"
  307.         SAY "   OS/2 X clients to be displayed elsewhere. Otherwise, please"
  308.         SAY "   correct this."
  309.         warncnt = warncnt+1
  310.     END
  311.     IF POS(':',display) = 0 THEN DO
  312.         SAY "***XFERR072: The DISPLAY variable does not contain a colon ':' which"
  313.         SAY "   is not correct. Please correct this. A valid DISPLAY variable looks like:"
  314.         SAY "       SET DISPLAY=myhost:0.0"
  315.         errcnt = errcnt+1
  316.     END
  317.     IF POS(':7',display) > 0 THEN DO
  318.         SAY "***XFERR073: The DISPLAY variable uses the standard connection"
  319.         SAY "   LBX (low bandwidth X). This is not supported by the current X servers."
  320.         SAY "   Use another connection type."
  321.         errcnt = errcnt+1
  322.     END
  323.     RETURN
  324.  
  325. hostchk: PROCEDURE EXPOSE env errcnt hostname etc warncnt
  326.     use_hosts_first = VALUE('USE_HOSTS_FIRST',,env)
  327.     IF use_hosts_first = '' THEN DO
  328.         SAY "***XFWARN080: You have not set the USE_HOSTS_FIRST variable."
  329.         SAY "   Unless you are permanently connected to an ethernet network"
  330.         SAY "   and have direct access to a DNS nameserver, it is recommended"
  331.         SAY "   to have the line SET USE_HOSTS_FIRST=1 in your CONFIG.SYS file."
  332.         warncnt = warncnt+1
  333.     END
  334.  
  335.     IF hostname = '' THEN RETURN
  336.     found = searchstring(hostname,etc'\hosts')
  337.     IF found = 0 THEN DO
  338.         SAY "***XFERR081: There is no entry for the HOSTNAME in the HOSTS file."
  339.         SAY "   (in"etc"\hosts). Please add a line like the following to this file:"
  340.         SAY "        192.10.10.1 "hostname
  341.     END
  342.     RETURN
  343.  
  344. pathchk: PROCEDURE EXPOSE errcnt
  345.     ARG err,file,dir
  346.     found = SysSearchPath('PATH',file)
  347.     IF found = '' THEN DO
  348.         SAY "***XFERR"err": You must set the directory "dir" in"
  349.         SAY "   your PATH entry in CONFIG.SYS. Please correct this."
  350.         errcnt = errcnt+1
  351.     END
  352.     RETURN
  353.  
  354. libpathchk: PROCEDURE EXPOSE errcnt OS2BootDrive
  355.     ARG err,file,dir
  356.     CALL SysFileSearch 'LIBPATH',OS2BootDrive'\config.sys','res.'
  357.     IF res.0 \= 1 THEN RETURN
  358.     libpath = TRANSLATE(res.1,'  ','=;')
  359.     found = 0
  360.     DO i=1 TO WORDS(libpath)
  361.         IF \(notexists_file(WORD(libpath,i)'\'file)) THEN DO
  362.             found = 1
  363.             LEAVE
  364.         END
  365.     END
  366.     if found = 0 THEN DO
  367.         SAY "***XFERR"err": You must set the directory "dir" in"
  368.         SAY "   your LIBPATH entry in CONFIG.SYS. Please correct this."
  369.         errcnt = errcnt+1
  370.     END
  371.     RETURN
  372.  
  373.  
  374. localchk: PROCEDURE EXPOSE errcnt hostname OS2BootDrive etc
  375.     IF hostname \= 'localhost' THEN RETURN
  376.     config = OS2BootDrive'\config.sys'
  377.     CALL SysFileSearch 'ifconfig',config,'res.'
  378.     found = 0
  379.     IF DATATYPE(res.0,N) = 1 THEN DO
  380.         DO i = 0 TO res.0
  381.             IF (POS('lo',res.i)>0) & (POS('127.0.0.1',res.i)>0) THEN DO
  382.                 found = 1
  383.                 LEAVE
  384.             END
  385.         END
  386.     END
  387.     IF (found = 0) | (res.0 = 0) THEN DO
  388.         SAY "***XFERR084: If your hostname is 'localhost', you must setup"
  389.         SAY "   the LOOPBACK network connection. This is done by adding the"
  390.         SAY "   following line to CONFIG.SYS:"
  391.         SAY "       RUN=<tcpippath>\ifconfig lo 127.0.0.1 up"
  392.         errcnt = errcnt+1
  393.     END
  394.     CALL SysFileSearch 'localhost',etc'\hosts','res1.'
  395.     IF (res1.0 \= 1) | (POS('127.0.0.1',res1.1)=0) THEN DO
  396.         SAY "***XFERR085: If your hostname is 'localhost', it must have the"
  397.         SAY "   standard internet number 127.0.0.1 in "etc"\hosts. Please"
  398.         SAY "   correct this."
  399.         errcnt = errcnt+1
  400.     END
  401.     RETURN
  402.  
  403. testpath: PROCEDURE EXPOSE env errcnt
  404.     ARG err,var,prog
  405.     path = TRANSLATE(VALUE(var,,env),' ',';')
  406.     DO i=1 TO WORDS(path)
  407.         IF notexists_dir(WORD(path,i)) THEN DO
  408.             SAY "***XFERR"err": In your "var" variable, the component "WORD(path,i)
  409.             SAY "   does not point to a valid directory. Please correct"
  410.             SAY "   the "var" variable, or '"prog"' might get confused."
  411.             errcnt = errcnt+1
  412.         END
  413.     END
  414.     RETURN
  415.  
  416. manpathchk: PROCEDURE EXPOSE env errcnt x11root warncnt
  417.     manpath = VALUE('MANPATH',,env)
  418.     IF manpath='' THEN DO
  419.         SAY "***XFWARN090: You don't have a MANPATH statement set. This is"
  420.         SAY "   no problem, but will disable the start of 'xman' in xinitrc.cmd"
  421.         SAY "   If you installed the man pages, you might want to add a MANPATH"
  422.         SAY "   to CONFIG.SYS like:"
  423.         SAY "       SET MANPATH="x11root"/XFree86/man"
  424.         warncnt = warncnt+1
  425.     END
  426.     ELSE DO
  427.         CALL testpath '091','MANPATH','xman'
  428.     END
  429.     RETURN
  430.  
  431. xconfigchk: PROCEDURE EXPOSE runxconfig x11root warncnt
  432.     IF notexists_file(x11root'/XFree86/lib/X11/XF86Config') THEN DO
  433.       IF exists_file(x11root'/XFree86/lib/X11/XConfig') THEN DO
  434.         SAY ""
  435.         SAY "***XFWARN100: You have an old XConfig file. XFree86-3.3.2"
  436.         SAY "   and later use XF86Config. You must rename this"
  437.         SAY "   file to XF86Config, or rebuild it if it is a leftover"
  438.         SAY "   from earlier incompatible installations."
  439.         warncnt = warncnt + 1
  440.       END
  441.       ELSE DO
  442.         SAY ""
  443.         SAY "***XFWARN092: You don't have an XF86Config file yet. Do you want to"
  444.         SAY "   run the xf86config utility after this script (Y/N)?"
  445.         PULL yesno
  446.         IF (yesno='Y') | (yesno='YES') THEN runxconfig=1
  447.         warncnt = warncnt + 1
  448.       END
  449.         END
  450.     RETURN
  451.  
  452. revision: PROCEDURE
  453.     ARG pathname
  454.     CALL RxFuncAdd emx_revision, pathname, emx_revision
  455.     SIGNAL ON SYNTAX NAME ERROR
  456.     rev = emx_revision()
  457.     SIGNAL OFF SYNTAX
  458.     CALL RxFuncDrop emx_revision
  459.     RETURN rev
  460.  
  461. emxchk: PROCEDURE EXPOSE env errcnt x11root
  462.     IF \(notexists_file(x11root'/XFree86/bin/imake.exe')) THEN DO
  463.         incpath = VALUE('C_INCLUDE_PATH',,env)
  464.         lbrpath = VALUE('LIBRARY_PATH',,env)
  465.         IF (lbrpath='') | (incpath='') THEN DO
  466.             SAY "***XFERR093: You seem to have installed the programmer's kit, but have"
  467.             SAY "   not set up the EMX development system completely."
  468.             SAY "   Besides other EMX variables, the X11 programmer's kit needs"
  469.             SAY "   a correct setup of the variables C_INCLUDE_PATH and LIBRARY_PATH."
  470.             SAY "   Please fix this, or imake won't work correctly."
  471.             SAY ""
  472.             SAY "   Ignore this message if you have installed a patch."
  473.             errcnt = errcnt+1
  474.         END
  475.         ELSE DO
  476.             CALL testpath '094','C_INCLUDE_PATH','imake'
  477.             CALL testpath '095','LIBRARY_PATH','imake'
  478.         END
  479.     END
  480.     found = SysSearchPath('PATH','EMXREV.CMD')
  481.     IF found \= '' THEN DO
  482.         IF revision('EMX') < 42 THEN DO
  483.             SAY "***XFERR096: There is an EMX.DLL in your LIBPATH, which is"
  484.             SAY "   older than the required EMX09B FIX 4 patch level."
  485.             SAY "   Please remove it and ensure you have the latest"
  486.             SAY "   version, or XFree86/OS2 won't run."
  487.             errcnt = errcnt+1
  488.         END
  489.         
  490.     END
  491.     RETURN
  492.  
  493. xconfig: PROCEDURE EXPOSE runxconfig
  494.     IF runxconfig=1 THEN DO
  495.         SAY "***CHECK: Now calling xf86config..."
  496.         CALL SysCls
  497.         'xf86config'
  498.         CALL SysCls
  499.         CALL BEEP 440,250
  500.         SAY ""
  501.         SAY "***CHECK checkinstall finished!"
  502.     END
  503.     RETURN
  504.  
  505. xf86supchk: PROCEDURE EXPOSE errcnt OS2BootDrive x11root
  506.     CALL SysFileSearch 'XF86SUP.SYS',OS2BootDrive'\config.sys','res.'
  507.     IF res.0 < 1 THEN DO
  508.         SAY "***XFERR097: You must have the XF86SUP.SYS device driver"
  509.         SAY "   installed in your CONFIG.SYS file, i.e. a line like:"
  510.         SAY "      DEVICE="x11root"\XFree86\lib\xf86sup.sys"
  511.         errcnt = errcnt+1
  512.     END
  513.     PARSE VAR res.1 WITH "DEVICE=" drv
  514.     CALL filexchk1 '098',drv
  515.     CALL SysFileSearch 'FASTIO.SYS',OS2BootDrive'\config.sys','res.'
  516.     IF res.0=1 THEN DO
  517.         SAY "***XFERR099: You have the FASTIO.SYS device driver installed in your"
  518.         SAY "   CONFIG.SYS file. This driver is superseeded by the driver"
  519.         SAY "   XF86SUP.SYS. Please remove the obsolete FASTIO.SYS driver."
  520.         SAY "   XFree86/OS2 won't work with it installed."
  521.         errcnt = errcnt+1
  522.     END
  523.     RETURN
  524.  
  525. trailchk: PROCEDURE EXPOSE errcnt env
  526.     ARG err,var
  527.     envvar = TRANSLATE(VALUE(var,,env),'\','/')
  528.     IF LASTPOS('\',envvar) = LENGTH(envvar) THEN DO
  529.         SAY "***XFERR"err": The TMP directory is declared with a trailing backslash."
  530.         SAY "   There is a problem in XFree86 which prevents proper work"
  531.         SAY "   with it. Please remove the trailing backslash."
  532.         errcnt = errcnt+1
  533.     END
  534.     RETURN
  535.  
  536. casematch: PROCEDURE EXPOSE DateSep HPFSDirCol HPFSDirIdentCol FSDir. Drive
  537.     /* I do not know of a routine that checks if a given string is spelled in the correct case, */
  538.     /* according to the case used in the filesystem. Example: environment variable HOME is set  */
  539.     /* to f:\home\fire, but on a HPFS drive it is F:\Home\Fire                                  */
  540.     /* Thus, I simulate what a user would do at the prompt: show each dir and check the case.   */
  541.  
  542.     PARSE ARG dir
  543.     'SET DIRCMD=' /* would be better to save this and restore it afterwards */
  544.     /* FILESPEC only works with trailing '\' */
  545.     IF LASTPOS('\',dir) \= LENGTH(dir) then dir = dir||'\'
  546.     Drive = FILESPEC("drive",dir)    /* F: */
  547.     Path = FILESPEC("path",dir)    /* \home\fire */
  548.     savedir = directory()
  549.     Drive /* change the current drive */
  550.     'cd\'
  551.     /* remove leading '\' */
  552.     Path = STRIP(Path,'Leading','\')
  553.     p = POS('\', Path)
  554.     /* Write all single dir-names into a stem-variable PDir */
  555.     i=1
  556.     do while (p>1)
  557.         PDir.i = LEFT(Path,p-1)
  558.         Path = SUBSTR(Path,p+1)
  559.         i = i + 1
  560.         p = POS('\', Path)
  561.     end
  562.     PDir.0 = i-1
  563.  
  564.     i=1
  565.     do PDir.0
  566.         UPDir = TRANSLATE(PDir.i)
  567.         /* clear the queue */
  568.         do QUEUED( ) 
  569.             PULL 
  570.         end
  571.  
  572.         'dir | RXQUEUE'
  573.         found = 0
  574.         do while ((LINES('QUEUE:') > 0) & \(found))
  575.             /* FSDir = FileSystemDirectory, i.e. the name that is used in the FS */
  576.             FSDirLine = PARSE LINEIN('QUEUE:')
  577.             if (left(FSDirLine,6)='PARSE ') then FSDirLine=SUBSTR(FSDirLine,7)
  578.             if (SUBSTR(FSDirLine,3,1)=DateSep) then /* This is a DIR or a file */
  579.             do
  580.                 if (SUBSTR(FSDirLine, HPFSDirIdentCol, 5)='<DIR>') then
  581.                 do
  582.                     FSDir.i = SUBSTR(FSDirLine, HPFSDirCol) /* the name of the dir */
  583.                     /* Find the correct line */
  584.                     UFSDir = TRANSLATE(FSDir.i)
  585.                     if (UFSDir = UPDir) then
  586.                     do
  587.                         found = 1
  588.                         /* This is the correct line -> Check case */
  589.                         if (PDir.i\=FSDir.i) then
  590.                         do
  591.                             /* restore directory */
  592.                             /* Say PDir.i' is not the same as 'FSDir.i */
  593.                             FSDir.0 = i
  594.                             dummy = directory(savedir)
  595.                             return 1
  596.                         end
  597.                     end
  598.                 end
  599.             end
  600.         end
  601.         'cd 'PDir.i
  602.         i = i + 1
  603.     end
  604.     dummy = directory(savedir)
  605.     RETURN 0
  606.  
  607. casechk: PROCEDURE EXPOSE env errcnt DateSep HPFSDirCol HPFSDirIdentCol
  608.     ARG err,var
  609.     envvar = PARSE VALUE(var,,env)
  610.     /* remove 'PARSE' -- why does it occur?!? */
  611.     if (left(envvar,5)='PARSE') then envvar=SUBSTR(envvar,7)
  612.     if casematch(envvar) THEN DO
  613.         /* reconstruct the DirName as used in the FileSystem */
  614.         FileSysDir = Drive
  615.         i = 1
  616.         do FSDir.0
  617.             FileSysDir = FileSysDir||'\'||FSDir.i
  618.             i = i + 1
  619.         end
  620.  
  621.         SAY "***XFERR"err": The directory "envvar" (derived from variable "var")"
  622.         SAY "   must be set with exactly the same case as used on the disk"
  623.         SAY "   ("FileSysDir"). Please correct this setting."
  624.         errcnt = errcnt+1
  625.     END
  626.     RETURN
  627.  
  628. SearchBootDrive: PROCEDURE 
  629.     /* install a local error handler              */
  630.     signal on syntax name BootDriveNotFound
  631.     /* try the new function from the new REXXUTIL DLL */
  632.     OS2BootDrive = SysBootDrive()
  633.  
  634. BootDriveNotFound:
  635.     if symbol( 'OS2BootDrive' ) <> 'VAR' then
  636.     do
  637.         /* new REXXUTIL DLL not found  --             */
  638.         /* use the old method                         */
  639.         OS2BootDrive = substr( value( 'RUNWORKPLACE' ,, 'OS2ENVIRONMENT' ), 1,2 )
  640.  
  641.         if OS2BootDrive = '' then
  642.             OS2BootDrive = substr( value( 'COMSPEC' ,, 'OS2ENVIRONMENT' ), 1,2 )
  643.  
  644.         if OS2BootDrive = '' then
  645.             OS2BootDrive = 'C:'
  646.  
  647.     end /* if symbol( 'OS2BootDrive' ) <> 'VAR' then */  
  648.     RETURN OS2BootDrive
  649.  
  650. /* ------------------------------------------------------------------ */
  651. /* Error handler (called if the DLL REXXUTIL is not found)            */
  652. /*                                                                    */
  653. RexxUtilNotFound:
  654.   say ''
  655.   say 'Error: REXXUTIL.DLL not found!'
  656. exit 255
  657.  
  658. /* ------------------------------------------------------------------ */
  659. /* Error handler (called if the user presses CTRL-BREAK)              */
  660. /*                                                                    */
  661. UserAbort:
  662.   say ''
  663.   say ' checkinstall was aborted by the user.'
  664. exit 254
  665.