Permalink
Browse files

Make sure we allow config items with dashes.

Allow log-line-prefix in config files.
  • Loading branch information...
1 parent 5ff996d commit e2381069d33ecddf379eab413ed9fdee8cea1805 @turnstep turnstep committed Feb 8, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 tail_n_mail
View
@@ -543,7 +543,7 @@ sub parse_rc_files {
open my $rc, '<', $file or die qq{Could not open "$file": $!\n};
while (<$rc>) {
next if /^\s*#/;
- next if ! /^\s*(\w+)\s*[=:]\s*(.+?)\s*$/o;
+ next if ! /^\s*([\w\-]+)\s*[=:]\s*(.+?)\s*$/o;
my ($name,$value) = (lc $1,$2);
$opt{$curr}{$name} = $value;
$arg{$name} = $value;
@@ -604,7 +604,7 @@ sub parse_config_file {
}
## A non-comment after one or comments allows us to map them to each other
- if (@comment and m{^(\w+):}) {
+ if (@comment and m{^([\w\-]+):}) {
chomp;
for my $c (@comment) {
## We store as both the keyword and the entire line
@@ -691,6 +691,10 @@ sub parse_config_file {
$arg{tempfile_limit} = $localopt{tempfile_limit} = $1;
}
}
+ ## Allow a very local log_line_prefix
+ elsif (/^LOG\-LINE\-PREFIX:\s*(.+)/) {
+ $localopt{'log-line-prefix'} = $1;
+ }
## How to sort the output
elsif (/^SORTBY:\s*(\w+)/) {
$localopt{sortby} = $1;
@@ -2484,7 +2488,7 @@ sub final_cleanup {
## Last updated: $now
};
- for my $item (qw/ email from type mailsig duration tempfile find_line_number sortby duration_limit tempfile_limit/) {
+ for my $item (qw/ log-line-prefix email from type mailsig duration tempfile find_line_number sortby duration_limit tempfile_limit/) {
next if ! exists $opt{$curr}{$item};
next if $item eq 'duration' and $arg{duration} < 0;

0 comments on commit e238106

Please sign in to comment.