home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / fchek284.zip / link-alpha.com < prev    next >
Text File  |  1995-01-20  |  1KB  |  51 lines

  1. $! name: LINK.COM
  2. $! author: R. Moniot
  3. $! date: 14-Apr-87
  4. $! purpose: bring C image up to date with its objects
  5. $! usage:  @LINK OBJLIST
  6. $!        Where OBJLIST is a comma-separated list of object files,
  7. $!        OMITTING the extension .OBJ.
  8. $!
  9. $! Pick main module name from front of the list.  If .EXE file does not exist,
  10. $! go to link.
  11. $!
  12. $ len = f$length(p1)
  13. $ pos = f$locate(",",p1)
  14. $ main = f$extract(0,pos,p1)
  15. $ if f$search(main + ".EXE") .eqs. "" then goto Link
  16. $!
  17. $ exedate = f$cvtime(f$file_attributes(main + ".EXE","cdt")) 
  18. $!
  19. $!  Check against object module dates
  20. $!
  21. $ rest = p1
  22. $ Loop:
  23. $    len = f$length(rest)
  24. $    pos = f$locate(",",rest)
  25. $    module = f$extract(0,pos,rest)
  26. $    if module .eqs. "" then goto Exit
  27. $    if f$search(module + ".OBJ") .eqs. "" then goto NoSuchFile
  28. $    objdate = f$cvtime(f$file_attributes(module + ".OBJ","cdt"))
  29. $    if exedate .lts. objdate then goto Link
  30. $    rest = f$extract(pos+1,len-pos-1,rest)
  31. $ goto Loop
  32. $!
  33. $!    Image does not exist or is older than some objects: link
  34. $!
  35. $ Link:
  36. $    write sys$output "LINK " + p1
  37. $    on warning then exit
  38. $    link 'p1'
  39. $    exit
  40. $!
  41. $!    object is older than executable: all is OK
  42. $!
  43. $ Exit:
  44. $    write sys$output main + ".EXE is up to date."
  45. $    exit
  46. $!
  47. $ NoSuchFile:
  48. $    write sys$output module + ".OBJ does not exist"
  49. $! exit, and return control to command level
  50. $    stop
  51.