aboutsummaryrefslogtreecommitdiff
path: root/sbofind
diff options
context:
space:
mode:
Diffstat (limited to 'sbofind')
-rwxr-xr-xsbofind12
1 files changed, 10 insertions, 2 deletions
diff --git a/sbofind b/sbofind
index 93e7e36..807f733 100755
--- a/sbofind
+++ b/sbofind
@@ -66,7 +66,11 @@ sub perform_search($) {
my (@findings, $name, $found);
my $name_regex = qr/NAME:\s+(.*\Q$search\E.*)$/i;
my $loc_regex = qr/LOCATION:\s+(.*)$/;
- my $fh = open_read "$config{SBO_HOME}/SLACKBUILDS.TXT";
+ my ($fh, $exit) = open_read "$config{SBO_HOME}/SLACKBUILDS.TXT";
+ if ($exit) {
+ warn $fh;
+ exit $exit;
+ }
FIRST: while (my $line = <$fh>) {
unless ($found) {
$found++, next FIRST if $name = ($line =~ $name_regex)[0];
@@ -85,7 +89,11 @@ sub perform_search($) {
sub get_file_contents($) {
exists $_[0] or script_error 'get_file_contents requires an argument';
-f $_[0] or return "$_[0] doesn't exist.\n";
- my $fh = open_read shift;
+ my ($fh, $exit) = open_read shift;
+ if ($exit) {
+ warn $fh;
+ return;
+ }
my $contents = do {local $/; <$fh>};
for ($contents) {
s/\n/\n /g;