aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-07-23 21:35:20 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-07-23 21:35:20 -0300
commit46df12808f26c02394714baa487977e2064f5433 (patch)
tree5f7bae00084fce71464c1e8bd4d68c70dd9d273d /config
parent60b1fbe6af66e1ae493e862d632c356b016ce0e6 (diff)
downloadpfsense-packages-46df12808f26c02394714baa487977e2064f5433.tar.gz
pfsense-packages-46df12808f26c02394714baa487977e2064f5433.tar.bz2
pfsense-packages-46df12808f26c02394714baa487977e2064f5433.zip
Add limit and filter parameters to doCmdT
Diffstat (limited to 'config')
-rw-r--r--config/openbgpd/openbgpd_status.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php
index dabcd605..d337858e 100644
--- a/config/openbgpd/openbgpd_status.php
+++ b/config/openbgpd/openbgpd_status.php
@@ -37,16 +37,24 @@ else
include("head.inc");
-function doCmdT($command) {
- $fd = popen("{$command} 2>&1", "r");
+function doCmdT($command, $limit = 0, $filter = "") {
+ $grepline = "";
+ if (!empty($filter))
+ $grepline = " | grep " . escapeshellarg(htmlspecialchars($filter));
+
+ $fd = popen("{$command}{$grepline} 2>&1", "r");
$ct = 0;
+ $cl = 0;
$result = "";
while (($line = fgets($fd)) !== FALSE) {
+ if ($limit > 0 && $cl >= $limit)
+ break;
$result .= htmlspecialchars($line, ENT_NOQUOTES);
if ($ct++ > 1000) {
ob_flush();
$ct = 0;
}
+ $cl++;
}
pclose($fd);