head	1.2;
access;
symbols
	RELENG_4_11_0_RELEASE:1.1.1.2
	RELENG_4_11:1.1.1.2.0.20
	RELENG_4_11_BP:1.1.1.2
	RELENG_4_10_0_RELEASE:1.1.1.2
	RELENG_4_10:1.1.1.2.0.18
	RELENG_4_10_BP:1.1.1.2
	RELENG_4_9_0_RELEASE:1.1.1.2
	RELENG_4_9:1.1.1.2.0.16
	RELENG_4_9_BP:1.1.1.2
	RELENG_4_8_0_RELEASE:1.1.1.2
	RELENG_4_8:1.1.1.2.0.14
	RELENG_4_8_BP:1.1.1.2
	RELENG_4_7_0_RELEASE:1.1.1.2
	RELENG_4_7:1.1.1.2.0.12
	RELENG_4_7_BP:1.1.1.2
	RELENG_4_6_2_RELEASE:1.1.1.2
	RELENG_4_6_1_RELEASE:1.1.1.2
	RELENG_4_6_0_RELEASE:1.1.1.2
	RELENG_4_6:1.1.1.2.0.10
	RELENG_4_6_BP:1.1.1.2
	v5_006_01:1.1.1.4
	RELENG_4_5_0_RELEASE:1.1.1.2
	RELENG_4_5:1.1.1.2.0.8
	RELENG_4_5_BP:1.1.1.2
	RELENG_4_4_0_RELEASE:1.1.1.2
	RELENG_4_4:1.1.1.2.0.6
	RELENG_4_4_BP:1.1.1.2
	RELENG_4_3_0_RELEASE:1.1.1.2
	RELENG_4_3:1.1.1.2.0.4
	RELENG_4_3_BP:1.1.1.2
	RELENG_4_2_0_RELEASE:1.1.1.2
	RELENG_4_1_1_RELEASE:1.1.1.2
	PRE_SMPNG:1.1.1.3
	RELENG_4_1_0_RELEASE:1.1.1.2
	v5_006:1.1.1.3
	RELENG_3_5_0_RELEASE:1.1.1.1.2.1
	RELENG_4_0_0_RELEASE:1.1.1.2
	RELENG_4:1.1.1.2.0.2
	RELENG_4_BP:1.1.1.2
	RELENG_3_4_0_RELEASE:1.1.1.1.2.1
	RELENG_3_3_0_RELEASE:1.1.1.1.2.1
	RELENG_3_2_PAO:1.1.1.1.2.1.0.2
	RELENG_3_2_PAO_BP:1.1.1.1.2.1
	RELENG_3_2_0_RELEASE:1.1.1.1.2.1
	v5_005_03:1.1.1.2
	RELENG_3_1_0_RELEASE:1.1.1.1
	RELENG_3:1.1.1.1.0.2
	RELENG_3_BP:1.1.1.1
	RELENG_3_0_0_RELEASE:1.1.1.1
	v5_005_02:1.1.1.1
	LWALL:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2002.05.16.10.07.54;	author markm;	state dead;
branches;
next	1.1;

1.1
date	98.09.09.06.59.50;	author markm;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	98.09.09.06.59.50;	author markm;	state Exp;
branches
	1.1.1.1.2.1;
next	1.1.1.2;

1.1.1.2
date	99.05.02.14.19.51;	author markm;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2000.06.25.11.03.10;	author markm;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2002.03.16.20.13.58;	author markm;	state Exp;
branches;
next	;

1.1.1.1.2.1
date	99.05.05.13.14.55;	author markm;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Perl is no longer in base. Long live the port!
@
text
@#!/usr/local/bin/perl

# Name:		dbinfo -- identify berkeley DB version used to create 
#			  a database file
#
# Author:	Paul Marquess
# Version: 	1.01 
# Date		16th April 1998
#
#     Copyright (c) 1998 Paul Marquess. All rights reserved.
#     This program is free software; you can redistribute it and/or
#     modify it under the same terms as Perl itself.

# Todo: Print more stats on a db file, e.g. no of records
#       add log/txn/lock files

use strict ;

