diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index 56e13d0..196fa03 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,3 +1,25 @@
+2004-11-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+	* bgp_route.c: Remove all code related to VTY_CONTINUE; this feature
+	  is deprecated because the output did not represent a single point
+	  in time.  All output needs to be generated inline and buffered
+	  by the library code.
+	  (route_vty_out,route_vty_out_tag,damp_route_vty_out,
+	   flap_route_vty_out) Remove code to count number of lines of output,
+	   since this was only useful for VTY_CONTINUE behavior.
+	  (bgp_show_callback,vty_calc_line) Removed.
+	  (bgp_show_table) Remove hooks for VTY_CONTINUE callback support.
+	  As a result, there's a new output_arg argument to this function.
+	  Make function static.
+	  (bgp_show) Make function static and add a new output_arg argument.
+	  Change all functions that call bgp_show or bgp_show_table to
+	  pass the new output_arg argument (that used to be passed inside
+	  vty->output_arg).
+	* bgp_mplsvpn.c: Remove declarations of functions defined in
+	  bgp_route.c; these declarations belong in bgp_route.h.
+	* bgp_route.h: Declare 3 global functions used in both bgp_route.c
+	  and in bgp_mplsvpn.c.
+
 2004-10-31 Paul Jakma <paul@dishone.st>
 
 	* {bgpd,bgp_attr}.c: size_t printf format should be ld.
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 23b8d84..135a118 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -32,10 +32,6 @@
 #include "bgpd/bgp_attr.h"
 #include "bgpd/bgp_mplsvpn.h"
 
-int route_vty_out (struct vty *, struct prefix *, struct bgp_info *, int, safi_t);
-int route_vty_out_tag (struct vty *, struct prefix *, struct bgp_info *, int, safi_t);
-void route_vty_out_tmp (struct vty *, struct prefix *, struct attr *, safi_t);
-
 u_int16_t
 decode_rd_type (u_char *pnt)
 {
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index dbd29cb..5d406a6 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -4680,27 +4680,17 @@
     vty_out (vty, "%*s", len, " ");
 }
 
-/* Calculate line number of output data. */
-int
-vty_calc_line (struct vty *vty, unsigned long length)
-{
-  return vty->width ? (((vty->obuf->length - length) / vty->width) + 1) : 1;
-}
-
 enum bgp_display_type
 {
   normal_list,
 };
 
 /* called from terminal list command */
-int
+void
 route_vty_out (struct vty *vty, struct prefix *p,
 	       struct bgp_info *binfo, int display, safi_t safi)
 {
   struct attr *attr;
-  unsigned long length = 0;
-
-  length = vty->obuf->length;
 
   /* Route status display. */
   if (binfo->suppress)
@@ -4782,8 +4772,6 @@
       vty_out (vty, " %s", bgp_origin_str[attr->origin]);
   }
   vty_out (vty, "%s", VTY_NEWLINE);
-
-  return vty_calc_line (vty, length);
 }  
 
 /* called from terminal list command */
@@ -4851,16 +4839,13 @@
   vty_out (vty, "%s", VTY_NEWLINE);
 }  
 
-int
+void
 route_vty_out_tag (struct vty *vty, struct prefix *p,
 		   struct bgp_info *binfo, int display, safi_t safi)
 {
   struct attr *attr;
-  unsigned long length = 0;
   u_int32_t label = 0;
 
-  length = vty->obuf->length;
-
   /* Route status display. */
   if (binfo->suppress)
     vty_out (vty, "s");
@@ -4924,21 +4909,16 @@
   vty_out (vty, "notag/%d", label);
 
   vty_out (vty, "%s", VTY_NEWLINE);
-
-  return vty_calc_line (vty, length);
 }  
 
 /* dampening route */
-int
+static void
 damp_route_vty_out (struct vty *vty, struct prefix *p,
 		    struct bgp_info *binfo, int display, safi_t safi)
 {
   struct attr *attr;
-  unsigned long length = 0;
   int len;
 
-  length = vty->obuf->length;
-
   /* Route status display. */
   if (binfo->suppress)
     vty_out (vty, "s");
@@ -4989,24 +4969,20 @@
 	vty_out (vty, " %s", bgp_origin_str[attr->origin]);
     }
   vty_out (vty, "%s", VTY_NEWLINE);
-
-  return vty_calc_line (vty, length);
 }
 
 #define BGP_UPTIME_LEN 25
 
 /* flap route */
