equal
deleted
inserted
replaced
|
1 #!/usr/bin/perl |
|
2 |
|
3 # Copyright (c) 2009 Symbian Foundation Ltd |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the License "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Symbian Foundation Ltd - initial contribution. |
|
11 # Maciej Seroka, maciej@symbian.org |
|
12 # |
|
13 # Description: |
|
14 # This is a tool for removing proxy settings from ethernetced.xml. |
|
15 |
|
16 use Tie::File; |
|
17 |
|
18 my $filename; |
|
19 if ($ARGV[0]) { |
|
20 $filename = $ARGV[0]; |
|
21 } |
|
22 else { die 'Missing parameter "filename"'; } |
|
23 |
|
24 my $LINE; |
|
25 print $filename; |
|
26 tie @LINE, 'Tie::File', $filename or die 'file not found'; |
|
27 my $n = 0; |
|
28 my $proxy_begin = 0; |
|
29 my $proxy_end = 0; |
|
30 |
|
31 for (@LINE) { |
|
32 if ($LINE[$n] =~ /<ProxyTable>/) { |
|
33 $proxy_begin = $n; |
|
34 } |
|
35 if ($LINE[$n] =~ /<\/ProxyTable>/) { |
|
36 $proxy_end = $n; |
|
37 last; |
|
38 } |
|
39 $n += 1; |
|
40 } |
|
41 |
|
42 if ($proxy_end > 0) { |
|
43 splice @LINE, $proxy_begin, ($proxy_end - $proxy_begin + 1); |
|
44 } |
|
45 |
|
46 untie @LINE; |