From ebe2951eb681b73ce62b2bf2326492cab76ab526 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 9 Nov 2007 02:09:35 +0000 Subject: Add libreadline support for command histories. Requested-by: CMB --- usr/local/sbin/pfSsh.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr/local/sbin/pfSsh.php') diff --git a/usr/local/sbin/pfSsh.php b/usr/local/sbin/pfSsh.php index 05d11e0..0d77220 100755 --- a/usr/local/sbin/pfSsh.php +++ b/usr/local/sbin/pfSsh.php @@ -16,6 +16,8 @@ $g['booting'] = false; function show_help() { echo "\nExample commands:\n"; + echo "\nparse_config(true); # reloads the \$config array\n"; + echo "\n/* to output a configuration array */\n"; echo "print_r(\$config);\n"; @@ -77,13 +79,13 @@ $shell_active = true; echo "Type \"help\" to show common usage scnenarios."; while($shell_active == true) { - echo "\n\npfSense shell> "; - $command = chop(fgets($fp)); + $command = readline("\n\npfSense shell: "); if($command == "exit") { $shell_active = false; echo "\n"; break; } + readline_add_history($command); if($command == "help") { show_help(); $command = ""; @@ -95,7 +97,8 @@ while($shell_active == true) { $xxxyzyz = 0; while($command <> "EOF") { echo "pfSense multiline shell[$xxxyzyz]> "; - $command = chop(fgets($fp)); + $command = readline("Command: "); + readline_add_history($command); if($command == "help") show_help(); if($command == "exit") -- cgit v1.1