mirror of
https://github.com/php/php-src.git
synced 2024-10-06 17:26:11 +00:00
6792978aed
* moved scripts to own directory (bug #7635)
57 lines
1.0 KiB
C++
57 lines
1.0 KiB
C++
#!@prefix@/bin/php -q
|
|
<?php // -*- C++ -*-
|
|
|
|
require_once "PEAR.php";
|
|
require_once "PEAR/Installer.php";
|
|
|
|
error_reporting(7);
|
|
|
|
$stderr = fopen("php://stderr", "w");
|
|
|
|
$debug = 1;
|
|
$optind = 1;
|
|
|
|
while ($optind < $argc && $argv[$optind][0] == "-") {
|
|
switch (substr($argv[$optind], 1)) {
|
|
case "v":
|
|
$debug = (int)$argv[++$optind];
|
|
break;
|
|
case "-":
|
|
$optind++;
|
|
break 2;
|
|
default:
|
|
fputs($stderr, "Unknown option: $argv[$optind]\n");
|
|
/* fall through */
|
|
case "?":
|
|
case "h":
|
|
usage();
|
|
break;
|
|
}
|
|
|
|
$optind++;
|
|
}
|
|
|
|
$pkgfile = $argv[$optind];
|
|
|
|
if (!$pkgfile) {
|
|
usage();
|
|
}
|
|
|
|
$p = new PEAR_Installer();
|
|
$p->debug = $debug;
|
|
$p->install($pkgfile);
|
|
|
|
function usage()
|
|
{
|
|
global $stderr;
|
|
fputs($stderr,
|
|
"Usage: pear [-v n] [-h] <package>\n".
|
|
"Options:\n".
|
|
" -v set verbosity level to <n> (0-2, default 1)\n".
|
|
" -h display help/usage (this message)\n");
|
|
fclose($stderr);
|
|
exit;
|
|
}
|
|
|
|
?>
|