#!/bin/sh extname="$1" EXTNAME=`echo $1|tr a-z A-Z` if [ ! -z $2 -a -r $2 ]; then functions=`cat $2` fi givup() { echo $* exit 1 } if test "$extname" = ""; then givup "usage: $0 extension-name [function-names]" fi if test -d "$extname" ; then givup "Directory $extname already exists." fi test -f ext_skel || givup "ext_skel must be in the current directory" if echo '\c' | grep -s c >/dev/null 2>&1 then ECHO_N="echo -n" ECHO_C="" else ECHO_N="echo" ECHO_C='\c' fi ECHO_E="echo -e" # Any portability problems? If, how to test. echo "Creating directory" mkdir $extname || givup "Cannot create directory $extname" cd $extname chmod 755 . touch function_entries touch function_declarations touch function_stubs if [ $2 ] ; then cat > function_stubs <> function_entries $ECHO_E "PHP_FUNCTION($f);" >> function_declarations cat >> function_stubs <config.m4 <Makefile.in <.cvsignore < $extname.c $ECHO_N " php_$extname.h$ECHO_C" cat ../skeleton/php_skeleton.h | sed \ -e "s/extname/$extname/g" \ -e "s/EXTNAME/$EXTNAME/g" \ -e '/__function_declarations_here__/r function_declarations' \ -e '/__function_declarations_here__/D' \ > php_$extname.h $ECHO_N " $extname.php$ECHO_C" cat ../skeleton/skeleton.php | sed \ -e "s/extname/$extname/g" \ > $extname.php rm function_entries rm function_declarations rm function_stubs chmod 644 * echo " [done]." cat <