int fd;
main()
{
  char line[128];
  char name[80];

  cprintf("Enter file name: ");
  editgets(name,0);
  cputs("\r\n");
  if ((fd = open(name,"rt")) == -1)
    {
      cprintf("open failed!\r\n");
      exit();
    }
  while (gets(line) != 0)
         cprintf("%s\r\n", line);
  close(fd);
}

gets(char  *string)
{
      char  *str;
      int c;

      str = string;

      while (read(fd, &c, 1) == 1)
      {
         if (c != '\n' && c != 26)
             *str++ = c;
         else {
             *str = '\0';
             return (string);
         }
      }
      return (0);
}
