home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / importitfe.tcl < prev    next >
Text File  |  1997-11-04  |  1KB  |  62 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #    (c)    Cayenne Software Inc. 1997
  4. #
  5. #    File:        @(#)importitfe.tcl    /main/titanic/1
  6. #    Description:    import tool front end
  7. #
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)importitfe.tcl    /main/titanic/1 4 Nov 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. global SCCS_W;        set SCCS_W "
  12. @(#)importitfe.tcl    /main/titanic/1
  13. "
  14. global progName;    set progName "importitfe.tcl"
  15.  
  16. proc setProg {} {
  17.     set name [string trim $SCCS_W "\n%"]
  18.     if {$name != "W"} {
  19.     regexp "@.#.(.*)\t" $name dummy name
  20.     global progName
  21.     set progName $name
  22.     }
  23. }
  24.  
  25. proc main {argv} {
  26.     #
  27.     # tmpFile
  28.     #    1: filename1
  29.     #    2: filename1
  30.     #    ...
  31.     #
  32.     setProg
  33.  
  34.     set tmpFile [lvarpop argv]
  35.     if {[catch {set fd [open $tmpFile r]} msg]} {
  36.     puts stderr "ERROR\[$progName]: $msg"
  37.     catch {BasicFS::removeFile $tmpFile}
  38.     return
  39.     }
  40.     set fileNames {}
  41.     while {[gets $fd line] > 0} {
  42.     lappend fileNames $line
  43.     }
  44.     close $fd
  45.     if {[catch {BasicFS::removeFile $tmpFile} msg]} {
  46.     puts stderr "ERROR\[$progName]: $msg"
  47.     }
  48.  
  49.     foreach file $fileNames {
  50.     if {[catch {
  51.         source [join $file]
  52.     } reason]} {
  53.         puts stderr "ERROR\[$progName]: $reason"
  54.     }
  55.     }
  56. }
  57.  
  58.  
  59. if {[catch {main $argv} reason]} {
  60.     puts stderr $errorInfo
  61. }
  62.