# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# bos720 src/bos/usr/sbin/snappd/scripts/IPTokenRing.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
# @(#)05 1.4 src/bos/usr/sbin/snappd/scripts/IPTokenRing.pl, snapp, bos720 5/31/02 07:50:43
#--------------------------------------------------------------------------
#--------Token Ring Interface Selection Page for Snapp Program -----------
#--------------------------------------------------------------------------
#--------This page is used to select an Interface to use -----------
#--------for Minimum Configuration and Setup -------------------
#--------------------------------------------------------------------------
#--------Links to Pages: IPSetTokenRing.pl(if any) or IPMinConfig.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 tr | /usr/bin/grep Token`)
{
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 = "1502025356035 ";
}
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 <Minimum Configuration Setup100152051503025201565
$ButtonString
EOXML
close(OUTFILE);
system("/usr/bin/cp /var/snapp/snapp.fres.tmp /var/snapp/snapp.fres");