ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/ihost.pl
(Generate patch)

Comparing projects/cms/source/host/ihost-perl/ihost.pl (file contents):
Revision 1.37 by tdb, Mon Nov 19 14:15:14 2001 UTC vs.
Revision 1.42 by tdb, Wed Nov 21 10:08:20 2001 UTC

# Line 47 | Line 47 | $seq_no = 1;
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();
# Line 277 | Line 281 | sub send_udp_packet() {
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      
# Line 289 | Line 296 | sub send_udp_packet() {
296      print $sock $xml or die "Could not send UDP packet: $!\n";
297      close($sock);
298      $seq_no++;
299 <    print "-: $xml\n";
299 >    print "-";
300      
301      return;
302   }
# Line 399 | Line 406 | sub write_pid() {
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;
# Line 415 | Line 422 | sub make_xml() {
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 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines