summaryrefslogtreecommitdiff
path: root/search.php
diff options
context:
space:
mode:
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);
}