summaryrefslogtreecommitdiff
path: root/zwgc/instantiate
blob: dae134ddcf1de0c8af0b7dfc1bec49e2a7e54d6b (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
#!/bin/sh -

# This file is part of the Project Athena Zephyr Notification System.
# It is one of the source files comprising zwgc, the Zephyr WindowGram
# client.
#
# $Id$
#
# Copyright (c) 1989,1993 by the Massachusetts Institute of Technology.
# For copying and distribution information, see the file
# "mit-copyright.h".
#

if [ "$1" = "" ]; then
	echo "Usage: generate_instance <srcdir> <type> <name> [<include file>]"
	exit 1
fi

source=$1
type=$2
name=$3
incfile=$4

if [ "$type" != "stack" ]; then
	if [ ! -f ${source}/${type}.c ]; then
		echo "$0: unable to open ${source}/${type}.c"
		exit 2
	fi
	sed "s/TYPE_T/$name/g" ${source}/${type}.c > ${name}_${type}.c
fi

if [ "$incfile" != "" ]; then
	echo "#include \"$incfile\"" > ${name}_${type}.h
fi
if [ ! -f ${source}/${type}.h ]; then
	echo "$0: unable to open ${source}/${type}.h"
	exit 2
fi
sed "s/TYPE_T/$name/g" ${source}/${type}.h >> ${name}_${type}.h