#include "request.h"

int get_line( int line_pos )
{
  int counter = 0;
  char c;
  chtype attr;

  /* if the cursor is in the current line invert all output */
  if ( (curr_pos == line_pos) || ((line->marked) == 1) )
    attr = A_REVERSE;
  else
    attr = A_NORMAL;
  
  /* get a char from file and add it to the screen */
  while ( ((c = line->string[counter]) != 10) && (counter != screen_width ) )
      /* no CRs like D*S-files */
      if ( c != 13 )
            if ( c < 0 )
              {
      	        c = 42;
      	  	mvaddch( line_pos, counter++, c | attr );
      	      }
      	    else 
              mvaddch( line_pos, counter++, c | attr );

  /* fill the line with spaces */
  if ( counter < screen_width )
    while ( counter <= screen_width )
	mvaddch( line_pos, counter++, 32 | attr );

  if ( c == EOF )
    return EOF;
  else 
    return 0;

}


