home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / novirus / extract.com next >
Text File  |  1998-11-04  |  3KB  |  76 lines

  1. $ ! The following lines comprise the command file EXTRACT_TLB.COM
  2. $ !
  3. $ wo := "WRITE SYS$OUTPUT "
  4. $ !
  5. $ ! Get the library name, either from the command line, or from the 
  6. $ ! user.  Append a ".TLB" if not already there.
  7. $ !
  8. $ Lib_Name = p1
  9. $get_Lib_Name:    
  10. $ If Lib_Name .eqs. "" then inquire Lib_Name "Name for .TLB file"
  11. $ If Lib_Name .eqs. "" then Goto get_Lib_Name
  12. $ Lib_Name = f$Parse(Lib_Name, ".TLB")
  13. $ !
  14. $ ! List out the contents of the library and start looking thru it for
  15. $ ! some files to extract out of it.
  16. $ !
  17. $ Library/Text/List=Contents.Lis 'Lib_Name'
  18. $ Open/Read File Contents.Lis
  19. $read_next:
  20. $ read/end=finished file this_file
  21. $ !
  22. $ ! First, try looking for a '^'.  If we found one, then this is a variable
  23. $ ! record file.  Just replace the '^' with a '.' to make a legal filename
  24. $ ! and extract it
  25. $ !
  26. $ file_name = f$element (0,"^",this_file)
  27. $ If file_name .eqs. this_file then Goto try_fixed
  28. $ file_type = f$element (1,"^",this_file)
  29. $ If file_type .eqs. "^" then file_type = ""
  30. $ file_out = file_name + "." + file_type
  31. $ wo "Extracting: " + File_Out + " (variable)"
  32. $ Library/Text/Extract='This_file'/Output='File_out' 'Lib_Name'
  33. $ Goto read_next
  34. $ !
  35. $ ! Next, let's see if there's a '#' in the module name.  If so, then
  36. $ ! the first element of the module name is the filename, the second
  37. $ ! is the filetype, and the third is the record length
  38. $ !
  39. $try_fixed:
  40. $ file_name = f$element (0,"#",this_file)
  41. $ If file_name .eqs. this_file then Goto read_next
  42. $ file_type = f$element (1,"#",this_file)
  43. $ If file_type .eqs. "#" then file_type = ""
  44. $ file_out = file_name + "." + file_type
  45. $ Rec_Size = f$element  (2, "#", this_file)
  46. $ wo "Extracting: " + file_out + " (fixed, ''rec_size')"
  47. $ Library/Text/Extract='This_file'/Output='File_out' 'Lib_Name'
  48. $ ! 
  49. $ ! Build a .FDL file, so that we can convert the variable record file that
  50. $ ! the librarian created back to a fixed record file
  51. $ !
  52. $ Open/Write List Extract_Tlb.FDL
  53. $ Write List "RECORD"
  54. $ Write List "  Carriage_Control        None"
  55. $ Write List "  Format                  Fixed"
  56. $ Write List "  Size                    " + f$String(Rec_Size)
  57. $ Close list
  58. $ !
  59. $ ! Convert the variable record file to a fixed file, and clean up by
  60. $ ! deleting the .FDL and the variable record file.
  61. $ !
  62. $ Convert/FDL=Extract_Tlb.FDL 'File_Out' 'File_Out'
  63. $ Delete 'File_out';-1
  64. $ Delete Extract_TLB.FDL;
  65. $ Goto Read_Next
  66. $ !
  67. $ ! OK, Now clean up by deleting the contents listing, and ourself.
  68. $ ! Since EXTRACT_TLB will be in the list of files to extract from the
  69. $ ! library, so there's no need to keep two copies, eh?
  70. $ !
  71. $finished:
  72. $ close file
  73. $ Delete Contents.Lis;
  74. $ Delete 'f$Environment("PROCEDURE")'
  75. $ EXIT
  76.