home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / cool.lha / ice / util / os2copy < prev    next >
Encoding:
Text File  |  1991-09-04  |  2.4 KB  |  84 lines

  1. #! /bin/csh
  2. #
  3. # Copyright (C) 1991 Texas Instruments Incorporated.
  4. #
  5. # Permission is granted to any individual or institution to use, copy, modify,
  6. # and distribute this software, provided that this complete copyright and
  7. # permission notice is maintained, intact, in all copies and supporting
  8. # documentation.
  9. #
  10. # Texas Instruments Incorporated provides this software "as is" without
  11. # express or implied warranty.
  12. #
  13. # ftp cool files to an IBM PS/2
  14. # Usage: cd ice; util/os2copy <host> <login> <dir> <dir> ...
  15. # The directories to copy default to:
  16. #   ice_defs cpp CCC test util cool pisces
  17. #
  18. # Example: copy all of cool
  19. #   cd ice; util/os2copy blue cool
  20. #
  21. # Example: copy just the String and String/tests directories
  22. #   cd ice; util/os2copy blue cool/String
  23. #
  24. # NOTE:
  25. #   We only copy *.C *.H *.c and Imakefile.  If other files need
  26. #   to be copied, place a "ftp-script" file in the applicable
  27. #   directory and it will be included in the ftp commands.
  28. #   
  29. #
  30.  
  31. if ($1 == "" || $2 == "") then
  32.   echo "Usage: util/os2copy <host> <login> [<dirs>]"
  33.   exit
  34. endif
  35.  
  36. set HOST = $1
  37. shift
  38. set LOGIN = $1
  39. shift
  40.  
  41. if ($1 == "") then
  42.   set DIRS = "ice_defs cpp CCC test util cool pisces"
  43. else
  44.   set DIRS = $*
  45. endif
  46.  
  47. set ICE = `pwd`
  48.  
  49. # Create a temporary file containing all the directory names
  50. if (-e /tmp/cooldirs && "$1" == "") then
  51.  echo "using /tmp/cooldirs"
  52. else 
  53.  rm -f /tmp/cooldirs
  54.  touch /tmp/cooldirs
  55.  echo "ice" >> /tmp/cooldirs
  56.  foreach DIR ($DIRS)
  57.    echo "Finding $DIR directory"
  58.    echo "ice/$DIR" >> /tmp/cooldirs
  59.    (cd $ICE/..; find ice/$DIR/* -type d -print | egrep -v 'RCS' >> /tmp/cooldirs)
  60.  end
  61. endif
  62.  
  63. # Create a temporary file containg ftp commands which copy all directories
  64. echo "Creating ftp command file"
  65. echo "open $HOST" > /tmp/ftp.script
  66. echo "$LOGIN" >> /tmp/ftp.script
  67. foreach DIR (`cat /tmp/cooldirs`)
  68.   set OS2DIR=`echo "$DIR" | sed -e s'@/@\\\\@'g -e 's/^/\\\\/'`
  69.   echo cd "$OS2DIR" >> /tmp/ftp.script
  70.   echo lcd "$ICE/../$DIR" >> /tmp/ftp.script
  71.   echo nmap \$1.\$2 \$1.cxx >> /tmp/ftp.script
  72.   echo mput "*.C" >> /tmp/ftp.script
  73.   echo nmap >> /tmp/ftp.script
  74.   echo mput "*.h" >> /tmp/ftp.script
  75.   echo mput "*.c" >> /tmp/ftp.script
  76.   echo mput "Imakefile" >> /tmp/ftp.script
  77.   if (-e ../$DIR/ftp-script) cat ../$DIR/ftp-script >> /tmp/ftp.script
  78. end
  79. echo "close" >> /tmp/ftp.script
  80. echo "bye" >> /tmp/ftp.script
  81.  
  82. echo 'ftp -v -i < /tmp/ftp.script'
  83. /bin/time ftp -v -i < /tmp/ftp.script
  84.