Applied Ashley Willis's perlbarry package.
[barry/pauldeden.git] / contrib / perlbarry / misc / dump-simple
blobb4a6d217e8d30eb93ce3e04ecc0e4e4a159e5cf2
1 #!/usr/bin/perl
3 # dump-simple version 0.1
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 # backs up each DB in phone to file <DB>.dump
21 `bcharge`; # inits phone
22 @list = `btool -t`; # gets list of databases
23 $i = 0;
25 foreach (@list) {
26 if (s/ Database: 0x[\da-f][\da-f]? //) {
27 ($db[$i], $records[$i]) = split(/ \(records: /);
28 $records[$i] =~ s/\)$//;
29 print "### $i $db[$i] ###\n";
30 print `btool -n -d $db[$i] > $db[$i].dump`;
31 $i++;
34 print "count=$i\n";