-int
+static void
 flap_route_vty_out (struct vty *vty, struct prefix *p,
 		    struct bgp_info *binfo, int display, safi_t safi)
 {
   struct attr *attr;
   struct bgp_damp_info *bdi;
-  unsigned long length = 0;
   char timebuf[BGP_UPTIME_LEN];
   int len;
 
-  length = vty->obuf->length;
   bdi = binfo->damp_info;
 
   /* Route status display. */
@@ -5073,8 +5049,6 @@
 	vty_out (vty, " %s", bgp_origin_str[attr->origin]);
     }
   vty_out (vty, "%s", VTY_NEWLINE);
-
-  return vty_calc_line (vty, length);
 }
 
 void
@@ -5278,254 +5252,18 @@
   bgp_show_type_damp_neighbor
 };
 
-int
-bgp_show_callback (struct vty *vty, int unlock)
-{
-  struct bgp_node *rn;
-  struct bgp_info *ri;
-  int count;
-  int limit;
-  int display;
-
-  rn = (struct bgp_node *) vty->output_rn;
-  count = 0;
-  limit = ((vty->lines == 0) 
-	   ? 10 : (vty->lines > 0 
-		   ? vty->lines : vty->height - 2));
-  limit = limit > 0 ? limit : 2;
-
-  /* Quit of display. */
-  if (unlock && rn)
-    {
-      bgp_unlock_node (rn);
-      if (vty->output_clean)
-	(*vty->output_clean) (vty);
-      vty->output_rn = NULL;
-      vty->output_func = NULL;
-      vty->output_clean = NULL;
-      vty->output_arg = NULL;
-      return 0;
-    }
-
-  for (; rn; rn = bgp_route_next (rn)) 
-    if (rn->info != NULL)
-      {
-	display = 0;
-
-	for (ri = rn->info; ri; ri = ri->next)
-	  {
-	    if (vty->output_type == bgp_show_type_flap_statistics
-		|| vty->output_type == bgp_show_type_flap_address
-		|| vty->output_type == bgp_show_type_flap_prefix
-		|| vty->output_type == bgp_show_type_flap_cidr_only
-		|| vty->output_type == bgp_show_type_flap_regexp
-		|| vty->output_type == bgp_show_type_flap_filter_list
-		|| vty->output_type == bgp_show_type_flap_prefix_list
-		|| vty->output_type == bgp_show_type_flap_prefix_longer
-		|| vty->output_type == bgp_show_type_flap_route_map
-		|| vty->output_type == bgp_show_type_flap_neighbor
-		|| vty->output_type == bgp_show_type_dampend_paths
-		|| vty->output_type == bgp_show_type_damp_neighbor)
-	      {
-		if (! ri->damp_info)
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_regexp
-		|| vty->output_type == bgp_show_type_flap_regexp)
-	      {
-		regex_t *regex = vty->output_arg;
-
-		if (bgp_regexec (regex, ri->attr->aspath) == REG_NOMATCH)
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_prefix_list
-		|| vty->output_type == bgp_show_type_flap_prefix_list)
-	      {
-		struct prefix_list *plist = vty->output_arg;
-
-		if (prefix_list_apply (plist, &rn->p) != PREFIX_PERMIT)
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_filter_list
-		|| vty->output_type == bgp_show_type_flap_filter_list)
-	      {
-		struct as_list *as_list = vty->output_arg;
-
-		if (as_list_apply (as_list, ri->attr->aspath) != AS_FILTER_PERMIT)
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_route_map
-		|| vty->output_type == bgp_show_type_flap_route_map)
-	      {
-		struct route_map *rmap = vty->output_arg;
-		struct bgp_info binfo;
-		struct attr dummy_attr; 
-		int ret;
-
-		dummy_attr = *ri->attr;
-		binfo.peer = ri->peer;
-		binfo.attr = &dummy_attr;
-
-		ret = route_map_apply (rmap, &rn->p, RMAP_BGP, &binfo);
-
-		if (ret == RMAP_DENYMATCH)
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_neighbor
-		|| vty->output_type == bgp_show_type_flap_neighbor
-		|| vty->output_type == bgp_show_type_damp_neighbor)
-	      {
-		union sockunion *su = vty->output_arg;
-
-		if (ri->peer->su_remote == NULL || ! sockunion_same(ri->peer->su_remote, su))
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_cidr_only
-		|| vty->output_type == bgp_show_type_flap_cidr_only)
-	      {
-		u_int32_t destination;
-
-		destination = ntohl (rn->p.u.prefix4.s_addr);
-		if (IN_CLASSC (destination) && rn->p.prefixlen == 24)
-		  continue;
-		if (IN_CLASSB (destination) && rn->p.prefixlen == 16)
-		  continue;
-		if (IN_CLASSA (destination) && rn->p.prefixlen == 8)
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_prefix_longer
-		|| vty->output_type == bgp_show_type_flap_prefix_longer)
-	      {
-		struct prefix *p = vty->output_arg;
-
-		if (! prefix_match (p, &rn->p))
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_community_all)
-	      {
-		if (! ri->attr->community)
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_community)
-	      {
-		struct community *com = vty->output_arg;
-
-		if (! ri->attr->community ||
-		    ! community_match (ri->attr->community, com))
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_community_exact)
-	      {
-		struct community *com = vty->output_arg;
-
-		if (! ri->attr->community ||
-		    ! community_cmp (ri->attr->community, com))
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_community_list)
-	      {
-		struct community_list *list = vty->output_arg;
-
-		if (! community_list_match (ri->attr->community, list))
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_community_list_exact)
-	      {
-		struct community_list *list = vty->output_arg;
-
-		if (! community_list_exact_match (ri->attr->community, list))
-		  continue;
-	      }
-	    if (vty->output_type == bgp_show_type_flap_address
-		|| vty->output_type == bgp_show_type_flap_prefix)
-	      {
-		struct prefix *p = vty->output_arg;
-
-		if (! prefix_match (&rn->p, p))
-		  continue;
-
-		if (vty->output_type == bgp_show_type_flap_prefix)
-		  if (p->prefixlen != rn->p.prefixlen)
-		    continue;
-	      }
-	    if (vty->output_type == bgp_show_type_dampend_paths
-		|| vty->output_type == bgp_show_type_damp_neighbor)
-	      {
-		if (! CHECK_FLAG (ri->flags, BGP_INFO_DAMPED)
-		    || CHECK_FLAG (ri->flags, BGP_INFO_HISTORY))
-		  continue;
-	      }
-
-	    if (vty->output_type == bgp_show_type_dampend_paths
-		|| vty->output_type == bgp_show_type_damp_neighbor)
-	      count += damp_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
-	    else if (vty->output_type == bgp_show_type_flap_statistics
-		     || vty->output_type == bgp_show_type_flap_address
-		     || vty->output_type == bgp_show_type_flap_prefix
-		     || vty->output_type == bgp_show_type_flap_cidr_only
-		     || vty->output_type == bgp_show_type_flap_regexp
-		     || vty->output_type == bgp_show_type_flap_filter_list
-		     || vty->output_type == bgp_show_type_flap_prefix_list
-		     || vty->output_type == bgp_show_type_flap_prefix_longer
-		     || vty->output_type == bgp_show_type_flap_route_map
-		     || vty->output_type == bgp_show_type_flap_neighbor)
-	      count += flap_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
-	    else
-	      count += route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
-	    display++;
-	  }
-
-	if (display)
-	  vty->output_count++;
-
-	/* Remember current pointer then suspend output. */
-	if (count >= limit)
-	  {
-	    vty->status = VTY_CONTINUE;
-	    vty->output_rn = (struct route_node *) bgp_route_next (rn);;
-	    vty->output_func = bgp_show_callback;
-	    return 0;
-	  }
-      }
-
-  /* Total line display. */
-  if (vty->output_count)
-    vty_out (vty, "%sTotal number of prefixes %ld%s",
-	     VTY_NEWLINE, vty->output_count, VTY_NEWLINE);
-
-  if (vty->output_clean)
-    (*vty->output_clean) (vty);
-
-  vty->status = VTY_CONTINUE;
-  vty->output_rn = NULL;
-  vty->output_func = NULL;
-  vty->output_clean = NULL;
-  vty->output_arg = NULL;
-
-  return 0;
-}
-
-int
+static int
 bgp_show_table (struct vty *vty, struct bgp_table *table, struct in_addr *router_id,
-	  enum bgp_show_type type)
+	  enum bgp_show_type type, void *output_arg)
 {
   struct bgp_info *ri;
   struct bgp_node *rn;
   int header = 1;
-  int count;
-  int limit;
   int display;
-
-  limit = ((vty->lines == 0) 
-	   ? 10 : (vty->lines > 0 
-		   ? vty->lines : vty->height - 2));
-  limit = limit > 0 ? limit : 2;
-
-  count = 0;
+  unsigned long output_count;
 
   /* This is first entry point, so reset total line. */
-  vty->output_count = 0;
-  vty->output_type = type;
+  output_count = 0;
 
   /* Start processing of routes. */
   for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) 