my %Data =
	(
	0x053162 =>	{
			  Type 	=> "Btree",
			  Versions => 
				{
				  1	=> "Unknown (older than 1.71)",
				  2	=> "Unknown (older than 1.71)",
				  3	=> "1.71 -> 1.85, 1.86",
				  4	=> "Unknown",
				  5	=> "2.0.0 -> 2.3.0",
				  6	=> "2.3.1 or greater",
				}
			},
	0x061561 => 	{
			  Type => "Hash",
			  Versions =>
				{
				  1	=> "Unknown (older than 1.71)",
        			  2     => "1.71 -> 1.85",
        			  3     => "1.86",
        			  4     => "2.0.0 -> 2.1.0",
        			  5     => "2.2.6 or greater",
				}
			},
	) ;

die "Usage: dbinfo file\n" unless @@ARGV == 1 ;

print "testing file $ARGV[0]...\n\n" ;
open (F, "<$ARGV[0]") or die "Cannot open file $ARGV[0]: $!\n" ;

my $buff ;
read F, $buff, 20 ;

my (@@info) = unpack("NNNNN", $buff) ;
my (@@info1) = unpack("VVVVV", $buff) ;
my ($magic, $version, $endian) ;

if ($Data{$info[0]}) # first try DB 1.x format
{
    $magic = $info[0] ;
    $version = $info[1] ;
    $endian  = "Unknown" ;
}
elsif ($Data{$info[3]}) # next DB 2.x big endian
{
    $magic = $info[3] ;
    $version = $info[4] ;
    $endian  = "Big Endian" ;
}
elsif ($Data{$info1[3]}) # next DB 2.x little endian
{
    $magic = $info1[3] ;
    $version = $info1[4] ;
    $endian  = "Little Endian" ;
}
else
  { die "not a Berkeley DB database file.\n" }

my $type = $Data{$magic} ;
my $magic = sprintf "%06X", $magic ;

my $ver_string = "Unknown" ;
$ver_string = $type->{Versions}{$version}
	if defined $type->{Versions}{$version} ;

print <<EOM ;
File Type:		Berkeley DB $type->{Type} file.
File Version ID:	$version
Built with Berkeley DB:	$ver_string
Byte Order:		$endian
Magic:			$magic
EOM

close F ;

exit ;
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@Initial import of Perl5. The king is dead; long live the king!
@
text
@@


1.1.1.1.2.1
log
@MFC: Upgrade to Perl 5.00503
@
text
@d6 1
a6 1
# Author:	Paul Marquess  <Paul.Marquess@@btinternet.com>
@


1.1.1.2
log
@Maintenance releace 3 of perl5.005. Includes support for threads.
@
text
@d6 1
a6 1
# Author:	Paul Marquess  <Paul.Marquess@@btinternet.com>
@


1.1.1.3
log
@Vendor import of Perl 5.006
@
text
@d7 2
a8 2
# Version: 	1.02 
# Date		20th August 1999
d22 1
a22 1
			  Type 	   => "Btree",
d30 1
a30 2
				  6	=> "2.3.1 -> 2.7.7",
				  7	=> "3.0.0 or greater",
d34 1
a34 1
			  Type     => "Hash",
d41 1
a41 9
        			  5     => "2.2.6 -> 2.7.7",
        			  6     => "3.0.0 or greater",
				}
			},
	0x042253 => 	{
			  Type     => "Queue",
			  Versions =>
				{
				  1	=> "3.0.0 or greater",
@


1.1.1.4
log
@Vendor import Perl 5.6.1
@
text
@d7 2
a8 2
# Version: 	1.03 
# Date		17th September 2000
d10 1
a10 1
#     Copyright (c) 1998-2000 Paul Marquess. All rights reserved.
d31 1
a31 2
				  7	=> "3.0.x",
				  8	=> "3.1.x or greater",
d43 1
a43 2
        			  6     => "3.0.x",
        			  7     => "3.1.x or greater",
d50 1
a50 3
				  1	=> "3.0.x",
				  2	=> "3.1.x",
				  3	=> "3.2.x or greater",
d89 1
a89 1
$magic = sprintf "%06X", $magic ;
@


