summaryrefslogtreecommitdiff
path: root/package/rts
blob: d213f0dc36cb559062632d6bf692eac2eea0fd50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
shout() { echo "$0: $@" >&2; }
barf() { shout "fatal: $@"; exit 111; }
safe() { "$@" || barf "cannot $@"; }

umask 022
[ -d package ] || barf "no package directory"
[ -d src     ] || barf "no src directory"
[ -d compile ] || barf "no compile directory"
[ -d etc     ] || barf "no etc directory"
[ -f `head -1 src/conf-tcpbin`/tcpserver ] || barf "tcpserver not installed"

for i in `sed -e '/^it-/!d' -e 's/^it-//' < compile/it=d`
do
  all="$all $i"
done
usage() { shout "usage: package/rts [ [-]$all ]"; exit 100; }

targets=""
if [ $# -eq 0 ]
then
  targets="$all"
else
  if [ "$1" = "-" ]
  then
    shift
    suppress=":"
    for i in ${1+"$@"}
    do
      case "$all " in
	*\ $i\ *)
	  ;;
	*)
	  usage
	  ;;
      esac
      suppress="$suppress$i:"
    done
    for i in $all
    do
      case "$suppress" in
	*:$i:*)
	  ;;
	*)
	  targets="$targets $i"
	  ;;
      esac
    done
  else
    for i in ${1+"$@"}
    do
      case "$all " in
	*\ $i\ *)
	  ;;
	*)
	  usage
	  ;;
      esac
      targets="$targets $i"
    done
  fi
fi

[ "X$all" != "X" ] && [ "X$targets" = "X" ] && usage

here=`env - PATH=$PATH pwd`
safe cd compile
PATH="$here/compile:/command:$PATH"
export PATH
. $here/compile/rts.it > $here/compile/out.it 2>&1 
cat -v $here/compile/out.it | diff - $here/compile/exp.it
for i in $targets
do
  . $here/compile/rts.$i 2>&1 | cat -v > $here/compile/out.$i
  diff $here/compile/out.$i $here/compile/exp.$i
done