@@ -5535,7 +5273,7 @@
 
 	for (ri = rn->info; ri; ri = ri->next)
 	  {
-	    if (vty->output_type == bgp_show_type_flap_statistics
+	    if (type == bgp_show_type_flap_statistics
 		|| type == bgp_show_type_flap_address
 		|| type == bgp_show_type_flap_prefix
 		|| type == bgp_show_type_flap_cidr_only
@@ -5554,7 +5292,7 @@
 	    if (type == bgp_show_type_regexp
 		|| type == bgp_show_type_flap_regexp)
 	      {
-		regex_t *regex = vty->output_arg;
+		regex_t *regex = output_arg;
 		    
 		if (bgp_regexec (regex, ri->attr->aspath) == REG_NOMATCH)
 		  continue;
@@ -5562,7 +5300,7 @@
 	    if (type == bgp_show_type_prefix_list
 		|| type == bgp_show_type_flap_prefix_list)
 	      {
-		struct prefix_list *plist = vty->output_arg;
+		struct prefix_list *plist = output_arg;
 		    
 		if (prefix_list_apply (plist, &rn->p) != PREFIX_PERMIT)
 		  continue;
@@ -5570,7 +5308,7 @@
 	    if (type == bgp_show_type_filter_list
 		|| type == bgp_show_type_flap_filter_list)
 	      {
-		struct as_list *as_list = vty->output_arg;
+		struct as_list *as_list = output_arg;
 
 		if (as_list_apply (as_list, ri->attr->aspath) != AS_FILTER_PERMIT)
 		  continue;
@@ -5578,7 +5316,7 @@
 	    if (type == bgp_show_type_route_map
 		|| type == bgp_show_type_flap_route_map)
 	      {
-		struct route_map *rmap = vty->output_arg;
+		struct route_map *rmap = output_arg;
 		struct bgp_info binfo;
 		struct attr dummy_attr; 
 		int ret;
@@ -5596,7 +5334,7 @@
 		|| type == bgp_show_type_flap_neighbor
 		|| type == bgp_show_type_damp_neighbor)
 	      {
-		union sockunion *su = vty->output_arg;
+		union sockunion *su = output_arg;
 
 		if (ri->peer->su_remote == NULL || ! sockunion_same(ri->peer->su_remote, su))
 		  continue;
@@ -5617,7 +5355,7 @@
 	    if (type == bgp_show_type_prefix_longer
 		|| type == bgp_show_type_flap_prefix_longer)
 	      {
-		struct prefix *p = vty->output_arg;
+		struct prefix *p = output_arg;
 
 		if (! prefix_match (p, &rn->p))
 		  continue;
@@ -5629,7 +5367,7 @@
 	      }
 	    if (type == bgp_show_type_community)
 	      {
-		struct community *com = vty->output_arg;
+		struct community *com = output_arg;
 
 		if (! ri->attr->community ||
 		    ! community_match (ri->attr->community, com))
@@ -5637,7 +5375,7 @@
 	      }
 	    if (type == bgp_show_type_community_exact)
 	      {
-		struct community *com = vty->output_arg;
+		struct community *com = output_arg;
 
 		if (! ri->attr->community ||
 		    ! community_cmp (ri->attr->community, com))
@@ -5645,14 +5383,14 @@
 	      }
 	    if (type == bgp_show_type_community_list)
 	      {
-		struct community_list *list = vty->output_arg;
+		struct community_list *list = output_arg;
 
 		if (! community_list_match (ri->attr->community, list))
 		  continue;
 	      }
 	    if (type == bgp_show_type_community_list_exact)
 	      {
-		struct community_list *list = vty->output_arg;
+		struct community_list *list = output_arg;
 
 		if (! community_list_exact_match (ri->attr->community, list))
 		  continue;
@@ -5660,7 +5398,7 @@
 	    if (type == bgp_show_type_flap_address
 		|| type == bgp_show_type_flap_prefix)
 	      {
-		struct prefix *p = vty->output_arg;
+		struct prefix *p = output_arg;
 
 		if (! prefix_match (&rn->p, p))
 		  continue;
@@ -5698,13 +5436,12 @@
 		  vty_out (vty, BGP_SHOW_FLAP_HEADER, VTY_NEWLINE);
 		else
 		  vty_out (vty, BGP_SHOW_HEADER, VTY_NEWLINE);
-		count += 5;
 		header = 0;
 	      }
 
 	    if (type == bgp_show_type_dampend_paths
 		|| type == bgp_show_type_damp_neighbor)
-	      count += damp_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
+	      damp_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
 	    else if (type == bgp_show_type_flap_statistics
 		     || type == bgp_show_type_flap_address
 		     || type == bgp_show_type_flap_prefix
@@ -5715,52 +5452,31 @@
 		     || type == bgp_show_type_flap_prefix_longer
 		     || type == bgp_show_type_flap_route_map
 		     || type == bgp_show_type_flap_neighbor)
-	      count += flap_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
+	      flap_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
 	    else
-	      count += route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
+	      route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST);
 	    display++;
 	  }
 	if (display)
-	  vty->output_count++;
-
-	/* Remember current pointer then suspend output. */
-	if (count >= limit  && vty->type != VTY_SHELL_SERV)
-	  {
-	    vty->status = VTY_START;
-	    vty->output_rn = (struct route_node *) bgp_route_next (rn);
-	    vty->output_func = bgp_show_callback;
-	    vty->output_type = type;
-
-	    return CMD_SUCCESS;
-	  }
+	  output_count++;
       }
 
   /* No route is displayed */
-  if (vty->output_count == 0)
+  if (output_count == 0)
     {
       if (type == bgp_show_type_normal)
 	vty_out (vty, "No BGP network exists%s", VTY_NEWLINE);
     }
   else
     vty_out (vty, "%sTotal number of prefixes %ld%s",
-	     VTY_NEWLINE, vty->output_count, VTY_NEWLINE);
-
-  /* Clean up allocated resources. */
-  if (vty->output_clean)
-    (*vty->output_clean) (vty);
-
-  vty->status = VTY_START;
-  vty->output_rn = NULL;
-  vty->output_func = NULL;
-  vty->output_clean = NULL;
-  vty->output_arg = NULL;
+	     VTY_NEWLINE, output_count, VTY_NEWLINE);
 
   return CMD_SUCCESS;
 }
 
-int
+static int
 bgp_show (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
-         enum bgp_show_type type)
+         enum bgp_show_type type, void *output_arg)
 {
   struct bgp_table *table;
 
@@ -5777,7 +5493,7 @@
 
   table = bgp->rib[afi][safi];
 
-  return bgp_show_table (vty, table, &bgp->router_id, type);
+  return bgp_show_table (vty, table, &bgp->router_id, type, output_arg);
 }
 
 /* Header of detailed BGP route information */
@@ -5992,7 +5708,7 @@
        IP_STR
        BGP_STR)
 {
-  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal);
+  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL);
 }
 
 DEFUN (show_ip_bgp_ipv4,
@@ -6006,9 +5722,10 @@
        "Address Family modifier\n")
 {
   if (strncmp (argv[0], "m", 1) == 0)
-    return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_normal);
+    return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_normal,
+                     NULL);
  
