home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / cool.lha / ice / util / ftpscript.create < prev    next >
Encoding:
Text File  |  1991-09-04  |  2.5 KB  |  85 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. # Creates script file which contains ftp commands to copy COOL files to 
  14. # an IBM PS/2.
  15. # Usage: cd ice; util/ftpscript.create <host> <dir> <dir> ...
  16. #        ftp -v -i < ./util/ftpscript.run'
  17. #
  18. # The directories to copy default to:
  19. #    ice_defs cpp CCC test util cool pisces"
  20. #
  21. # Example: copy all of cool
  22. #   cd ice; util/os2copy blue cool
  23. #
  24. # Example: copy just the String and String/tests directories
  25. #   cd ice; util/os2copy blue cool/String
  26. #
  27. # NOTE:
  28. #   We only copy *.C *.H *.c and Imakefile.  If other files need
  29. #   to be copied, place a "ftp-script" file in the applicable
  30. #   directory and it will be included in the ftp commands.
  31. #   
  32. #
  33. if ($1 == "" || $2 == "") then
  34.   echo "Usage: util/ftpscript.create <host> <login> [<dirs>]"
  35.   exit
  36. endif
  37.  
  38. set HOST = $1
  39. shift
  40. set LOGIN = $1
  41. shift
  42.  
  43. if ($1 == "") then
  44.   set DIRS = "ice_defs cpp CCC test util cool pisces"
  45. else
  46.   set DIRS = $*
  47. endif
  48. set ICE = `pwd`
  49.  
  50. # Create a temporary file containing all the directory names
  51. if (-e /tmp/cooldirs && "$1" == "") then
  52.  echo "using /tmp/cooldirs"
  53. else 
  54.  rm -f /tmp/cooldirs
  55.  touch /tmp/cooldirs
  56.  echo "ice" >> /tmp/cooldirs
  57.  foreach DIR ($DIRS)
  58.    echo "Finding $DIR directory"
  59.    echo "ice/$DIR" >> /tmp/cooldirs
  60.    (cd $ICE/..; find ice/$DIR/* -type d -print | egrep -v 'RCS' >> /tmp/cooldirs)
  61.  end
  62. endif
  63.  
  64. # Create a temporary file containg ftp commands which copy all directories
  65. echo "Creating ftp command file, util/ftpscript.run"
  66. echo "open $HOST" > /tmp/ftp.script
  67. echo "$LOGIN" >> /tmp/ftp.script
  68. foreach DIR (`cat /tmp/cooldirs`)
  69.   set OS2DIR=`echo "$DIR" | sed -e s'@/@\\\\@'g -e 's/^/\\\\/'`
  70.   echo cd "$OS2DIR" >> /tmp/ftp.script
  71.   echo lcd "$ICE/../$DIR" >> /tmp/ftp.script
  72.   echo nmap \$1.\$2 \$1.cxx >> /tmp/ftp.script
  73.   echo mput "*.C" >> /tmp/ftp.script
  74.   echo nmap >> /tmp/ftp.script
  75.   echo mput "*.h" >> /tmp/ftp.script
  76.   echo mput "*.c" >> /tmp/ftp.script
  77.   echo mput "Imakefile" >> /tmp/ftp.script
  78.   if (-e ../$DIR/ftp-script) cat ../$DIR/ftp-script >> /tmp/ftp.script
  79. end
  80. echo "close" >> /tmp/ftp.script 
  81. echo "bye" >> /tmp/ftp.script
  82.  
  83. cp /tmp/ftp.script ./util/ftpscript.run
  84. echo 'Usage: ftp -v -i < ./util/ftpscript.run'
  85.