Listing 2

poly(nverts, poly_list)
int nverts, *poly_list [];
{
  int i;
  
  /*
    see if vertices list is closed
    and close it if not
  */
  if (poly_list [0] ! = poly_list [(nverts*2) - 2] | | 
     poly_list [1] ! = poly_list [(nverts*2) - 1])
    {
     poly_list [(nverts*2) +0] = poly_list[0];
     poly_list [(nverts*2) +1] = poly_list[1];
     nverts++;
    }
  
  /*
    invert the Y axis of each vertice in list
  */
  for (i=0; i < nverts; i++)
    poly_list[(i * 2)+1] = ydots-poly_list[(i * 2)+1];
  
  /*
    then draw it
  */
  if (filling)
    fill_polygon_a(nverts,poly_list);
  else
    draw_polyline(nverts,poly_list);
}