[Patch] Correct executable name for PEAR installer

From: Date: Wed, 04 Jun 2003 16:24:46 +0000
Subject: [Patch] Correct executable name for PEAR installer
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17014@lists.php.net to get a copy of this message
Hi, the attached patch fixes the problem that the PEAR installer identifies itself as "pearcmd.php" in the help text when being invoked via $ pear without any further options. The problem occurs because $argv obviously always contains the name of the current script (which is pearcmd.php) at position 0. Thus $progname = basename($argv[0]); will always return "pearcmd.php", which is wrong: "pear" should be returned when being invoked from the command line. At the same time, one has to patch pear.sh to pass the location of the PEAR installer to pearcmd.php. I'm not sure if this will break the GtK- or Webinstaller, thus review is appreciated. -- - Martin Martin Jansen http://martinjansen.com/

? scripts.diff Index: pear.sh =================================================================== RCS file: /repository/php4/pear/scripts/pear.sh,v retrieving revision 1.2 diff -u -r1.2 pear.sh --- pear.sh 4 Apr 2003 00:15:53 -0000 1.2 +++ pear.sh 4 Jun 2003 16:19:06 -0000 @@ -25,4 +25,4 @@ fi fi -exec $PHP -C -q $INCARG -d output_buffering=1 $INCDIR/pearcmd.php $@ +exec $PHP -C -q $INCARG -d output_buffering=1 $INCDIR/pearcmd.php $0 Index: pearcmd.php =================================================================== RCS file: /repository/php4/pear/scripts/pearcmd.php,v retrieving revision 1.1 diff -u -r1.1 pearcmd.php --- pearcmd.php 3 Apr 2003 23:48:39 -0000 1.1 +++ pearcmd.php 4 Jun 2003 16:19:06 -0000 @@ -47,7 +47,7 @@ $all_commands = PEAR_Command::getCommands(); $argv = Console_Getopt::readPHPArgv(); -$progname = basename($argv[0]); +$progname = basename($argv[1]); $options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:vV"); if (PEAR::isError($options)) { usage($options);
« previous php.pear.dev (#17014) next »