NCBI C Toolkit Cross Reference

C/make/ln-if-absent


  1 #!/bin/csh -f
  2 # NOTE:  use "/bin/tcsh" above if "/bin/csh" is absent (e.g. on QNX OS)
  3 #        use a "ln-if-absent.beos" on the BeOS platform (rename it to ln-if-absent)
  4 #
  5 # Make a symbolic link if the target is absent
  6 #
  7 # $Id: ln-if-absent,v 1.6 2002/06/17 14:27:20 ivanov Exp $
  8 #
  9 
 10 set path=(/usr/bin /bin)
 11 
 12 if ($#argv < 2) then
 13         echo "Usage: $0 source_file... target"
 14         exit 1
 15 endif
 16 
 17 @ count=$#argv
 18 set target=$argv[$count]
 19 @ count--
 20 set list=($argv[-$count])
 21 set final=()
 22 
 23 if (-d $target) then
 24         foreach i ($list)       
 25                 if (! -r $target/$i:t) set final=($final $i)
 26         end
 27 else
 28         if ($#argv != 2) then
 29                 echo target argument should not be a directory
 30                 exit 1
 31         endif
 32         if (! -r "$1") exit 1
 33         if (! -r "$2") ln -sf "$1" "$2" 
 34         exit 0
 35 endif
 36 
 37 if ( $#final == 1) then
 38         if (! -r "$final") exit 1
 39         ln -s $final $target
 40         exit 0
 41 endif
 42 
 43 if ($#final != 0) then
 44         ln -s $final $target
 45 endif
 46 
 47 exit 0

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.