Mercurial > hg > chronicle
changeset 7:d23fa8a50a7f
2007-08-13 23:02:02 by steve
Ignore directories when looking for blog files.
Read two configuration files.
author | steve |
---|---|
date | Mon, 13 Aug 2007 23:02:02 +0000 |
parents | e35a3985f60f |
children | d9c2f0cb6096 |
files | bin/chronicle |
diffstat | 1 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/chronicle Mon Aug 13 22:57:43 2007 +0000 +++ b/bin/chronicle Mon Aug 13 23:02:02 2007 +0000 @@ -54,7 +54,7 @@ -- http://www.steve.org.uk/ - $Id: chronicle,v 1.2 2007-08-13 22:55:11 steve Exp $ + $Id: chronicle,v 1.3 2007-08-13 23:02:02 steve Exp $ =cut @@ -97,9 +97,10 @@ # -# Read the per-user configuration file. +# Read the global and per-user configuration files, if they exist. # -readConfigurationFile(); +readConfigurationFile( "/etc/chroniclerc" ); +readConfigurationFile( $ENV{'HOME'} . "/.chroniclerc" ); # @@ -293,7 +294,7 @@ if ( $VERSION ) { - my $REVISION = '$Revision: 1.2 $'; + my $REVISION = '$Revision: 1.3 $'; if ( $REVISION =~ /1.([0-9.]+) / ) { $REVISION = $1; @@ -345,6 +346,12 @@ foreach my $file ( sort( glob( $CONFIG{'input'} . "/" . $pattern ) ) ) { + # + # Ignore directories. + # + next if ( -d $file ); + + my $title = ''; my $date = ''; my $private = 0; @@ -1185,7 +1192,7 @@ =begin doc - Read the configuration file ".chroniclerc" if it exists. + Read the specified configuration file if it exists. =end doc @@ -1193,13 +1200,17 @@ sub readConfigurationFile { - my $file = $ENV{'HOME'} . "/.chroniclerc"; + my( $file ) = ( @_ ); + + # + # If it doesn't exist ignore it. + # return if ( ! -e $file ); + my $line = ""; open( FILE, "<", $file ) or die "Cannot read file '$file' - $!"; - while (defined($line = <FILE>) ) { chomp $line; @@ -1255,7 +1266,6 @@ } close( FILE ); - }