home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / progs / iversion.icn < prev    next >
Text File  |  2000-07-29  |  2KB  |  58 lines

  1. ############################################################################
  2. #
  3. #    File:     iversion.icn
  4. #
  5. #    Subject:  Program to show icode version
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     April 28, 1994
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #    This program reports the version of Icon icode files whose names
  18. #  are supplied, one name per line, from standard input.
  19. #
  20. #    The method is necessarily somewhat heuristic and may not work on
  21. #  all systems and for very old icode versions.
  22. #
  23. #     This program does not work on icode files with shell headers
  24. #  (notably Version 9 Icon under UNIX).
  25. #
  26. ############################################################################
  27.  
  28. procedure main()
  29.    local name, file, icode, okay
  30.  
  31.    while name := read() do {
  32.       writes(name, ": ")
  33.       file := open(name,"u") | {
  34.          write("cannot open")
  35.          next
  36.          }
  37.       okay := &null
  38.       while icode := reads(file,30000) do    # enough for most UNIX headers
  39.          icode ? {
  40.             while tab(upto('I') + 1) do {
  41.                if any('5678') then {
  42.                   write(tab(upto('\0')))
  43.                   okay := 1
  44.                   exit()            # one is enough ...
  45.                   }
  46.                }
  47.             }
  48.       if /okay then {
  49.          write("no version")
  50.          write("may have shell header or not be icode file")
  51.          }
  52.       close(file)
  53.       }
  54.  
  55. end
  56.  
  57.  
  58.