extern short printf();
extern short getch();
extern short gets();
extern short writefile();

#define BUFFER_SIZE 512

short
main()
{
   short ch;
   short i;
   char buffer[BUFFER_SIZE];
   char name[100];

   bzero(buffer, BUFFER_SIZE);

   bzero(name, 100);

   printf("Please enter the output file: ");
 
   gets(name);

   printf("\r\n");

   printf("Please type a $ to end the program...\r\n\r\n");
   
   i  = 0;

   while((ch = getch()) != '$') {
      if(ch == '\b') continue;

      printf("%c", ch);

      buffer[i] = ch;

      i++;

      if(i >= BUFFER_SIZE) {
         break;
      }
   }

   writefile(name, buffer);

   return 0;
}

#include "libc.c"
