/*
 *	Output bbc vdu commands.  No checking for syntactially correct VDU
 *	commands, folks, so get the number of arguments right!
 *
 *	Has to be used in graphics mode on the beeb cos it needs to do
 *	2 to 3 encoding to get the data through.
 *
 *	Martin Guy, University of Kent, March 1988
 */

#include <stdio.h>
#include <ctype.h>

main(argc, argv)
char **argv;
{
	register int i;

	if (argc < 2) {
		/* No args?  They obviously don't know what they are doing. */
		fputs("Usage: vdu control_code ...\n", stderr);
		exit(1);
	}

	/* Check that args are all numeric */
	for (i=1; i<argc; i++) {
		register char *cp;

		for (cp = argv[i]; *cp != '\0'; cp++) {
			if (!isdigit(*cp)) {
				fprintf(stderr, "%s: Arguments must all be decimal numbers.\n", argv[0]);
				exit(1);
			}
		}
	}

	bbcopen();

	for (i=1; i<argc; i++) {
		bbcbyte(atoi(argv[i]));
	}

	bbcclose();

	exit(0);
}
