X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=update-config;fp=update-config;h=a7f87f3205c442bb707348a78bd971a11735398f;hb=42a6560ca0aa3325296f3ea72096232cdc056cb5;hp=0000000000000000000000000000000000000000;hpb=e4d5c2aa7fa9dc49cbdece5472dcb155d5833ea9;p=nj-awaymsg.git diff --git a/update-config b/update-config new file mode 100755 index 0000000..a7f87f3 --- /dev/null +++ b/update-config @@ -0,0 +1,28 @@ +#!/usr/bin/perl -w + +use strict; + +use AwayMsg; + +db_connect(); + +$dbh->do("BEGIN"); + +$dbh->do("DELETE FROM config"); + +my $sth= $dbh->prepare("INSERT INTO config". + " (emailaddr, username, forwardfile)". + " VALUES (?,?,?)"); + +open C, "config" or die $!; +while () { + s/^\s+//; + next if m/^\#/; + chomp or die; + s/\s+$//; + my @s = split; + die "$_ ?" unless @s==3; + $sth->execute(@s); +} + +db_commit();