#!/bin/sh
# Thu Dec 22 22:24:14 EST 2005

# The "version" string is specified in the file VERSIONLABEL, which should
# contain one line of version label, and optionally may have comment lines.
VERSION=`grep -v '^#' Cintpos/cintpos/VERSIONLABEL | tr -d '\n' `

# where to put the patch files
PATCHES=./cintpospatches-$VERSION

# distributable patch file tgz
DIST=cintpospatches-$VERSION

if ! test -d $PATCHES
then
  mkdir $PATCHES
fi

# fix a bug in a printf() in devices.c
# ./Cintpos/cintpos/sysc/RCS/devices.c,v
co -p -r1.1 ./Cintpos/cintpos/sysc/devices.c > ./Cintpos/cintpos/sysc/devices.c.orig
diff -aur ./Cintpos/cintpos/sysc/devices.c.orig ./Cintpos/cintpos/sysc/devices.c > \
	$PATCHES/devices.c.diff

# set the POSHDRS environment variable in setenv
co -p -r1.1 ./Cintpos/cintpos/setenv > ./Cintpos/cintpos/setenv.orig
diff -aur ./Cintpos/cintpos/setenv.orig ./Cintpos/cintpos/setenv > $PATCHES/setenv.diff

# new files
cp ./Cintpos/cintpos/INSTALL $PATCHES
chmod +x $PATCHES/INSTALL
cp ./Cintpos/cintpos/VERSIONLABEL $PATCHES

# save a copy of this script
cp $0 $PATCHES
# and the corresponding patch installer script
cp install_cintpos_patches $PATCHES

# make the tgz file
tar czvf $DIST.tgz $PATCHES
echo patch files saved in directory $PATCHES
echo patch file archive is $DIST.tgz

