= 6) $pgtitle = array("OpenBGPD", "Status"); else $pgtitle = "OpenBGPD: Status"; include("head.inc"); 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); return $result; } function showCmdT($title, $command) { echo "

\n"; echo " \n"; echo "\n"; echo "\n"; echo "\n"; echo "
" . $title . "
";		/* no newline after pre */
	echo doCmdT($command);
	echo "
\n"; } /* Define a command, with a title, to be executed later. */ function defCmdT($title, $command) { global $commands; $title = htmlspecialchars($title,ENT_NOQUOTES); $commands[] = array($title, $command); } /* List all of the commands as an index. */ function listCmds() { global $commands; echo "

This status page includes the following information:\n"; echo "

\n"; } /* Execute all of the commands which were defined by a call to defCmd. */ function execCmds() { global $commands; foreach ($commands as $command) showCmdT($command[0], $command[1]); } ?> ' . $pgtitle . '

'; ?>