I could lose my cellphone, and it doesn't provide much metadata about when entries were added, so I'd like to keep its phone book in CVS.
I had a program to dump the phone's phonebook before, but it got lost when my disk crashed back in September. I wrote this version this morning in a hurry. Loading the numbers back into the phone uses at#pbokw commands, which I don't remember the syntax of, and hope I never have to. #!/usr/bin/perl -w use strict; my $modem = '/dev/ttyS0'; # these were the settings stty thought interesting enough to report # after I exited minicom, and they work, but they're probably # excessive. system "stty 19200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke < '$modem'" and die "stty failed"; open MODEM, "+<$modem" or die "Couldn't open $modem: $!"; select MODEM; $| = 1; select STDOUT; print MODEM "at#pmode=1\r"; my $junk = <MODEM>; { my $cleanupstring = "\rat#pmode=0\r"; sub cleanup { syswrite(MODEM, $cleanupstring); die "\n"; } } $SIG{INT} = \&cleanup; $SIG{TERM} = \&cleanup; $SIG{HUP} = \&cleanup; $SIG{__DIE__} = \&cleanup; sub expect_ok { my $ok = <MODEM>; die "bad ok $ok" unless $ok eq "OK\r\n"; } expect_ok; for my $i (1..229) { print MODEM "at#pbokr=$i\r"; my $echo = <MODEM>; die "bad echo $echo" unless $echo =~ /^at#pbokr=$i/; my $line = <MODEM>; if ($line eq "OK\r\n") { print "No phonebook entry $i\n"; } else { print $line; expect_ok; } } cleanup; -- <[EMAIL PROTECTED]> Kragen Sitaker <http://www.pobox.com/~kragen/> I don't do .INI, .BAT, .DLL or .SYS files. I don't assign apps to files. I don't configure peripherals or networks before using them. I have a computer to do all that. I have a Macintosh, not a hobby. -- Fritz Anderson