47 |
|
$retry_wait = 60; |
48 |
|
|
49 |
|
# write our PID to a file |
50 |
< |
$pidfile = "/var/tmp/ihost.pid"; |
50 |
> |
# use home dir by default |
51 |
> |
$pidfile = $ENV{"HOME"}; |
52 |
> |
# or drop it in /var/tmp if we can't find HOME |
53 |
> |
$pidfile = "/var/tmp" if not defined $pidfile; |
54 |
> |
$pidfile .= "/.ihost.pid"; |
55 |
|
&write_pid(); |
56 |
|
|
57 |
|
&tcp_configure(); |
281 |
|
push(@data, "packet.attributes.type=data"); |
282 |
|
push(@data, "packet.attributes.ip=$ip"); |
283 |
|
|
284 |
+ |
# sort the data |
285 |
+ |
@data = sort(@data); |
286 |
+ |
|
287 |
|
# turn the array into some nice XML |
288 |
|
my($xml) = &make_xml("", ""); |
289 |
|
|
406 |
|
sub make_xml() { |
407 |
|
my($curlevel, $curline) = @_; |
408 |
|
my($xmltemp) = ""; my($curtag) = ""; my($attributes) = ""; |
409 |
< |
while(true) { |
409 |
> |
while(1) { |
410 |
|
$curline = shift(@data) if $curline eq ""; chomp $curline; |
411 |
|
if($curline =~ /^$curlevel([^\.\s]+\.)/) { |
412 |
|
$curtag=$1; |
422 |
|
} |
423 |
|
my($nextline) = $data[0]; chomp $nextline if defined $nextline; |
424 |
|
$curtag =~ s/(.*)\./$1/; |
425 |
< |
if(defined $nextline && $nextline =~ /^$curlevel$curtag\./) { |
425 |
> |
if((defined $nextline) && ($nextline =~ /^$curlevel$curtag\./)) { |
426 |
|
$curline = ""; |
427 |
|
} |
428 |
|
else { |