/* Write a byte value to the parallel port. Useful if you've got a simple
 * device connected to it that you want to be able to control from a shell
 * script (like my digibox remote control kludge). */

#include <stdio.h>
#include <stdlib.h>
#include <sys/io.h>

/* Base address of parallel port */
#define BASE 0x378

int data = BASE;
int status = BASE + 1;

int main(int argc, char **argv) {
	int value;

	if (argc < 1) {
		fprintf(stderr, "usage: writepp value\n");
		return 20;
	}

	value = atoi(argv[1]);

	if (ioperm(BASE, 3, 1) < 0) {
		fprintf(stderr, "ioperm failed\n");
		return 20;
	}

	outb(value, data);
	return 0;
}

