/usr/lib/amanda/perl/Amanda/Cmdline.pm is in amanda-common 1:3.3.6-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
package Amanda::Cmdline;
use base qw(Exporter);
use base qw(DynaLoader);
package Amanda::Cmdlinec;
bootstrap Amanda::Cmdline;
package Amanda::Cmdline;
@EXPORT = qw();
# ---------- BASE METHODS -------------
package Amanda::Cmdline;
sub TIEHASH {
my ($classname,$obj) = @_;
return bless $obj, $classname;
}
sub CLEAR { }
sub FIRSTKEY { }
sub NEXTKEY { }
sub FETCH {
my ($self,$field) = @_;
my $member_func = "swig_${field}_get";
$self->$member_func();
}
sub STORE {
my ($self,$field,$newval) = @_;
my $member_func = "swig_${field}_set";
$self->$member_func($newval);
}
sub this {
my $ptr = shift;
return tied(%$ptr);
}
# ------- FUNCTION WRAPPERS --------
package Amanda::Cmdline;
*format_dumpspec_components = *Amanda::Cmdlinec::format_dumpspec_components;
*parse_dumpspecs = *Amanda::Cmdlinec::parse_dumpspecs;
*header_matches_dumpspecs = *Amanda::Cmdlinec::header_matches_dumpspecs;
############# Class : Amanda::Cmdline::dumpspec_t ##############
package Amanda::Cmdline::dumpspec_t;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( Amanda::Cmdline );
%OWNER = ();
%ITERATORS = ();
*swig_host_get = *Amanda::Cmdlinec::dumpspec_t_host_get;
*swig_host_set = *Amanda::Cmdlinec::dumpspec_t_host_set;
*swig_disk_get = *Amanda::Cmdlinec::dumpspec_t_disk_get;
*swig_disk_set = *Amanda::Cmdlinec::dumpspec_t_disk_set;
*swig_datestamp_get = *Amanda::Cmdlinec::dumpspec_t_datestamp_get;
*swig_datestamp_set = *Amanda::Cmdlinec::dumpspec_t_datestamp_set;
*swig_level_get = *Amanda::Cmdlinec::dumpspec_t_level_get;
*swig_level_set = *Amanda::Cmdlinec::dumpspec_t_level_set;
*swig_write_timestamp_get = *Amanda::Cmdlinec::dumpspec_t_write_timestamp_get;
*swig_write_timestamp_set = *Amanda::Cmdlinec::dumpspec_t_write_timestamp_set;
sub new {
my $pkg = shift;
my $self = Amanda::Cmdlinec::new_dumpspec_t(@_);
bless $self, $pkg if defined($self);
}
sub DESTROY {
return unless $_[0]->isa('HASH');
my $self = tied(%{$_[0]});
return unless defined $self;
delete $ITERATORS{$self};
if (exists $OWNER{$self}) {
Amanda::Cmdlinec::delete_dumpspec_t($self);
delete $OWNER{$self};
}
}
*format = *Amanda::Cmdlinec::dumpspec_t_format;
sub DISOWN {
my $self = shift;
my $ptr = tied(%$self);
delete $OWNER{$ptr};
}
sub ACQUIRE {
my $self = shift;
my $ptr = tied(%$self);
$OWNER{$ptr} = 1;
}
# ------- VARIABLE STUBS --------
package Amanda::Cmdline;
*CMDLINE_PARSE_DATESTAMP = *Amanda::Cmdlinec::CMDLINE_PARSE_DATESTAMP;
*CMDLINE_PARSE_LEVEL = *Amanda::Cmdlinec::CMDLINE_PARSE_LEVEL;
*CMDLINE_EMPTY_TO_WILDCARD = *Amanda::Cmdlinec::CMDLINE_EMPTY_TO_WILDCARD;
*CMDLINE_EXACT_MATCH = *Amanda::Cmdlinec::CMDLINE_EXACT_MATCH;
@EXPORT_OK = ();
%EXPORT_TAGS = ();
=head1 NAME
Amanda::Cmdline - utilities for handling command lines
=head1 SYNOPSIS
use Amanda::Cmdline;
my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level, $write_timestamp);
print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
$Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
=head1 Amanda::Cmdline::dumpspec_t Objects
Note that this class was called C<Amanda::Cmdline::dumpspec_t> in older versions;
that name will still work, but is deprecated.
=head2 Keys
Each key contains a match expression, in the form of a string, or undef. Note
that the values of these keys are read-only.
=over
=item C<< $ds->{'host'} >>
Hostname
=item C<< $ds->{'disk'} >>
Disk name
=item C<< $ds->{'datestamp'} >>
Dump timestamp.
=item C<< $ds->{'level'} >>
Dump level
=item C<< $ds->{'write_timestamp'} >>
Timestamp when the dump is written to storage media.
=back
=head2 Methods
=over
=item C<< $ds->format() >>
Format the dumpspec as a string.
=back
=head1 Package Functions
=over
=item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
This function returns a string representing the formatted form of the
given dumpspec. This formatting is the same as performed by
C<< $ds->format() >>, but does not need a C<Dumpspec>.
=item C<parse_dumpspecs([@cmdline], $flags)>
This function parses C<@cmdline> into a list of C<Dumpspec> objects,
according to C<$flags>, which is a logical combination of zero or more
of
$CMDLINE_PARSE_DATESTAMP - recognize datestamps
$CMDLINE_PARSE_LEVEL - recognize levels
$CMDLINE_EMPTY_TO_WILDCARD - if @cmdline is empty, make a wildcard dumpspec
These constants are available in export tag C<:constants>. The command-line
format is
[host [disk [datestamp [level [host [..]]]]]]
Note that there is no facility for specifying C<write_timestamp> on the command
line.
=item C<header_matches_dumpspecs($hdr, [@dumpspecs])>
This function compares a header to a list of dumpspecs, returning true if the
header matches at least one dumpspec. If C<@dumpspecs> is empty, the function
returns false.
=back
=head1 SEE ALSO
L<Amanda::Config> handles C<-o> options itself, through
C<config_overrides>.
=cut
push @EXPORT_OK, qw(cmdline_parse_dumpspecs_flags_to_strings);
push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw(cmdline_parse_dumpspecs_flags_to_strings);
my %_cmdline_parse_dumpspecs_flags_VALUES;
#Convert a flag value to a list of names for flags that are set.
sub cmdline_parse_dumpspecs_flags_to_strings {
my ($flags) = @_;
my @result = ();
for my $k (keys %_cmdline_parse_dumpspecs_flags_VALUES) {
my $v = $_cmdline_parse_dumpspecs_flags_VALUES{$k};
#is this a matching flag?
if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
push @result, $k;
}
}
#by default, just return the number as a 1-element list
if (!@result) {
return ($flags);
}
return @result;
}
push @EXPORT_OK, qw($CMDLINE_PARSE_DATESTAMP);
push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_DATESTAMP);
$_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_DATESTAMP"} = $CMDLINE_PARSE_DATESTAMP;
push @EXPORT_OK, qw($CMDLINE_PARSE_LEVEL);
push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_LEVEL);
$_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_LEVEL"} = $CMDLINE_PARSE_LEVEL;
push @EXPORT_OK, qw($CMDLINE_EMPTY_TO_WILDCARD);
push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_EMPTY_TO_WILDCARD);
$_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_EMPTY_TO_WILDCARD"} = $CMDLINE_EMPTY_TO_WILDCARD;
push @EXPORT_OK, qw($CMDLINE_EXACT_MATCH);
push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_EXACT_MATCH);
$_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_EXACT_MATCH"} = $CMDLINE_EXACT_MATCH;
#copy symbols in cmdline_parse_dumpspecs_flags to constants
push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}};
push @EXPORT_OK, qw(header_matches_dumpspecs parse_dumpspecs format_dumpspec_components);
1;
|