summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-11-19 03:23:01 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-11-19 03:23:01 +0000
commit3d3be83663b7156f109a11500f82c079558000e9 (patch)
treebc195fbf25c2c6a1021404f605fa03c88a185760
parentcd8ca22fadd883d9367184f72434d62c84cf68b9 (diff)
downloadpfsense-3d3be83663b7156f109a11500f82c079558000e9.zip
pfsense-3d3be83663b7156f109a11500f82c079558000e9.tar.gz
If readline is not included in PHP then fall back to normal boring text input methods.
-rwxr-xr-xusr/local/sbin/pfSsh.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr/local/sbin/pfSsh.php b/usr/local/sbin/pfSsh.php
index 906be8f..72e313b 100755
--- a/usr/local/sbin/pfSsh.php
+++ b/usr/local/sbin/pfSsh.php
@@ -13,6 +13,15 @@ require("config.inc");
echo ".";
$g['booting'] = false;
+if(!function_exists("readline")) {
+ function readline() {
+ $fp = fopen('php://stdin', 'r');
+ $textinput = chop(fgets($fp));
+ fclose($fp);
+ }
+ return $textinput;
+}
+
function more($text, $count=24) {
$counter=0;
$lines = split("\n", $text);
@@ -97,7 +106,7 @@ $pkg_interface='console';
$shell_active = true;
-echo "Type \"help\" to show common usage scnenarios.";
+echo "Type \"help\" to show common usage scenarios.";
while($shell_active == true) {
$command = readline("\n\npfSense shell: ");
OpenPOWER on IntegriCloud