home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / nsos2202.exe / chkini.cmd next >
OS/2 REXX Batch file  |  1996-12-14  |  2KB  |  69 lines

  1. /* */
  2. parse arg cookie
  3.  
  4. cookie = strip(cookie)
  5. valid = 'SNDIFENTRIES'
  6.  
  7. /* This is an installation command file and should NOT be run by the user,
  8.  * skip if the installation parm has not been specified
  9.  */
  10. if cookie = valid then
  11. do
  12.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  13.   call SysLoadFuncs
  14.   windir = SysIni( ,"PM_INSTALL","WINOS2_LOCATION")
  15.   if windir <> "" then
  16.   do
  17.     if datatype(right(windir,1),'a') = 0  then windir = left(windir,length(windir)-1)
  18.     tmpfile = CreateTempFile(windir)
  19.     update = 0
  20.     winfile = windir'\win.ini'
  21.     do while lines(winfile)
  22.       line = linein(winfile)
  23.       if strip(line) = '[Netscape]' then
  24.       do
  25.         /* Found keyword, next line = "ini=d:\path\netscape.ini" */
  26.         line = strip(linein(winfile))
  27.         if stream(substr(line,5), 'c', 'query size') < 400 then
  28.           do
  29.           /* File seems to have been installed by the PIP, bag it, and
  30.            * skip this line, too
  31.            */
  32.           '@del' substr(line,5)
  33.           line = linein(winfile)
  34.           update = 1                            /* Need to update the ini */
  35.           end
  36.       end
  37.       call lineout tmpfile, line
  38.     end
  39.     call stream tmpfile, 'c', 'close'
  40.     call stream winfile, 'c', 'close'
  41.     if update = 1 then
  42.       do
  43.       bbucket = '>NUL:'
  44.       '@copy' winfile windir'\win.ppo' bbucket  /* Back up the existing win.ini */
  45.       '@copy' tmpfile winfile bbucket           /* Copy the temp file to win.ii */
  46.       '@del' tmpfile bbucket
  47.       end
  48.   end
  49. end
  50.  
  51. exit 0
  52.  
  53. CreateTempFile:  procedure
  54.   arg wfile
  55.   i = 0
  56.   tmp = wfile'\wtf'ntoascii(i,5)
  57.   do while stream(tmp,'c','query exists') <> ''
  58.     i = i + 1
  59.     tmp = wfile'\wtf'ntoascii(i,5)
  60.   end
  61.   return tmp
  62.  
  63.  
  64.  
  65. /* Convert the decimal value i to an l character string with leading (ASCII) '0's */
  66. ntoascii: arg i, l
  67.   x = right(  d2c(i+48), l, '0' )
  68.   return x
  69.