/* $Id: output.c,v 1.6 1998/10/17 13:24:50 fraserm Exp $
   $Log: output.c,v $
   Revision 1.6  1998/10/17 13:24:50  fraserm
   ANSI-fied the code
   added "-" option to allow futrther options from standard input

   Revision 1.5  1998/03/08 22:44:13  fraserm
   screen refresh by interval timer for xagm
   doesn't sort dictionary unless it has to

   Revision 1.4  1998/03/08 00:05:42  fraserm
   in to get out

   Revision 1.3  1996/10/25 19:11:37  fraser
   updates changing spinny line to 2 digit percentage

 * Revision 1.2  1996/09/12  14:20:56  fraser
 * add module version printing
 *
 * Revision 1.1  1996/09/12  13:19:15  fraser
 * Initial revision
 *
*/
/* output.c: functions which write output for agm
*/

char output_RCSid[] = "$Revision: 1.6 $";

#include "agm.h"

void print_prevs (int percent)
{
  int loop;

  /* first, can we print it without going off the end of the line? */
  if (totlen + prevcount + 1 > screenwid - spos - 2) {
    spos = 0;
    if (is_a_tty) fputs ("   ", stdout);
    putchar ('\n');
  }
  for (loop = 0; loop < prevcount; ++loop) {
    printf ("%s%s", (spos == 0 && loop == 0) ? "" : " ", prevs[loop]);
  }
  fputs (screenwid == 0 ? "" : ";", stdout);
  if (is_a_tty || force_percent) {
    printf ("%02d\b\b", percent);
  }
  /* fflush (stdout); */
  spos += totlen + prevcount + 1;
}

void list_dictionary (struct wnode *p)
{
  while (p != NULL) {
    puts (p->word);
    p = p->next;
  }
}
