Changeset 33

Show
Ignore:
Timestamp:
05/10/05 17:01:40 (4 years ago)
Author:
ludo
Message:

small additions to info and lbs-lib (from r2273)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/admin/perl/info

    r14 r33  
    11#!/usr/bin/perl 
    22# 
    3 # $Id: info 1686 2004-12-16 13:58:09Z root
     3# $Id
    44# 
    5 # Linbox Rescue Server 
    6 # Copyright (C) 2005  Linbox FAS 
    7 # 
    8 # This program is free software; you can redistribute it and/or 
    9 # modify it under the terms of the GNU General Public License 
    10 # as published by the Free Software Foundation; either version 2 
    11 # of the License, or (at your option) any later version. 
    12 # 
    13 # This program is distributed in the hope that it will be useful, 
    14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 
    15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    16 # GNU General Public License for more details. 
    17 # 
    18 # You should have received a copy of the GNU General Public License 
    19 # along with this program; if not, write to the Free Software 
    20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    215 
    226my $devicelist; 
     
    5842sub getclass { 
    5943 my ($class,$subclass)=@_; 
    60  $class=sprintf "%02x",hex($class); 
    61  $subclass=sprintf "%02x",hex($subclass); 
    62  
     44  
     45 if ($subclass eq "") { 
     46    $subclass=substr $class,2,2;     
     47    $class=substr $class,0,2; 
     48 } else { 
     49    $class=sprintf "%02x",hex($class); 
     50    $subclass=sprintf "%02x",hex($subclass); 
     51 } 
     52  
    6353 open(REF,$devicelist) or die; 
    6454 while (<REF>) 
  • trunk/server/admin/perl/lbs-lib.pl

    r14 r33  
    542542 
    543543 
    544 # $macaddr etherGetMacByName (\%einfo, $name
     544# $macaddr etherGetMacByName (\%einfo, $name, $isshortname ?
    545545# Retourne une adresse MAC a partir d'un nom d'hote. 
    546546# Se base sur la structure retournee par etherLoad(). 
     547# si shortname est defini, tronque chaque nom en version courte (nom netbios 
     548# en principe) 
    547549# 
    548550sub etherGetMacByName 
     
    550552my $einfo = shift ; 
    551553my $name = shift ; 
     554my $isshortname = shift ; 
    552555my ($k,$v, $l) ; 
    553556 
     
    558561                $v = ${$einfo}{$k} ; 
    559562                $l = lc( $$v[1] ) ; 
     563                $l =~ s|.*/|| if defined($isshortname); 
    560564                return $k if ($l eq $name) ; 
    561565        }