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 / gcomp.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  46 lines

  1. ############################################################################
  2. #
  3. #    File:     gcomp.icn
  4. #
  5. #    Subject:  Program to produce complement of file specification
  6. #
  7. #    Author:   William H. Mitchell, modified by Ralph E. Griswold    
  8. #
  9. #    Date:     December 27, 1989
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #     This program produces a list of the files in the current directory
  18. #  that do not appear among the arguments.  For example,
  19. #  
  20. #       gcomp *.c
  21. #  
  22. #  produces a list of files in the current directory that do
  23. #  not end in .c.  As another example, to remove all the files
  24. #  in the current directory that do not match Makefile, *.c, and *.h
  25. #  the following can be used:
  26. #  
  27. #       rm `gcomp Makefile *.c *.h`
  28. #  
  29. #  The files . and .. are not included in the output, but other
  30. #  `dot files' are.
  31. #
  32. ############################################################################
  33. #
  34. #  Requires: UNIX
  35. #
  36. ############################################################################
  37.  
  38. procedure main(args)
  39.    local files
  40.    files := set()
  41.    read(open("echo * .*","rp")) ? while insert(files,tab(upto(' ') | 0)) do
  42.       move(1) | break
  43.    every delete(files,"." | ".." | !args)
  44.    every write(!sort(files))
  45. end
  46.