mirror of
https://github.com/myvesta/vesta
synced 2025-07-06 04:51:54 -07:00
new line on the output end if v-php-func called directly from shell
This commit is contained in:
parent
da136faf08
commit
b1a3b88877
2 changed files with 8 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if (isset($_SERVER['SHLVL'])) $SHLVL=intval($_SERVER['SHLVL']);
|
||||||
|
else $SHLVL=3;
|
||||||
|
|
||||||
if (!isset($argv)) exit(5);
|
if (!isset($argv)) exit(5);
|
||||||
|
|
||||||
include ("/usr/local/vesta/func/main.php");
|
include ("/usr/local/vesta/func/main.php");
|
||||||
|
@ -24,11 +27,14 @@ for ($i=2; $i<$counter; $i++) {
|
||||||
$r=call_user_func_array($func, $params);
|
$r=call_user_func_array($func, $params);
|
||||||
if (is_bool($r)) {
|
if (is_bool($r)) {
|
||||||
if ($r) {
|
if ($r) {
|
||||||
|
if ($SHLVL<3) echo "\n";
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
if ($SHLVL<3) echo "\n";
|
||||||
exit(MYVESTA_ERROR_GENERAL);
|
exit(MYVESTA_ERROR_GENERAL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo $r;
|
echo $r;
|
||||||
|
if ($SHLVL<3) echo "\n";
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ function myvesta_fix_args() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function myvesta_exit($code) {
|
function myvesta_exit($code) {
|
||||||
global $argv;
|
// global $argv;
|
||||||
// echo "==================== ".$argv[0].": ".$code." ====================\n";
|
// echo "==================== ".$argv[0].": ".$code." ====================\n";
|
||||||
exit($code);
|
exit($code);
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,5 @@ function myvesta_exit($code) {
|
||||||
function myvesta_test_func () {
|
function myvesta_test_func () {
|
||||||
$args=func_get_args();
|
$args=func_get_args();
|
||||||
echo "You said: ";
|
echo "You said: ";
|
||||||
print_r ($args);
|
echo trim(print_r ($args, true));
|
||||||
echo "\n";
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue