summaryrefslogtreecommitdiff
path: root/genif.sh
blob: 571e2b9a885f310cf8213b61998007cd4ce5c7f0 (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
#! /bin/sh

# $Id: genif.sh,v 1.2 1999-05-08 18:16:29 andrey Exp $
# replacement for genif.pl

infile="$1"
shift
srcdir="$1"
shift

if test "$infile" = "" -o "$srcdir" = ""; then
	echo "please supply infile and srcdir"
	exit 1
fi

cmd1='echo $data | grep @EXT_INCLUDE_CODE@ > /dev/null 2>&1'
cmd2='echo $data | grep @EXT_MODULE_PTRS@ > /dev/null 2>&1'

while read data; do
	if eval $cmd1 ; then
		for ext in $* ; do
			for pre in php3 php php4 zend; do
				hdrfile="ext/$ext/${pre}_${ext}.h"
				if test -f $hdrfile ; then
					echo "#include \"$hdrfile\""
				fi
			done
		done
	elif eval $cmd2 ; then
		for ext in $* ; do
			echo "	phpext_${ext}_ptr,"
		done
	else
		echo "$data"
	fi
done < $infile