-  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal);
+  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL);
 }
 
 DEFUN (show_ip_bgp_route,
@@ -6158,7 +5875,7 @@
 	  return CMD_WARNING;
 	}
 
-  return bgp_show (vty, bgp, AFI_IP, SAFI_UNICAST, bgp_show_type_normal);
+  return bgp_show (vty, bgp, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL);
 }
 
 DEFUN (show_ip_bgp_view_route,
@@ -6194,7 +5911,8 @@
        SHOW_STR
        BGP_STR)
 {
-  return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal);
+  return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal,
+                   NULL);
 }
 
 ALIAS (show_bgp,
@@ -6212,7 +5930,8 @@
        IP_STR
        BGP_STR)
 {
-  return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal);
+  return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal,
+                   NULL);
 }
 
 DEFUN (show_bgp_route,
@@ -6293,7 +6012,7 @@
 	  return CMD_WARNING;
 	}
   
-  return bgp_show (vty, bgp, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal);
+  return bgp_show (vty, bgp, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, NULL);
 }
 
 ALIAS (show_bgp_view,
@@ -6357,7 +6076,8 @@
        IP_STR
        MBGP_STR)
 {
-  return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal);
+  return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal,
+                   NULL);
 }
 
 /* old command */
@@ -6385,11 +6105,6 @@
 }
 #endif
 
