registry cachehook: fix memleak (to talloc_tos()): free key at the end.
[Samba.git] / source / script / mkproto.sh
blob8561f42dff011db0570ae08fa12c330a03eb234d
1 #! /bin/sh
3 LANG=C; export LANG
4 LC_ALL=C; export LC_ALL
5 LC_COLLATE=C; export LC_COLLATE
7 if [ $# -lt 3 ]
8 then
9 echo "Usage: $0 awk [-h headerdefine] outputheader proto_obj"
10 exit 1
13 awk="$1"
14 shift
16 if [ x"$1" = x-h ]
17 then
18 headeropt="-v headername=$2"
19 shift; shift;
20 else
21 headeropt=""
24 header="$1"
25 shift
26 headertmp="$header.$$.tmp~"
28 proto_src="`echo $@ | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort | uniq | egrep -v 'tdb/|wrapped|modules/getdate' | egrep -v '\.a$'`"
30 echo creating $header
32 mkdir -p `dirname $header`
34 ${awk} $headeropt \
35 -f script/mkproto.awk $proto_src > $headertmp
37 if cmp -s $header $headertmp 2>/dev/null
38 then
39 echo "$header unchanged"
40 rm $headertmp
41 else
42 mv $headertmp $header