/* 	C/80 source code for SUBSET version 1.0, 10/5/83 by
	David B. Ring, 1248 Truman Street, Redwood City, California
	94061.

	Copyright (c) 1983 by David B. Ring.  SUBSET may be used, 
	copied and distributed freely for noncommercial purposes, 
	providing that a copy of this notice is included.  No commercial
	use of SUBSET may be made without the author's express 
	written	permission.  SUBSET was written and compiled using
	C/80 3.0 from the Software Toolworks.  Appreciation is
	due to Walt Bilofsky for allowing free distribution of
	programs compiled with C/80.  

	SUBSET is intended for use with the companion program SUPERSET.
	Sets of special function key definitions created and saved as
	CP/M files using SUPERSET may be loaded for use by SUBSET.
	(SUPERSET also provides the loading capability, but occupies
	more disk space than SUBSET.)	Comments, suggestions and fixes 
	are appreciated and may be sent to the address above.

/****** HEADER SECTION ***********************************************/ 

/* 	Macros specific for single or double density.  The set
	actually used is toggled by #defining SD or DD (but not
	both!).  */

#define 	SD

#ifdef		DD
#define 	KEYTABL		0XE16B
#define 	LIMIT		0XE1FA
#endif

#ifdef		SD
#define 	KEYTABL		0XE56B
#define 	LIMIT		0XE600
#endif

/****** MAIN PROGRAM **********************************************/

/* 	The only allowed usage of SUBSET is "SUBSET filename".
	The named file will be accessed and the key definitions
	specified by that file will be overlaid on current
	memory.		*/

main(argc, argv)
	int argc;
	char *argv[];
{
		int i, chan;
		char *keytabl, *errmess;

		keytabl = KEYTABL;
		errmess = "Bad filename; try again.\n";
		if (argc > 1) {
		chan = fopen(argv[1], "rb");
		if (chan == 0) {
			while (*errmess) putchar(*errmess++);
			exit();
		}
		for (i = 0; i < LIMIT - KEYTABL; i++) {
			*(keytabl + i) = getc(chan);
		}
		fclose(chan);
	}
}