summaryrefslogtreecommitdiff
path: root/search.php
diff options
context:
space:
mode:
authorPhil Burton <phil@d3r.com>2015-12-09 14:40:15 +0000
committerPhil Burton <phil@d3r.com>2015-12-09 14:40:15 +0000
commitcda15498f993c85e2c20351f0b248b05122e5705 (patch)
tree512d7513334017cc26b66eca6e106e680951f394 /search.php
parentde76ff1e55ab2324d24b52f15b41df2fa372102c (diff)
Add error colour
Diffstat (limited to 'search.php')
-rw-r--r--search.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/search.php b/search.php
index ad511e4..cfc1a16 100644
--- a/search.php
+++ b/search.php
@@ -108,14 +108,22 @@ function getVersion($config)
*
* @param string|string[] $pieces
* @param string $glue
+ * @param bool $sderr
* @author Phil Burton <phil@pgburton.com>
*/
-function output($pieces, $glue = " - ")
+function output($pieces, $glue = " - ", $stderr = false)
{
+ $out = "";
if (!is_array($pieces)) {
- echo $pieces . "\n";
+ $out = $pieces . "\n";
} else {
- echo implode($glue, $pieces) . "\n";
+ $out = implode($glue, $pieces) . "\n";
+ }
+
+ if ($stderr) {
+ echo "\x034" . $out . "\x03";
+ } else {
+ echo $out;
}
exit;
@@ -264,8 +272,8 @@ try {
$out[] = "results (" . $count . ")";
}
- output($out, " - ");
+ output($out);
} catch (Exception $e) {
- output($e->getMessage());
+ output($e->getMessage(), " - ", true);
}