#include <stdio.h>

/* extras needed by roff */

errprnt(cs, arg) 

char *cs, *arg;
   /* can be used for at most one character ptr argument */
{
   fprintf( stderr, cs, arg);
   fflush(stderr);
}

movwrd(in, out)
char *in, *out;
{
   char *tmp;
   tmp = out;
   if(! *in) { *out = '\0' ; return(0) ; }
   while (*in && !isspace(*out = *in))
   { out++; in++; }
   *out = '\0';
   return( out != tmp );
}

/* get line into s and return length; s will contain '\n'. */
fgetline (fp, s, lim)
   FILE *fp;
   char s[];
   int lim;
{
   int c, i;
   for (i = 0; i < lim - 1 && (c = getc(fp)) != EOF && c != '\n'; ++i)
      s[i] = c;
   if (c == '\n')
   {
      s[i] = c;
      ++i;
   }
   s[i] = '\0';
   return (i);
} /* end fgetline */

/* Believe it or not some C systems do not supply the following */

/* integer absolute value */
int abs(i)
   int i;
{ return (i >= 0 ? i : -i); }

/* return the larger of two arguments */
int max (i, j)
   int i, j;
{ return (i >= j ? i : j); }

/* return the smaller of two arguments */
int min (i, j)
   int i, j;
{ return (i <= j ? i : j); }
