<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Archive::Cpio::Common;

use Archive::Cpio::FileHandle_with_pushback;

use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(padding write_or_die max begins_with);

sub magics() {
    {
        "070707" =&gt; 'ODC',
        "070701" =&gt; 'NewAscii',
        "\xC7\x71" =&gt; 'OldBinary', # swabbed 070707
        "\x71\xC7" =&gt; 'OldBinary', # 070707
    };
}

sub padding {
    my ($nb, $offset) = @_;

    my $align = $offset % $nb;
    $align ? $nb - $align : 0;
}

sub write_or_die {
    my ($F, $val) = @_;
    print $F $val or die "writing failed: $!\n";
}

sub max  { my $n = shift; $_ &gt; $n and $n = $_ foreach @_; $n }
sub begins_with {
    my ($s, $prefix) = @_;
    index($s, $prefix) == 0;
}

1;
</pre></body></html>