2644
|
1 #! /bin/sh -e |
|
2 |
|
3 # Create additional links to .oct files that define more than one |
|
4 # function. |
|
5 |
|
6 # If the first arg is -p, only print the links we need to make. |
|
7 |
|
8 # The first non-option arg is taken as the directory where the .oct |
|
9 # files are installed. The remaining arguments should be the list of |
4045
|
10 # .df files corresponding to the source files that were used to |
|
11 # create the .oct files. |
2644
|
12 |
|
13 print_only=false |
|
14 if [ $1 = "-p" ]; then |
|
15 print_only=true |
|
16 shift |
|
17 fi |
|
18 |
|
19 links_dir=$1 |
|
20 shift |
|
21 |
|
22 for f in "$@"; do |
4045
|
23 base=`basename $f | sed 's/\.df$//'` |
|
24 fcns=`grep '^ *XDEFUN_DLD_INTERNAL' $f |\ |
|
25 sed -e 's/XDEFUN_DLD_INTERNAL *( *//' -e 's/ *,.*$//' |\ |
2644
|
26 sort -u` |
|
27 if [ -n "$fcns" ]; then |
|
28 for n in $fcns; do |
|
29 if [ "$n" = "$base" ]; then |
|
30 true |
|
31 else |
|
32 if $print_only; then |
|
33 echo $base.oct $n.oct |
|
34 else |
|
35 echo "creating link $n.oct -> $base.oct" |
|
36 ( cd $links_dir; rm -f $n.oct; ln $base.oct $n.oct ) |
|
37 fi |
|
38 fi |
|
39 done |
|
40 fi |
|
41 done |
|
42 |
|
43 exit $? |