diff options
Diffstat (limited to 'search.php')
-rw-r--r-- | search.php | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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); } |