aboutsummaryrefslogtreecommitdiffstats
path: root/config/openbgpd/openbgpd_status.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-07-25 16:08:01 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-07-25 16:08:01 -0300
commit1b1f2377086a1eae05fc707ef63e0f436aaf08cc (patch)
tree097e48d73e5fb775664ccf3d4b7f2fe65f070759 /config/openbgpd/openbgpd_status.php
parentc74a1fd4df6244b941da095c229fddbfcfbe30b9 (diff)
downloadpfsense-packages-1b1f2377086a1eae05fc707ef63e0f436aaf08cc.tar.gz
pfsense-packages-1b1f2377086a1eae05fc707ef63e0f436aaf08cc.tar.bz2
pfsense-packages-1b1f2377086a1eae05fc707ef63e0f436aaf08cc.zip
preserve header when filtering
Diffstat (limited to 'config/openbgpd/openbgpd_status.php')
-rw-r--r--config/openbgpd/openbgpd_status.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php
index 68836b21..c7987ec4 100644
--- a/config/openbgpd/openbgpd_status.php
+++ b/config/openbgpd/openbgpd_status.php
@@ -61,8 +61,10 @@ include("head.inc");
function doCmdT($command, $limit = "all", $filter = "", $header_size = 0) {
$grepline = "";
- if (!empty($filter))
- $grepline = " | /usr/bin/grep " . escapeshellarg(htmlspecialchars($filter));
+ if (!empty($filter)) {
+ $ini = ($header_size > 0 ? $header_size+1 : 1);
+ $grepline = " | /usr/bin/sed -e '{$ini},\$ { /" . escapeshellarg(htmlspecialchars($filter)) . "/!d; };'";
+ }
if (is_numeric($limit) && $limit > 0) {
$limit += $header_size;
$headline = " | /usr/bin/head -n {$limit}";