com php-src: reveal implemented replace.php options: compat/PECL_PORTING compat/replace.php
| From: | Anatol Belski | Date: | Tue, 28 Jan 2014 23:35:40 +0000 |
| Subject: | com php-src: reveal implemented replace.php options: compat/PECL_PORTING compat/replace.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75835@lists.php.net to get a copy of this message | ||
Commit: 68969026fc1a32e5d0691580a4e4091ed9e3bb4b
Author: Anatol Belski <ab@php.net> Wed, 29 Jan 2014 00:35:40 +0100
Parents: 4347713fd2de5d7a3354e46bda295c959e70e0cc
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=68969026fc1a32e5d0691580a4e4091ed9e3bb4b
Log:
reveal implemented replace.php options
Changed paths:
M compat/PECL_PORTING
M compat/replace..php
Diff:
diff --git a/compat/PECL_PORTING b/compat/PECL_PORTING
index 08743d0..639be4d 100644
--- a/compat/PECL_PORTING
+++ b/compat/PECL_PORTING
@@ -104,6 +104,8 @@ II. Porting steps
complicated cases the manual intrusion is unavoidable. Still, this tool will
save a lot of time while porting.
+ XXX more on replace.php and it's modes
+
ii. Compatibility header
The compat.h header, once copied into the extension source and included, will
diff --git a/compat/replace.php b/compat/replace.php
index 1ce6c27..9dbece8 100644
--- a/compat/replace.php
+++ b/compat/replace.php
@@ -13,7 +13,7 @@ $options = getopt($shortopts, $longopts);
$repl_type = isset($options['type']) ? $options['type'] : 'ext';
$custom_defs_fname = isset($options['custom']) ? $options['custom'] : NULL;
-$fname = $argv[count($argv)-1];
+$fname = (count($argv) < 2) ? NULL : $argv[count($argv)-1];
$reverse_replace = isset($options['reverse']);
$replace_zpp = isset($options['zpp']);
@@ -151,8 +151,11 @@ if (false === file_put_contents($fname, $file_contents)) {
/* Helpers */
function print_usage($code = 0)
{
+ echo "Replacement tool for old vs. new macro names and more." . PHP_EOL;
echo "Usage: replace.php [OPTIONS] file" . PHP_EOL;
echo " --custom Path to custom replacement definitions file, optional." . PHP_EOL;
+ echo " --reverse Replace the new names with the old ones, so reverse, optional." .
PHP_EOL;
+ echo " --zpp Along with macro names replace the zpp format specs, optional." .
PHP_EOL;
echo " --help This help." . PHP_EOL;
echo PHP_EOL;