diff options
author | Tim Allender <techneck@goldenpath.org> | 2009-07-17 17:12:30 -0400 |
---|---|---|
committer | Tim Allender <techneck@goldenpath.org> | 2009-07-17 17:12:30 -0400 |
commit | dad2b40e2c476dc6f694864d175ec2c3acf235d2 (patch) | |
tree | 9fbb879ef82685fea409a2af798eabd9d3f56255 /etc/inc/util.inc | |
parent | a67a0922b423fdde34650aa2fd7174241508e925 (diff) | |
download | pfsense-dad2b40e2c476dc6f694864d175ec2c3acf235d2.zip pfsense-dad2b40e2c476dc6f694864d175ec2c3acf235d2.tar.gz |
Adds automated interface setup + sshd for installation only.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 9914bdc..4304801 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1027,5 +1027,29 @@ function isAjax() { return isset ($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; } +/****f* util/timeout + * NAME + * timeout - console input with timeout countdown. Note: erases 2 char of screen for timer. Leave space. + * INPUTS + * optional, seconds to wait before timeout. Default 9 seconds. + * RESULT + * returns 1 char of user input or null if no input. + ******/ + +function timeout($timer = 9) { + while(!isset($key)) { + if ($timer >= 9) { echo chr(8) . chr(8) . ($timer==9 ? chr(32) : null) . "{$timer}"; } + else { echo chr(8). "{$timer}"; } + `/bin/stty -icanon min 0 time 25`; + $key = trim(`KEY=\`dd count=1 2>/dev/null\`; echo \$KEY`); + `/bin/stty icanon`; + if ($key == '') + unset($key); + $timer--; + if ($timer == 0) + break; + } + return $key; +} -?>
\ No newline at end of file +?> |