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 / cwd.icn < prev    next >
Text File  |  2000-07-29  |  967b  |  42 lines

  1. ############################################################################
  2. #
  3. #    File:     cwd.icn
  4. #
  5. #    Subject:  Program to write current working directory
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     June 10, 1994
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program write the current working directory, shorn of it's
  18. #  path specification.
  19. #
  20. #  For appropriately named directories, it can be used as, for example,
  21. #
  22. #    ftp `cwd`
  23. #
  24. ############################################################################
  25. #
  26. #  Requires:  UNIX
  27. #
  28. ############################################################################
  29.  
  30. procedure main()
  31.    local i
  32.  
  33.    read(open("pwd", "p")) ? {
  34.       i := 0                # for safety
  35.       every i := upto('/')        # expect full path
  36.       tab(i + 1)
  37.       write(tab(0))
  38.       }
  39.  
  40. end
  41.       
  42.