Changeset 4081 in genesis for tools/wleiden.pl


Ignore:
Timestamp:
Mar 16, 2005, 6:10:04 PM (20 years ago)
Author:
rick
Message:

CLeaned g_list.pl
Fixed wleiden.pl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/wleiden.pl

    r4079 r4081  
     1#!/usr/bin/perl -w
    12#
    23#
    34#  maart 2004 rick@wirelessleiden.nl
    45#
    5 
    66
    77my $debug=0;
     
    1313
    1414#variablen
    15 my $workingfile = "";
    1615my $time=gmtime();
    1716my $source=`/bin/hostname -s`;
     
    2019
    2120#slurp IP berekeningen info
    22 do ($IP_pmPath) || die ("Cann't open $IP_pmPath");
     21do ("$IP_pmPath") || die ("Cann't open $IP_pmPath");
    2322#slurp dns info
    24 do ($dnsheader_confPath) || die ("Cann't open $dnsheader_confPath");
     23do ("$dnsheader_confPath") || die ("Cann't open $dnsheader_confPath");
    2524
    2625
     
    3534      if( $1 eq $master_ip ) {
    3635        return(0);
    37         break;
    3836      };
    3937    };
     
    5957
    6058
    61 
    6259sub txtconfig {
    63   my $output = `cat $workingfile`;
    64   return($output);
    65 };
    66 
     60  my $output = "";
     61  foreach $interface (keys %config) {
     62    $output .= $config{$interface};
     63  };
     64  return($output);
     65};
    6766
    6867
     
    169168
    170169
    171 sub rc_conf {
     170sub rc_local {
    172171  my $output = genHeader("#");
    173172  my $masterNotUsed = master_ipNotUsed();
    174   print $masterNotUsed;
    175173  $output.=
    176174  "hostname=\"$nodetype$nodename.wLeiden.NET\"\n" .
     
    298296
    299297sub parse_config {
    300   $workingfile = $_[0];
     298  my $workingfile = $_[0];
    301299  do($workingfile) || die("Cann't open/parse $workingfile");
    302   foreach $if (keys %config) {
    303     $cfg=$config{$if};
     300  foreach my $if (keys %config) {
     301    my $cfg=$config{$if};
    304302    while ($cfg) {
    305303      $cfg=~s/^([^\n\r]+)[\r\n]*//m;
    306       $line=$1;
     304      my $line=$1;
    307305      $line=~s/\s*#.*//;
    308       if ((($name,$value)=split(/=/,$line)) eq 2) {
    309         $doit="if (exists(\$$name\{\"$if\"\})) {\$$name\{\"$if\"\}.=\"$separator$value\";} else {\$$name\{\"$if\"\}.=\"$value\";}";
     306      if (((my $name, my $value)=split(/=/,$line)) eq 2) {
     307        my $doit="if (exists(\$$name\{\"$if\"\})) {\$$name\{\"$if\"\}.=\";$value\";} else {\$$name\{\"$if\"\}.=\"$value\";}";
    310308        eval($doit);
    311309      };
     
    324322};
    325323
    326 if( $debug ) {
     324if( exists $ARGV[0] ) {
    327325  if( exists $ARGV[1] ) {
    328326    parse_config($ARGV[0]);
     
    333331  };
    334332};
     333
     3341;
Note: See TracChangeset for help on using the changeset viewer.