summary refs log tree commit diff
path: root/debian/bsdyacc
blob: ce71f4c0ddf325552241cca8ddff9c5d6372a23d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh -e

if echo "$@" | grep -q -- -o; then
	OUTPUT=$(echo "$@" |
		 sed 's/.*-o[[:blank:]]\+\([^[:blank:]]\+\)\.c.*/\1/')
	OPTIONS=$(echo "$@" |
		 sed 's/\(.*\)-o[[:blank:]]\+[^[:blank:]]\+\(.*\)/\1\2/')
	NEW=1
else
	OUTPUT=$(echo "$@" |
		 sed -e 's/.*[[:blank:]]\+\([^[:blank:]]\+\)\.y.*/\1/')
	OPTIONS="$@"
	NEW=0
fi

byacc $OPTIONS
if [ $NEW = 1 ]; then
	mv y.tab.c $OUTPUT.c
fi
mv y.tab.h $OUTPUT.h