# HG changeset patch # User Christian Arnold # Date 1297511651 -3600 # Node ID 2be9944bc67b8e6162165c3b819a812b9de6ac8c # Parent 52edcba85acfc2f10c56354e508410a748422ac9 add version subroutine exit if no filesystem is specified change to version 0.2 diff -r 52edcba85acf -r 2be9944bc67b check_fsck.pl --- a/check_fsck.pl Mon Jan 31 21:07:11 2011 +0100 +++ b/check_fsck.pl Sat Feb 12 12:54:11 2011 +0100 @@ -26,8 +26,8 @@ use Getopt::Long; use Date::Manip; -delete @ENV{grep /^LC_/ => keys %ENV}; -$ENV{LANG} = "C"; +delete @ENV{ grep /^LC_/ => keys %ENV }; +$ENV{LANG} = "C"; $ENV{LC_ALL} = "C"; my %ERRORS = ( @@ -39,10 +39,11 @@ ); my $ME = basename $0; -my $VERSION = "0.1"; +my $VERSION = "0.2"; sub get_status($); sub report($); +sub version($$); my %opt = ( fs => undef, @@ -67,6 +68,8 @@ "V|version" => sub { version( $ME, $VERSION ); exit $ERRORS{OK}; } ) or pod2usage( -verbose => 1, -exitval => $ERRORS{CRITICAL} ); + $opt{fs} // pod2usage( -verbose => 1, -exitval => $ERRORS{CRITICAL} ); + ### %opt report( get_status( $opt{fs} ) ); @@ -123,7 +126,8 @@ foreach my $fs (@fs) { unless ( -b -r $fs ) { - say "FSCK CRITICAL $fs - not a block device or no read permission is granted"; + say +"FSCK CRITICAL $fs - not a block device or no read permission is granted"; exit $ERRORS{CRITICAL}; } foreach ( @@ -169,6 +173,18 @@ return \%values; } +sub version($$) { + my ( $progname, $version ) = @_; + print <<_VERSION; +$progname version $version +Copyright (C) 2011 by Christian Arnold and Schlittermann internet & unix support. + +$ME comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to redistribute it under certain conditions. +See the GNU General Public Licence for details. +_VERSION +} + __END__ =head1 NAME @@ -237,7 +253,7 @@ =head1 VERSION -This man page is current for version 0.1 of check_fsck. +This man page is current for version 0.2 of check_fsck. =head1 AUTHOR