# IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/sbin/snappd/scripts/DHCPSEthernet.pl 1.4 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2000,2002 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # #!/usr/bin/perl -T # @(#)85 1.4 src/bos/usr/sbin/snappd/scripts/DHCPSEthernet.pl, snapp, bos720 5/31/02 07:49:40 #--------------------------------------------------------- #-------- Name DHCPSEthernet.pl #--------------------------------------------------------- #-------- Displays the list of standard ethernet #-------- interfaces available for DHCP configuration. #--------------------------------------------------------- #-------- Links to pages: IPMinConfig.pl #-------- DHCPSetup.pl #--------------------------------------------------------- $ENV{'PATH'} = '/bin:/usr/bin:/usr/sbin'; $i = 0; #find the Interfaces of standard type and store them in a array (or possible hash) foreach $ifname (`/usr/sbin/lsdev -Cc if | /usr/bin/grep en | /usr/bin/grep Ethernet`) { if ($ifname =~ s/([a-z0-9]+).*/\1/) { ($temp, $t) = split(" ", $ifname); @hshInterfaces[$i] = $temp; $i++; } } #set some Strings to default values $ButtonString = ""; $tempX = "10\n"; $tempDY = "20\n"; $tempDX = "75\n"; #This dynamically builds the page to be displayed. This creates a button for each interface #and then displays it on the page as needed. if($i == 0) { #the lsdev command didn't return any interfaces $ButtonString = "150 20 25 35 60 35 "; } else { #there are 2 or more interfaces, get all the pairs and put them ijn the xml page row by row #whatever is left (if anything) will be caught next for ($loop_index = 0; ($i - $loop_index) >= 2; $loop_index = $loop_index + 2) { $tempInterface = @hshInterfaces[$loop_index]; $tempInterface1 = @hshInterfaces[$loop_index + 1]; $tempString = ""; $tempString1 = ""; $ButtonString = join ' ', $ButtonString, $tempX, $tempDY, $tempString, $tempDX, $tempString1, "\n"; } #if there is one interface left, put it in the xml page to be displayed if(($i - $loop_index) == 1) { $tempInterface = @hshInterfaces[$loop_index]; $tempString = ""; $ButtonString = join ' ', $ButtonString, "45", $tempDY, $tempString, "\n"; } } open(OUTFILE,">/var/snapp/snapp.fres.tmp"); print OUTFILE < DHCP Interface Selection 100 15 20 5 150 30 25 25 15 65 $ButtonString EOXML close(OUTFILE); system("/usr/bin/cp /var/snapp/snapp.fres.tmp /var/snapp/snapp.fres");