# -v title
# -v browser_root
# -v page_bg
# -v table_bg
# -v headers_bg
# -v package
# -v config
# 


BEGIN {
  	 if (page_bg == "")
	   page_bg = "#bebebe";

	 if (table_bg == "")
	   table_bg = "#bebebe";

	 if (headers_bg == "")
	   headers_bg = "#bebebe";

         print "<HTML>";
         print "";
         print "<HEAD><TITLE>" title "</TITLE></HEAD>";
         print "";
         print "<BODY bgcolor=\"" page_bg "\">"
         print "";
         print "";
         print "<table border bgcolor=\"" table_bg "\" width=\"100%\">";
         print "<caption>";
	 print "  <font color=\"#dedede\">";
	 print "    <i>" title "</i><br>";
	 print "    <i>root package: </i><code>" package "</code><br>";
	 print "    <i>configuration: </i><code>" config "</code><br>";
	 print "  </font>";
	 print "</caption>";
	 
	 this_dist="";
	 n_components;
       }
    
{
  # read lines of the form: archive/revision:dist-name
  # build a table listing components with links to 
  # merge history patch sets
  #

  dist = $1;
  component = $1;

  sub(".*:", "", dist);
  sub(":.*", "", component);

  if (dist != this_dist)
    {
      if (this_dist != "")
	{
	  print_dist_row();
	}

      this_dist = dists;

      for (x in components)
	delete components[x];

      this_dist = dist;
      components[0] = component;
      n_components = 1;
    }
  else
    {
      components[n_components] = component;
      ++n_components;
    }
}

function print_dist_row()
{
  print "<tr>";
  print "<td><font color=\"#000000\">";

  print "<b>" this_dist "</b>";
  print "<p><i>components:</i>"
  print "<ul>"

  for (x = 0; x < n_components; ++x)
    {
      comp = components[x];

      archive = comp;
      sub("/.*", "", archive);

      rev = comp;
      sub(".*/", "", rev);

      lvl = rev;
      sub(".*--", "", lvl);

      version = rev;
      sub("--[^-]*-[^-]*$", "", version);

      branch = version;
      sub("--[^-]*$", "", branch);

      category = branch;
      sub("--[^-]+(-[^-]+)?$", "", category);

      href = "../../repos/" archive "/cats/" category "/branches/" branch "/vsns/" version "/patches-full.d/loc-" lvl ".html#" lvl;

      print "<li><a target=\"display\" href=\"" href "\">" components[x] "</a>";
    }

  print "</ul>";

  print "</font></td>";
  print "</tr>";
    
}
    
END {
      if (this_dist != "")
	print_dist_row();
      print "</table>";
      print "";
      print "</BODY>";
      print "";
      print "</HTML>";
    }

# tag: Tom Lord Sun Jan 27 18:18:53 2002 (web/distribution-right-index.awk)
#