-void
-bgp_show_regexp_clean (struct vty *vty)
-{
-  bgp_regex_free (vty->output_arg);
-}
 
 int
 bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi,
@@ -6400,6 +6115,7 @@
   char *regstr;
   int first;
   regex_t *regex;
+  int rc;
   
   first = 0;
   b = buffer_new (1024);
@@ -6429,10 +6145,9 @@
       return CMD_WARNING;
     }
 
-  vty->output_arg = regex;
-  vty->output_clean = bgp_show_regexp_clean;
-
-  return bgp_show (vty, NULL, afi, safi, type);
+  rc = bgp_show (vty, NULL, afi, safi, type, regex);
+  bgp_regex_free (regex);
+  return rc;
 }
 
 DEFUN (show_ip_bgp_regexp, 
@@ -6547,9 +6262,7 @@
       return CMD_WARNING;
     }
 
-  vty->output_arg = plist;
-
-  return bgp_show (vty, NULL, afi, safi, type);
+  return bgp_show (vty, NULL, afi, safi, type, plist);
 }
 
 DEFUN (show_ip_bgp_prefix_list, 
@@ -6663,9 +6376,7 @@
       return CMD_WARNING;
     }
 
-  vty->output_arg = as_list;
-
-  return bgp_show (vty, NULL, afi, safi, type);
+  return bgp_show (vty, NULL, afi, safi, type, as_list);
 }
 
 DEFUN (show_ip_bgp_filter_list, 
@@ -6780,9 +6491,7 @@
       return CMD_WARNING;
     }
 
