patch to fix kfreebsd FTBFS
[debian/amanda] / server-src / amoverview.pl
index 9990635a68b0bca0bb8470d771521544a9d20f32..f5e5b31d4adfbbfb0006f48698590186fdaa43ac 100644 (file)
@@ -31,22 +31,21 @@ use POSIX;
 
 sub Usage {
     print STDERR <<END;
 
 sub Usage {
     print STDERR <<END;
-Usage: $0 [[--config] CONFIG] [--hostwidth width] [--diskwidth width]
-         [-skipmissed] [--last] [--num0] [--togo0] [--verbose]
+Usage: $0 [--hostwidth width] [--diskwidth width] [--skipmissed]
+         [--last] [--num0] [--togo0] [--verbose] [--config] <config>
 
 This script generates to standard output an overview of the filesystems
 dumped over time and the type of dump done on a particular day, such as
 a full dump, or an incremental, or if the dump failed.
 
 
 This script generates to standard output an overview of the filesystems
 dumped over time and the type of dump done on a particular day, such as
 a full dump, or an incremental, or if the dump failed.
 
-You may override the default configuration `@DEFAULT_CONFIG@' by using
-the --config command line option.  On larger installations, this script
-will take a while to run.  In this case, run it with --verbose to see
-how far along it is.
+On larger installations, this script will take a while to run.  In this case,
+run it with --verbose to see how far along it is.
 END
     exit 1;
 }
 
 # overrideable defaults
 END
     exit 1;
 }
 
 # overrideable defaults
+my $opt_version;
 my $opt_config         = undef;
 my $opt_hostwidth      = 8;
 my $opt_diskwidth      = 20;
 my $opt_config         = undef;
 my $opt_hostwidth      = 8;
 my $opt_diskwidth      = 20;
@@ -56,7 +55,8 @@ my $opt_num0          = 0;
 my $opt_togo0          = 0;
 my $opt_verbose                = 0;
 
 my $opt_togo0          = 0;
 my $opt_verbose                = 0;
 
-GetOptions('config=s'          => \$opt_config,
+GetOptions('version'            => \$opt_version,
+          'config=s'           => \$opt_config,
           'hostwidth=i'        => \$opt_hostwidth,
           'diskwidth=i'        => \$opt_diskwidth,
           'skipmissed'         => \$opt_skipmissed,
           'hostwidth=i'        => \$opt_hostwidth,
           'diskwidth=i'        => \$opt_diskwidth,
           'skipmissed'         => \$opt_skipmissed,
@@ -66,10 +66,17 @@ GetOptions('config=s'               => \$opt_config,
           'verbose'            => \$opt_verbose)
 or Usage();
 
           'verbose'            => \$opt_verbose)
 or Usage();
 
-if(@ARGV == 1) {
-  $opt_config = $ARGV[0];
-} else {
-  Usage();
+if (defined $opt_version) {
+    print "amoverview-" . $Amanda::Constants::VERSION , "\n";
+    exit 0;
+}
+
+unless(defined($opt_config)) {
+    if (@ARGV == 1) {
+       $opt_config = $ARGV[0];
+    } else {
+       Usage();
+    }
 }
 
 #Initialize configuration
 }
 
 #Initialize configuration