aboutsummaryrefslogtreecommitdiffstats
path: root/misc/smssend/files/patch-email2smssend
blob: f1e3ebdda98cb0524758dede7834d74214dcb864 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- email2smssend   Thu Jul 12 03:55:48 2001
+++ email2smssend   Mon Oct 20 19:57:53 2003
@@ -31,7 +31,7 @@
 my ($message, @tmp_messages, @messages);
 my ($limit_size, $limit_sms);
 my ($show_index, $reverse, $diff, $opt);
-my ($total_nb, $cpt, $prepend, $before, $after, @before__after);
+my ($total_nb, $cpt, $prepend, @before, @after);
 
 # Display usage help.  
 sub Usage {
@@ -121,10 +121,13 @@
 }
 
 # Search if a parameter is "--"
-@before__after = split (/\s--\s/, join (" ", @ARGV) . " ");
-$before = $before__after[0];
-$after = $before__after[1];
-$after = " -- " . $after if ($after ne "");
+while ($opt = shift (@ARGV)) {
+   if ($opt eq "--") {
+       @after = ($opt, @ARGV);
+       last;
+   };
+   @before = (@before, $opt);
+}
 
 # Initialize cpt
 $total_nb = scalar(@messages);
@@ -140,7 +143,7 @@
    $prepend = $cpt . "/$total_nb: " if ($show_index == 1);
    $cpt += $diff;
    # for debug, uncomment the "print" and comment the "system"
-   # print $sms_bin . " " . $before . " \"" . $prepend . $_ . "\" " . $after . "\n";
-   system ($sms_bin . " " . $before . " \"" . $prepend . $_ . "\" " . $after);
+   # print $sms_bin, " ", @before, " ", $prepend . $_, " ", @after, "\n";
+   system $sms_bin, @before, $prepend . $_, @after;
 }