-  vty->output_arg = rmap;
-
-  return bgp_show (vty, NULL, afi, safi, type);
+  return bgp_show (vty, NULL, afi, safi, type, rmap);
 }
 
 DEFUN (show_ip_bgp_route_map, 
@@ -6862,7 +6571,7 @@
        "Display only routes with non-natural netmasks\n")
 {
     return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
-		     bgp_show_type_cidr_only);
+		     bgp_show_type_cidr_only, NULL);
 }
 
 DEFUN (show_ip_bgp_flap_cidr_only,
@@ -6875,7 +6584,7 @@
        "Display only routes with non-natural netmasks\n")
 {
   return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
-		   bgp_show_type_flap_cidr_only);
+		   bgp_show_type_flap_cidr_only, NULL);
 }
 
 DEFUN (show_ip_bgp_ipv4_cidr_only,
@@ -6891,10 +6600,10 @@
 {
   if (strncmp (argv[0], "m", 1) == 0)
     return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
-		     bgp_show_type_cidr_only);
+		     bgp_show_type_cidr_only, NULL);
 
   return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
-		     bgp_show_type_cidr_only);
+		     bgp_show_type_cidr_only, NULL);
 }
 
 DEFUN (show_ip_bgp_community_all,
@@ -6906,7 +6615,7 @@
        "Display routes matching the communities\n")
 {
   return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
-		     bgp_show_type_community_all);
+		     bgp_show_type_community_all, NULL);
 }
 
 DEFUN (show_ip_bgp_ipv4_community_all,
@@ -6922,10 +6631,10 @@
 {
   if (strncmp (argv[0], "m", 1) == 0)
     return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
-		     bgp_show_type_community_all);
+		     bgp_show_type_community_all, NULL);
  
   return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
-		   bgp_show_type_community_all);
+		   bgp_show_type_community_all, NULL);
 }
 
 #ifdef HAVE_IPV6
@@ -6937,7 +6646,7 @@
        "Display routes matching the communities\n")
 {
   return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST,
-		   bgp_show_type_community_all);
+		   bgp_show_type_community_all, NULL);
 }
 
 ALIAS (show_bgp_community_all,
@@ -6958,7 +6667,7 @@
        "Display routes matching the communities\n")
 {
   return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST,
-		   bgp_show_type_community_all);
+		   bgp_show_type_community_all, NULL);
 }
 
 /* old command */
@@ -6971,7 +6680,7 @@
        "Display routes matching the communities\n")
 {
   return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST,
-		   bgp_show_type_community_all);
+		   bgp_show_type_community_all, NULL);
 }
 #endif /* HAVE_IPV6 */
 
@@ -7012,12 +6721,9 @@
       return CMD_WARNING;
     }
 
-  vty->output_arg = com;
-
-  if (exact)
-    return bgp_show (vty, NULL, afi, safi, bgp_show_type_community_exact);
-
-  return bgp_show (vty, NULL, afi, safi, bgp_show_type_community);
+  return bgp_show (vty, NULL, afi, safi,
+                   (exact ? bgp_show_type_community_exact :
+		            bgp_show_type_community), com);
 }
 
 DEFUN (show_ip_bgp_community,
@@ -7992,12 +7698,9 @@
       return CMD_WARNING;
     }
 
