home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / vms / genopt.com < prev    next >
Text File  |  1999-07-20  |  1KB  |  37 lines

  1. $! generates options file for vms link
  2. $! p1 is filename and mode to open file (filename/write or filename/append)
  3. $! p2 is delimiter separating elements of list in p3
  4. $! p3 is list of items to be written, one per line, into options file
  5. $
  6. $ open file 'p1'
  7. $ element=0
  8. $loop:
  9. $ x=f$element(element,p2,p3)
  10. $ if x .eqs. p2 then goto out
  11. $ y=f$edit(x,"COLLAPSE")  ! lose spaces
  12. $! Expand potential name-only args so we find shareable images
  13. $! either via a logical name or in the default location
  14. $ if y .nes. "" .and. -
  15.      f$locate("/SHARE",f$edit(y,"UPCASE")) .ne. f$length(y)
  16. $ then
  17. $   name = f$element(0,"/",y)
  18. $   tail = f$extract(f$length(name),1024,y)
  19. $   if f$trnlnm(name) .eqs. ""  ! If it's a logical name, assume it's OK as is
  20. $   then
  21. $     name = f$parse(name,"sys$share:.exe;")   ! Look where image activator will
  22. $     name = f$search(name)                    ! Does it really exist?
  23. $     if name .nes. ""
  24. $     then
  25. $       name = name - f$parse(name,,,"version")  ! Insist on current version
  26. $       y = name + tail
  27. $     endif
  28. $  endif
  29. $ endif
  30. $ if y .nes. "" then write file y
  31. $ element=element+1
  32. $ goto loop
  33. $
  34. $out:
  35. $ close file
  36. $ exit
  37.