--- sms.alert 2003/02/14 14:52:02 1.5 +++ sms.alert 2003/02/21 10:36:01 1.7 @@ -28,7 +28,7 @@ # where 123456 is phone number (with country prefix, but without +) and # name is alias used like: # -# sms.alter -f dobrica +# sms.alert -f dobrica # # in mon.cf @@ -38,7 +38,7 @@ use strict; my %opt; use Getopt::Std; -getopts ("S:s:g:h:t:l:uf"); +getopts ("S:s:g:h:t:l:uf", \%opt); # read addressbook my %name2phone; @@ -79,13 +79,16 @@ # add rest of text $sms .= join("\n",@MSG) if $opt{x}; +my $suffix = 0; + foreach my $to (@ARGV) { - if (open(SMS, "> $sms_outgoing/mon$$")) { + if (open(SMS, "> $sms_outgoing/mon-$$-$suffix")) { my $phone = $to; $phone = $name2phone{lc($to)} if ($name2phone{lc($to)}); die "$phone is not phone number! " if ($phone !~ m/^\d+$/); print SMS "To: $phone\n$sms"; close SMS; + $suffix++; } else { die "could not open sms file in '$sms_outgoing': $!"; }