-  vty->output_arg = list;
-
-  if (exact)
-    return bgp_show (vty, NULL, afi, safi, bgp_show_type_community_list_exact);
-
-  return bgp_show (vty, NULL, afi, safi, bgp_show_type_community_list);
+  return bgp_show (vty, NULL, afi, safi,
+                   (exact ? bgp_show_type_community_list_exact :
+		            bgp_show_type_community_list), list);
 }
 
 DEFUN (show_ip_bgp_community_list,
@@ -8160,15 +7863,6 @@
 }
 #endif /* HAVE_IPV6 */
 
-void
-bgp_show_prefix_longer_clean (struct vty *vty)
-{
-  struct prefix *p;
-
-  p = vty->output_arg;
-  prefix_free (p);
-}
-
 int
 bgp_show_prefix_longer (struct vty *vty, const char *prefix, afi_t afi,
 			safi_t safi, enum bgp_show_type type)
@@ -8185,10 +7879,9 @@
       return CMD_WARNING;
     }
 
-  vty->output_arg = p;
-  vty->output_clean = bgp_show_prefix_longer_clean;
-
-  return bgp_show (vty, NULL, afi, safi, type);
+  ret = bgp_show (vty, NULL, afi, safi, type, p);
+  prefix_free(p);
+  return ret;
 }
 
 DEFUN (show_ip_bgp_prefix_longer,
@@ -8948,15 +8641,6 @@
        "Display the prefixlist filter\n")
 #endif /* HAVE_IPV6 */
 
-void
-bgp_show_neighbor_route_clean (struct vty *vty)
-{
-  union sockunion *su;
-
-  su = vty->output_arg;
-  XFREE (MTYPE_SOCKUNION, su);
-}
-
 int
 bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi,
 			 safi_t safi, enum bgp_show_type type)
@@ -8967,10 +8651,7 @@
       return CMD_WARNING;
     }
  
-  vty->output_arg = sockunion_dup (&peer->su);
-  vty->output_clean = bgp_show_neighbor_route_clean;
-
-  return bgp_show (vty, peer->bgp, afi, safi, type);
+  return bgp_show (vty, peer->bgp, afi, safi, type, &peer->su);
 }
 
 DEFUN (show_ip_bgp_neighbor_routes,
@@ -9103,7 +8784,7 @@
 
   table = peer->rib[AFI_IP][SAFI_UNICAST];
 
-  return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal);
+  return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal, NULL);
 }
 
 ALIAS (show_ip_bgp_view_rsclient,
@@ -9516,7 +9197,7 @@
 
   table = peer->rib[AFI_IP6][SAFI_UNICAST];
 
-  return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal);
+  return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal, NULL);
 }
 
 ALIAS (show_bgp_view_rsclient,
@@ -10047,7 +9728,8 @@
        BGP_STR
        "Display paths suppressed due to dampening\n")
 {
-  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_dampend_paths);
+  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_dampend_paths,
+                   NULL);
 }
 
 DEFUN (show_ip_bgp_flap_statistics,
@@ -10058,7 +9740,8 @@
        BGP_STR
        "Display flap statistics of routes\n")
 {
-  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_statistics);
+  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
+                   bgp_show_type_flap_statistics, NULL);
 }
 
 /* Display specified route of BGP table. */
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index d44c502..e324ef0 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -167,3 +167,7 @@
 
 afi_t bgp_node_afi (struct vty *);
 safi_t bgp_node_safi (struct vty *);
+
+void route_vty_out (struct vty *, struct prefix *, struct bgp_info *, int, safi_t);
+void route_vty_out_tag (struct vty *, struct prefix *, struct bgp_info *, int, safi_t);
+void route_vty_out_tmp (struct vty *, struct prefix *, struct attr *, safi_t);
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 75ff444..7fd36d2 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,19 @@
 2004-11-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
+	* vty.h: Remove fields in struct vty that were related to VTY_CONTINUE
+	  capabilities (that were used only in bgpd/bgp_route.c and are now
+	  removed).  Also remove some other fields that were not being
+	  used at all.
+	* vty.c: (vty_execute) Do not test for obsolete status values VTY_START
+	  and VTY_CONTINUE.
+	  (vty_read) Remove calls to vty->output_func since that was part
+	  of the VTY_CONTINUE infrastructure that has been removed.
+	  (vty_flush) Remove code to support VTY_START and VTY_CONTINUE.
+	  (vty_close) Remove code to cancel vty->t_output thread, since that
+	  thread was never actually used.
+
+2004-11-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
 	* vty.c: Vtysh connections to daemons should use buffering.
 	  (vty_out) Remove exception for vty_shell_serv, just use buffer_write.
 	  (vty_new) Increase output buffer size to 4096 rounded up to a
