summaryrefslogtreecommitdiffstats
path: root/usr/local/www/guiconfig.inc
diff options
context:
space:
mode:
authorColin Smith <colin@pfsense.org>2005-04-06 03:13:09 +0000
committerColin Smith <colin@pfsense.org>2005-04-06 03:13:09 +0000
commit8e92b65b4c9abbf2ba4db45a2102508bf928d085 (patch)
tree40c3d5317f083ab0da66fbc78b6c58c91dbdfb83 /usr/local/www/guiconfig.inc
parenteecc379beecbec1add09d3b0c6bc077e62335f02 (diff)
downloadpfsense-8e92b65b4c9abbf2ba4db45a2102508bf928d085.zip
pfsense-8e92b65b4c9abbf2ba4db45a2102508bf928d085.tar.gz
Retool dump_clog to use preg_grep instead of a shelled-out grep sequence.
Diffstat (limited to 'usr/local/www/guiconfig.inc')
-rwxr-xr-xusr/local/www/guiconfig.inc28
1 files changed, 9 insertions, 19 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index e73ffa4..7a7a308 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -457,31 +457,21 @@ function dump_clog($logfile, $tail, $grepfor = "", $grepinvert = false, $withori
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
+ exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+
if($grepfor <> "") {
- $size = count($grepfor);
$i = 0;
foreach($grepfor as $agrep) {
+ $regexp = "/" . $agrep . "/i";
if($grepinvert[$i] == true) {
- if($size > 1) {
- $grep .= "grep -v {$agrep} | ";
- } else {
- $grep .= "grep -v {$agrep}";
- }
- $size--;
- } else {
- if($size > 1) {
- $grep .= "grep {$agrep} | ";
- } else {
- $grep .= "grep {$agrep}";
- }
- $size--;
- }
+ $logarr = preg_grep($regexp, $logarr, PREG_GREP_INVERT);
+ } else {
+ $logarr = preg_grep($regexp, $logarr);
+ }
$i++;
}
- exec("/usr/sbin/clog {$logfile} | {$grep} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- } else {
- exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- }
+ }
+
foreach ($logarr as $logent) {
$logent = preg_split("/\s+/", $logent, 6);
echo "<tr valign=\"top\">\n";
OpenPOWER on IntegriCloud