cvs: php4 /ext ext_skel
| From: | Sascha Schumann | Date: | Tue, 04 Jul 2000 05:15:33 +0000 |
| Subject: | cvs: php4 /ext ext_skel | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-614@lists.php.net to get a copy of this message | ||
sas Mon Jul 3 22:15:33 2000 EDT
Modified files:
/php4/ext ext_skel
Log:
Make script work on POSIX sh
Index: php4/ext/ext_skel
diff -u php4/ext/ext_skel:1.24 php4/ext/ext_skel:1.25
--- php4/ext/ext_skel:1.24 Wed Jun 14 18:57:23 2000
+++ php4/ext/ext_skel Mon Jul 3 22:15:33 2000
@@ -22,7 +22,7 @@
exit 1
}
-if test $# -eq 0; then
+if test $# = 0; then
usage
fi
@@ -69,12 +69,12 @@
shift
done
-if [ -z "$assign_params" -a ! -z "$string_lens" ]; then
- usage
+if test -z "$assign_params" && test -n "$string_lens"; then
+ usage
fi
if test -d "$extname" ; then
- givup "Directory $extname already exists."
+ givup "Directory $extname already exists."
fi
test -f ext_skel || givup "ext_skel must be in the current directory"
@@ -88,21 +88,20 @@
ECHO_N="echo"
ECHO_C='\c'
fi
-
-if [ -z $stubs ]; then
-echo "Creating directory $extname"
-stubfile=$extname"/function_stubs"
-mkdir $extname || givup "Cannot create directory $extname"
+if test -z "$stubs"; then
+ echo "Creating directory $extname"
+ stubfile=$extname"/function_stubs"
+ mkdir $extname || givup "Cannot create directory $extname"
fi
-if [ ! -z $proto ]; then
- cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v
full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -v
assign_params=$assign_params -v string_lens=$string_lens -f ./skeleton/create_stubs
+if test -n "$proto"; then
+ cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v
full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -v
assign_params=$assign_params -v string_lens=$string_lens -f ./skeleton/create_stubs
fi
-if [ -z $stubs ]; then
-cd $extname
-chmod 755 .
+if test -z "$stubs"; then
+ cd $extname
+ chmod 755 .
$ECHO_N "Creating basic files:$ECHO_C"
@@ -180,7 +179,7 @@
echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
fi
-cat ../skeleton/skeleton.c | sed -f sedscript > $extname.c
+sed -f sedscript <../skeleton/skeleton.c > $extname.c
$ECHO_N " php_$extname.h$ECHO_C"
@@ -198,31 +197,32 @@
echo 's/^\/\*.*\*\/$//' >> sedscript
echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
fi
-cat ../skeleton/php_skeleton.h | sed -f sedscript > php_$extname.h
+sed -f sedscript <../skeleton/php_skeleton.h > php_$extname.h
rm sedscript
-if [ -z "$stubs" -a -z "$no_help" ]; then
-$ECHO_N " $extname.php$ECHO_C"
-cat ../skeleton/skeleton.php | sed \
--e "s/extname/$extname/g" \
-> $extname.php
-fi
-
-if [ ! -z $proto ]; then
- if [ -z $stubs ]; then
- rm function_entries
- rm function_declarations
- rm function_stubs
- fi
- if [ -f function_warning ]; then
- rm function_warning
- warning="
+if test -z "$stubs" && test -z "$no_help"; then
+ $ECHO_N " $extname.php$ECHO_C"
+ sed \
+ -e "s/extname/$extname/g" \
+ <../skeleton/skeleton.php \
+ > $extname.php
+fi
+
+if test -n "$proto"; then
+ if test -z "$stubs"; then
+ rm function_entries
+ rm function_declarations
+ rm function_stubs
+ fi
+ if test -f function_warning; then
+ rm function_warning
+ warning="
NOTE! Because some arguments to functions were resources, the code generated
cannot yet be compiled without editing. Please consider this to be step 4.5
in the instructions above.
"
- fi
+ fi
fi
chmod 644 *
@@ -230,8 +230,8 @@
echo " [done]."
-if [ -z "$no_help" -a -z "$stubs" ]; then
-cat <<eof
+if test -z "$no_help" && test -z "$stubs"; then
+ cat <<eof
To use your new extension, you will have to execute the following steps: