aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-07-24 09:25:10 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-07-24 09:25:10 -0300
commitf9d5f68afea91c3c482e244faa6f2beabc4b4ade (patch)
treecb22eb49e8591076b8f93002cda149c69eb604da
parentb4c4708edacaed4fc774e6ae3b0faa4067618fb7 (diff)
downloadpfsense-packages-f9d5f68afea91c3c482e244faa6f2beabc4b4ade.tar.gz
pfsense-packages-f9d5f68afea91c3c482e244faa6f2beabc4b4ade.tar.bz2
pfsense-packages-f9d5f68afea91c3c482e244faa6f2beabc4b4ade.zip
Simplify a bit how it limit number of routes
-rw-r--r--config/openbgpd/openbgpd_status.php8
1 files changed, 3 insertions, 5 deletions
diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php
index 6c5628e1..a5bbc31c 100644
--- a/config/openbgpd/openbgpd_status.php
+++ b/config/openbgpd/openbgpd_status.php
@@ -58,20 +58,18 @@ function doCmdT($command, $limit = "all", $filter = "") {
$grepline = "";
if (!empty($filter))
$grepline = " | grep " . escapeshellarg(htmlspecialchars($filter));
+ if (is_numeric($limit) && $limit > 0)
+ $headline = " | head -n {$limit}";
- $fd = popen("{$command}{$grepline} 2>&1", "r");
+ $fd = popen("{$command}{$grepline}{$headline} 2>&1", "r");
$ct = 0;
- $cl = 0;
$result = "";
while (($line = fgets($fd)) !== FALSE) {
- if (is_numeric($limit) && $limit > 0 && $cl >= $limit)
- break;
$result .= htmlspecialchars($line, ENT_NOQUOTES);
if ($ct++ > 1000) {
ob_flush();
$ct = 0;
}
- $cl++;
}
pclose($fd);