5 # Copyright (C) 2008, ashley willis <barry@venamous.net>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE.
16 # See the GNU General Public License in the COPYING file at the
17 # root directory of this project for more details.
19 # converts file <BASENAME>.ipd to <BASENAME>.tar.gz, in the format of
22 # NOTES for yet-to-be tgz2ipd:
23 # dbRecordLength = computed
24 # dbVersion = second part of name
25 # dbRecordHandler = (last dbRecordHandler) + (# of records in last db) + 1
26 # recordID = first part of name
28 $BINARY = 0; # must be 0
30 $VERBOSE = 0; # optional
31 $DBID = 1; # must be 1
32 $DBRECORDLENGTH = 1; # must be 1
33 $DBRECORDHANDLER = 1; # must be 1
34 $FIELDLENGTH = 0; # optional
43 foreach $file (@ARGV) {
46 $tmpdir =~ s/^.*\//\
/tmp\//;
50 # overall header = 42 bytes
51 read(IN
, $header, 38);
52 unless ($header =~ /^Inter\@ctive Pager Backup\/Restore File
\n$/) {
53 print STDERR
"Not a valid IPD file: $file\n";
56 read(IN
, $ipdVersion, 1);
57 unless ($ipdVersion =~ /\x02/) {
58 print STDERR
"Unknown IPD version: " . Bin2dec
($ipdVersion) . "\n";
61 read(IN
, $numberOfDBs, 2);
62 read(IN
, $separator, 1); # ==