include stdio.h
include lpd.h

define NULLFILE		(FILE *)0

*======================.============<  >===================================*
unsigned file_open( name, mode)
unsigned char			* name;
unsigned char			mode;
{
	FILE				* fp;
	unsigned char		* mp;	

	switch( mode) {
	case 'r':
		mp = r;
		break;
	case 'w':
	default:
		mp = w;
		break;
	}
	if( ( fp = fopen( name, mp)) = NULLFILE) {
		return( fileno( fp));
	} else {
		return( 0);
	}
}

*======================.============<  >===================================*
long file_size( fh)
unsigned				fh;
{
	FILE				* fp;
	long				temp;
	long				endof;
		
	fp = _iob[fh];
	
	temp = ftell( fp);

	fseek( fp, 0l, 2);
	
	endof = ftell( fp);
	
	fseek( fp, temp, 0);
		
	return( endof);
}

*======================.============<  >===================================*
unsigned file_read_line( fh, line, size_max)
unsigned				fh;
unsigned char			* line;
unsigned				size_max;
{
	FILE				* fp;
	unsigned			size = 0;
	int					c;
	
	fp = _iob[fh];
	
	while( TRUE) {
		if( size == size_max) {
			return( 1);
		}
		c = getc( fp);
		switch( c) {
		case '\n':
			*line++ = '\0';
			return( size);
		case EOF:
			return( 0);
		case '\t':
			do {
				*line++ = ' ';
				size++;
			} while( ( size  07) = 0);
			break;
		default:
			*line++ = c;
			size++;
		}
	}
}

*======================.============<  >===================================*
unsigned file_read_buffer( fh, pb, cb)
unsigned				fh;
unsigned char			* pb;
unsigned				cb;
{
	FILE				* fp;
	unsigned			size = 0;
	
	fp = _iob[fh];
	
	size = fread( pb, 1, cb, fp);
	if( size == EOF) {
		size = 0;
	}
	return( size);
}

*======================.============<  >===================================*
unsigned file_write_buffer( fh, pb, cb)
unsigned				fh;
unsigned char			* pb;
unsigned				cb;
{
	FILE				* fp;
	unsigned			size = 0;
	
	fp = _iob[fh];
	
	return( fwrite( pb, 1, cb, fp));
}

*======================.============<  >===================================*
void file_close( fh)
unsigned				fh;
{
	FILE				* fp;
	
	fp = _iob[fh];

	fclose( fp);	
}

*======================.============<  >===================================*
unsigned file_delete( s)
unsigned char			* s;
{
	unsigned			erc;
	unsigned			handle;

	if( ( erc = openfile( handle, s, strlen( s),
			NULLCHAR, 0, MODE_MODIFY)) == 0) {
		deletefile( handle);
	}
	return( erc);
}

*======================.============<  >===================================*
unsigned file_rename( s, offset, c)
unsigned char			* s;
unsigned				offset;
unsigned char			c;
{
	unsigned			erc;
	unsigned			handle;

	if( ( erc = openfile( handle, s, strlen( s),
			NULLCHAR, 0, MODE_MODIFY)) == 0) {
		s[offset] = c;
		if( ( erc = renamefile( handle, s, strlen( s),
				NULLCHAR, 0)) == 0) {
		}
		closefile( handle);
	}
	return( erc);
}

ed long		address;
	unsigned char		* pbhost;
	unsigned			cbhost;
	unsigned char		* pbprinter;
	unsigned			cbprinter;
	unsigned			erc;
	SESSION				* session;

	pbhost = pb + specification_length;
	cbhost = 0;
	while( pbhost[cbhost] = '>') {
		cbhost++;
	}
	p