diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-07-25 16:08:01 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-07-25 16:08:01 -0300 |
commit | 1b1f2377086a1eae05fc707ef63e0f436aaf08cc (patch) | |
tree | 097e48d73e5fb775664ccf3d4b7f2fe65f070759 /config/openbgpd/openbgpd_status.php | |
parent | c74a1fd4df6244b941da095c229fddbfcfbe30b9 (diff) | |
download | pfsense-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.php | 6 |
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}"; |