ext_skel_win32.php [plain text]
<?php
if (php_sapi_name() != "cli") {
echo "Please run this script using the CLI version of PHP\n";
exit;
}
$cygwin_path = 'c:\cygwin\bin';
$path = getenv("PATH");
putenv("PATH=$cygwin_path;$path");
array_shift($argv);
system("sh ext_skel " . implode(" ", $argv));
$extname = "";
$skel = "skeleton";
foreach($argv as $arg) {
if (strtolower(substr($arg, 0, 9)) == "--extname") {
$extname = substr($arg, 10);
}
if (strtolower(substr($arg, 0, 6)) == "--skel") {
$skel = substr($arg, 7);
}
}
$fp = fopen("$extname/$extname.php", "rb");
if ($fp) {
$php_file = fread($fp, filesize("$extname/$extname.php"));
fclose($fp);
$php_file = str_replace("dl('", "dl('php_", $php_file);
$fp = fopen("$extname/$extname.php", "wb");
if ($fp) {
fwrite($fp, $php_file);
fclose($fp);
}
}
?>