#include <stdio.h>
#include <file.h>

openfiles(argv,disk_file,disk_file2)

char *argv[];
int  *disk_file, *disk_file2;

{
    *disk_file  = open(argv[1],O_RDONLY,0);
    *disk_file2 = open(argv[2],O_WRONLY|O_CREAT|O_TRUNC,0);
    if (*disk_file == -1) 
	   {
  	   printf("Error on opening file %s.\n",argv[1]);
	   exit(1);
	   }
    if (*disk_file2 == -1) 
	   {
  	   printf("Error on opening file %s.\n",argv[2]);
	   exit(1);
	   }
}

char *getkey()
{
  static char key[256];
  short int channel,status;
#include <iodef.h>
#include <descrip.h>
$DESCRIPTOR(input,"sys$input");
  int sysqiow(),sys$assign();

	status = sys$assign(&input,&channel,0,0);
	status = sys$qiow(0,channel,IO$_READVBLK + IO$M_NOECHO,
			0,0,0,key,256,0,0,0,0);
        return(key);
}
char readone(desc)

int desc;
{
int status, max =1;
char str[2];
   if (status = read (desc,str,max) != 1)
	return(EOF);
   else
        return(str[0]);
}

writeone(onechar,desc)

char onechar;
int desc;
{
int status, max =1;
char str[2];
   if (status = write (desc,&onechar,max) != 1)
	return(status);
   else
        return(1);
}

