|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/make/ln-if-absent.beos |
source navigation diff markup identifier search freetext search file search |
1 #!/bin/sh -f
2 #
3 # Make a symbolic link if the target is absent.
4 #
5 # Use this script instead "ln-if-absent" (rename it) on BeOS
6 #
7 # Untested. Contributed by Howard Feldman <feldman@mshri.on.ca>
8 #
9 # $Id: ln-if-absent.beos,v 6.1 2002/06/17 14:26:44 ivanov Exp $
10 #
11
12 if [ $# -lt 1 ]; then
13 echo "Usage: $0 source_file... target"
14 exit 1
15 fi
16
17 COUNT=$#
18 NUMARG=$#
19 LIST=
20 while [ $COUNT -ge 1 ]; do
21 if [ $COUNT -eq 1 ]; then
22 TARGET=$1
23 else
24 export LIST="$1 $LIST"
25 fi
26 shift
27 let COUNT=$COUNT-1
28 done
29 FINAL=
30
31 if [ -d $TARGET ]; then
32 for i in $LIST; do
33 if [ -r $TARGET/$i:t ]; then
34 echo .
35 else
36 export FINAL="$FINAL $i"
37 fi
38 done
39 else
40 if [ $NUMARG -ne 2 ]; then
41 echo target argument should be a directory
42 exit 1
43 fi
44 if [ -r $LIST ]; then
45 echo .
46 else
47 exit 1
48 fi
49 if [ -r $TARGET ]; then
50 echo .
51 else
52 ln -sf $LIST $TARGET
53 fi
54 exit 0
55 fi
56
57 if [ ${#FINAL} == 1 ]; then
58 if [ -r $FINAL ]; then
59 echo .
60 else
61 exit 1
62 fi
63 ln -s $FINAL $TARGET
64 exit 0
65 fi
66
67 if [ ${#FINAL} -ne 0 ]; then
68 ln -s $FINAL $TARGET
69 fi
70
71 exit 0
72
73
74 @ count=$#argv
75 set target=$argv[$count]
76 @ count--
77 set list=($argv[-$count])
78 set final=()
79
80 if (-d $target) then
81 foreach i ($list)
82 if (! -r $target/$i:t) set final=($final $i)
83 end
84 else
85 if ($#argv != 2) then
86 echo target argument should not be a directory
87 exit 1
88 endif
89 if (! -r "$1") exit 1
90 if (! -r "$2") ln -sf "$1" "$2"
91 exit 0
92 endif
93
94 if ( $#final == 1) then
95 if (! -r "$final") exit 1
96 ln -s $final $target
97 exit 0
98 endif
99
100 if ($#final != 0) then
101 ln -s $final $target
102 endif
103
104 exit 0
|
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |