home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / fixcheck.zip / fixbuild.cmd next >
OS/2 REXX Batch file  |  1997-08-26  |  3KB  |  92 lines

  1. /*
  2.   Convert fixpack readme to a data file for checking against system.
  3.   Copyright 1996, Charles H. McKinnis, all rights reserved.
  4.   An unrestricted license is hereby granted to all who
  5.   wish to use this program on an AS IS basis.
  6. */
  7. Trace 'N'
  8. read_search = 'Pre-requisite CSD Level:'
  9. os2_levels = ''
  10. csdline. = ''
  11.  
  12. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  13. Call SysLoadFuncs
  14.  
  15. Say 'Enter the fully qualified name of the readme file to be converted'
  16. Parse Upper Pull read_file
  17. If Substr(read_file,2,1) <> ':' Then Do
  18.    Say 'Use the fully qualified name of the readme file to be converted'
  19.    Call Clean_up
  20.    End
  21. If \ Filefind(read_file) Then Do
  22.    Say read_file 'not found'
  23.    Call Clean_up
  24.    End
  25.  
  26. Say 'Enter the fully qualified name of the output data file'
  27. Parse Upper Pull dat_file
  28. If Substr(dat_file,2,1) <> ':' Then Do
  29.    Say 'Use the fully qualified name of the output data file'
  30.    Call Clean_up
  31.    End
  32. If Stream(dat_file,'C','QUERY EXISTS') <> '' Then Do
  33.    Say dat_file 'exists and will be replaced'
  34.    '@DEL' dat_file
  35.    End
  36.  
  37. return_code = SysFileSearch(read_search,read_file,'csdline.','N')
  38. If csdline.0 = 0 Then Do
  39.    Say read_file 'does not appear to be a proper file'
  40.    Call Clean_up
  41.    End
  42.  
  43. Say 'Processing readme file' read_file
  44. Parse Value Space(csdline.1) With first_line .
  45. Do i = 1 To first_line
  46.    line = Linein(read_file)
  47.    End
  48.  
  49. Do i = 1 To csdline.0
  50.    Parse Value Space(csdline.i) With fix_line . ':' fix_level .
  51.    fix_level = Left(fix_level,Lastpos('_',fix_level) - 1)
  52.    os2_levels = Space(os2_levels fix_level)
  53.    j = i + 1
  54.    Parse Value Space(csdline.j) With next_csd .
  55.    If next_csd = '' Then next_csd = 999999
  56.    Do j = fix_line + 1 To next_csd While Lines(read_file) > 0
  57.       line = Linein(read_file)
  58.       If Pos('/',line) > 0,
  59.          & Pos('OS/2',line) = 0,
  60.          & Pos('Manager/2',line) = 0 Then Do
  61.          Say os2_levels
  62.          rc = Lineout(dat_file,Space(line os2_levels))
  63.          Do k = j + 1 To next_csd While Lines(read_file) > 0
  64.             line = Linein(read_file)
  65.             If Pos('/',line) > 0,
  66.                & Pos('OS/2',line) = 0,
  67.                & Pos('Manager/2',line) = 0 Then rc = Lineout(dat_file,Space(line os2_levels))
  68.             End
  69.          os2_levels = ''
  70.          Iterate i
  71.          End
  72.       End
  73.    End
  74. rc = Stream(read_file,'C','CLOSE')
  75. rc = Stream(dat_file,'C','CLOSE')
  76. Say 'Finished converting readme file' read_file 'to data file' dat_file
  77.  
  78. Clean_up:
  79.    If \ RxFuncQuery('SysDropFuncs') Then Call SysDropFuncs
  80.    Exit
  81.  
  82. Filefind: Procedure
  83.    Parse Upper Arg file type .
  84.    If type = '' | type = 'F' Then type = 'F'
  85.    return_code = SysFileTree(file,'file',type)
  86.    If return_code = 0 Then Do
  87.       If file.0 = 1 Then status = 1
  88.       Else status = 0
  89.       End
  90.    Else status = 0
  91.    Return status
  92.