1<?php 2/* $Id$ */ 3 4if (php_sapi_name() != "cli") { 5 echo "Please run this script using the CLI version of PHP\n"; 6 exit; 7} 8/* 9 This script can be used on Win32 systems 10 11 1) Make sure you have CygWin installed 12 2) Adjust the $cygwin_path to match your installation 13 3) Change the environment cariable PATHEXT to include .PHP 14 4) run ext_skel --extname=... 15 the first time you run this script you will be asked to 16 associate it with a program. chooses the CLI version of php. 17*/ 18 19$cygwin_path = 'c:\cygwin\bin'; 20 21$path = getenv("PATH"); 22putenv("PATH=$cygwin_path;$path"); 23 24array_shift($argv); 25system("sh ext_skel " . implode(" ", $argv)); 26 27$extname = ""; 28$skel = "skeleton"; 29foreach($argv as $arg) { 30 if (strtolower(substr($arg, 0, 9)) == "--extname") { 31 $extname = substr($arg, 10); 32 } 33 if (strtolower(substr($arg, 0, 6)) == "--skel") { 34 $skel = substr($arg, 7); 35 } 36} 37 38$fp = fopen("$extname/$extname.php", "rb"); 39if ($fp) { 40 $php_file = fread($fp, filesize("$extname/$extname.php")); 41 fclose($fp); 42 43 $php_file = str_replace("dl('", "dl('php_", $php_file); 44 $fp = fopen("$extname/$extname.php", "wb"); 45 if ($fp) { 46 fwrite($fp, $php_file); 47 fclose($fp); 48 } 49} 50 51?> 52