#! /usr/local/bin/perl
# <Christian.Queinnec@lip6.fr>
# Syntax: write-bbdb [~/.bbdb] ...
#
# This one-shot perl script converts my BBDB data base to a PALMIII. Since
# I still read my mail with Emacs, I use this script regularly.

#     This program is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2 of the License, or
#     (at your option) any later version.

#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.

#     You should have received a copy of the GNU General Public License
#     along with this program; if not, write to the Free Software
#     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

use diagnostics;
diagnostics::enable();

my $verbose = 0;

my $pilotFile = "/tmp/bbdb.tmp";

if ( $#ARGV == -1 ) {
    @ARGV = ( $ENV{'HOME'}."/.bbdb" );
}

open(TOPILOT, "> $pilotFile")
    || die "Cannot write into $pilotFile.";

undef $/;
$_ = <>;



close(TOPILOT) 
    || die "Cannot close $pilotFile";

exec "echo pilot-addresses /dev/pilot -w $pilotFile"
    || die "Cannot run install-datebook.";

# end of write-bbdb.pl
