"68k");
$trans_ppc = Array("ALL_CPU_TYPES" => "ppc");
$filename = "$build_path/$version/compile/pkg";
$fileptr = fopen($filename,"r");
if ($fileptr == false)
{
echo "Failed to open file: $filename
\n";
echo "Please check the BSS software is properly installed
\n";
return;
}
$pkg = fgets($fileptr,3);
fclose($fileptr);
$filename = "$build_path/$version/compile/bssdist.fls";
$fileptr = fopen($filename,"r");
if ($fileptr == false)
{
echo "Failed to open file: $filename
\n";
echo "Please check the BSS software is properly installed
\n";
return;
}
while ( !feof($fileptr) )
{
/***********************************************************
* Read the input file line by line for ":bschd" or ":bsxhd"
***********************************************************/
$buffer = ltrim(fgets($fileptr, 1024));
$exist = ereg(":" . $iwbox_type ,$buffer);
if ( $exist == false)
continue;
/***********************
* Extract the comment
***********************/
$commentstart = strpos($buffer,"#");
if ($commentstart === false)
{
$theline = rtrim($buffer);
}
else
{
$theline = rtrim(substr($buffer,0,$commentstart));
}
if ($theline == "")
continue;
/**********************************************************
* Split the line into 2 columns delimited by space or tab
* Process each column seperately
**********************************************************/
$column = split("[ \t]+",$theline);
$left = $column[0];
/*****************************************
* Process the left column
*
* Remarks:
* bschd= or bsxhd=
* root mean /hd0/
* path is meaningless for hdxfer
*
*****************************************/
$left_field_by_colon = explode(":",$left);
if ($left_field_by_colon[0] == $left)
{
echo "
Error decoding bssdist.fls
\n";
return;
}
$src_path = "$src_prefix/$version";
$src_file = $left_field_by_colon[0];
$dest_path = "$version";
$dest_file = $left_field_by_colon[0];
// For each field seperated by ":"
// e.g. vxWorks:bschd=vxWorks=root:bsxhd=vxWorks=root
for ($i=1;isset($left_field_by_colon[$i]); $i++)
{
if (ereg($iwbox_type,$left_field_by_colon[$i]) == false)
continue;
$left_sub_field = explode($iwbox_type . "=",$left_field_by_colon[$i]);
if ($left_sub_field[0] != $left_field_by_colon[$i])
{
// "bschd=XXXX" or bschd=XXXX=root , "bsxhd=XXXX" or bsxhd=XXXX=root
$left_sub_sub_field = explode("=",$left_sub_field[1]);
$dest_file = "$left_sub_sub_field[0]";
// "bschd=XXXX=root", "bsxhd=XXXX=root"
$store_in_hd0 = ereg("=root", $left_sub_field[1]);
if ($store_in_hd0 != false)
{
$output[$index++]
= Array("$src_path/$src_file", "$dest_file");
//echo "$src_path/$src_file --> $dest_file
";
}
}
break; // break because we just do ":bschd" or ":bsxhd"
}
for ($i=1;isset($column[$i]);$i++)
{
// ne:file
$right_field = explode(":",$column[$i]);
if (!strcmp($right_field[0],$pkg))
{
if (ereg(":r$",$column[$i]) == false)
{
$src_file = $right_field[1];
$dest_file = $right_field[1];
}
break;
}
}
//
// processing the right column NOW (seperated by TAB)
// e.g. ne:trxxil/irprxicn.bit a52:trxxil/irprxic2.bit:r
//
if (ereg("ALL_CPU_TYPES",$src_file) || ereg("ALL_CPU_TYPES",$dest_file))
{
$output[$index++]
= Array(strtr("$src_path/$src_file",$trans_68k), strtr("$dest_path/$dest_file",$trans_68k));
$output[$index++]
= Array(strtr("$src_path/$src_file",$trans_ppc), strtr("$dest_path/$dest_file",$trans_ppc));
//echo strtr("$src_path/$src_file --> $dest_path/$dest_file
",$trans_68k);
//echo strtr("$src_path/$src_file --> $dest_path/$dest_file
",$trans_ppc);
}
else
{
$output[$index++] = Array("$src_path/$src_file", "$dest_path/$dest_file");
//echo "$src_path/$src_file --> $dest_path/$dest_file
";
}
}
fclose($fileptr);
return ($output);
}
?>