diff --git a/lib/vty.c b/lib/vty.c
index e6bcb61..1ef552f 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1206,9 +1206,7 @@
   vty->cp = vty->length = 0;
   vty_clear_buf (vty);
 
-  if (vty->status != VTY_CLOSE 
-      && vty->status != VTY_START
-      && vty->status != VTY_CONTINUE)
+  if (vty->status != VTY_CLOSE )
     vty_prompt (vty);
 
   return ret;
@@ -1310,8 +1308,6 @@
 	    case CONTROL('C'):
 	    case 'q':
 	    case 'Q':
-	      if (vty->output_func)
-		(*vty->output_func) (vty, 1);
 	      vty_buffer_reset (vty);
 	      break;
 #if 0 /* More line does not work for "show ip bgp".  */
@@ -1321,8 +1317,6 @@
 	      break;
 #endif
 	    default:
-	      if (vty->output_func)
-		(*vty->output_func) (vty, 0);
 	      break;
 	    }
 	  continue;
@@ -1472,55 +1466,6 @@
       }
 
   /* Function execution continue. */
-  if (vty->status == VTY_START || vty->status == VTY_CONTINUE)
-    {
-      if (vty->status == VTY_CONTINUE)
-	erase = 1;
-      else
-	erase = 0;
-
-      if (vty->output_func == NULL)
-	dont_more = 1;
-      else
-	dont_more = 0;
-
-      if (vty->lines == 0)
-	{
-	  erase = 0;
-	  dont_more = 1;
-	}
-
-      buffer_flush_vty_all (vty->obuf, vty->fd, erase, dont_more);
-
-      if (vty->status == VTY_CLOSE)
-	{
-	  vty_close (vty);
-	  return 0;
-	}
-
-      if (vty->output_func == NULL)
-	{
-	  vty->status = VTY_NORMAL;
-	  vty_prompt (vty);
-	  vty_event (VTY_WRITE, vty_sock, vty);
-	}
-      else
-	vty->status = VTY_MORE;
-
-      if (vty->lines == 0)
-	{
-	  if (vty->output_func == NULL)
-	    vty_event (VTY_READ, vty_sock, vty);
-	  else
-	    {
-	      if (vty->output_func)
-		(*vty->output_func) (vty, 0);
-	      vty_event (VTY_WRITE, vty_sock, vty);
-	    }
-	}
-    }
-  else
-    {
       if (vty->status == VTY_MORE || vty->status == VTY_MORELINE)
 	erase = 1;
       else
@@ -1554,7 +1499,6 @@
 	  if (vty->lines == 0)
 	    vty_event (VTY_WRITE, vty_sock, vty);
 	}
-    }
 
   return 0;
 }
@@ -2075,8 +2019,6 @@
     thread_cancel (vty->t_write);
   if (vty->t_timeout)
     thread_cancel (vty->t_timeout);
-  if (vty->t_output)
-    thread_cancel (vty->t_output);
 
   /* Flush buffer. */
   if (! buffer_empty (vty->obuf))
diff --git a/lib/vty.h b/lib/vty.h
index c5c8c3b..c3221e2 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -41,9 +41,6 @@
   /* What address is this vty comming from. */
   char *address;
 
-  /* Privilege level of this vty. */
-  int privilege;
-
   /* Failure count */
   int fail;
 
@@ -82,8 +79,7 @@
   unsigned char escape;
 
   /* Current vty status. */
-  enum {VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_MORELINE,
-        VTY_START, VTY_CONTINUE} status;
+  enum {VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_MORELINE} status;
 
   /* IAC handling */
   unsigned char iac;
@@ -96,14 +92,9 @@
   int width;
   int height;
 
-  int scroll_one;
-
   /* Configure lines. */
   int lines;
 
-  /* Current executing function pointer. */
-  int (*func) (struct vty *, void *arg);
-
   /* Terminal monitor. */
   int monitor;
 
@@ -117,17 +108,6 @@
   /* Timeout seconds and thread. */
   unsigned long v_timeout;
   struct thread *t_timeout;
-
-  /* Thread output function. */
-  struct thread *t_output;
-
-  /* Output data pointer. */
-  int (*output_func) (struct vty *, int);
-  void (*output_clean) (struct vty *);
-  void *output_rn;
-  unsigned long output_count;
-  int output_type;
-  void *output_arg;
 };
 
 /* Integrated configuration file. */
