#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <termios.h>
#include "eterm.h"
#include "inout.h"


void send_file(char *fname)
{
   char fstr[81];
   FILE* fp;

   if (! strlen(fname))
       return;

   if (! (fp = fopen(fname, "r"))) {
       printf("* Error: couldn't find '%s'\n", fname);
       return;
   }

   while (fgets(fstr,80,fp)) {
       fstr[strlen(fstr)-1] = 0;      /* Strip LF */
       send_string(fstr, 1);
       if (chk_incoming(STDIN_FILENO))
           break;
       usleep(200000);
   }
   fclose(fp);
}