DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦719b6bc97⟧ TextFile

    Length: 1243 (0x4db)
    Types: TextFile
    Notes: UNIX file
    Names: »IOREAD.C«, »ioread.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦2d53db1df⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »frankh/src/IOREAD.C« 
        └─ ⟦this⟧ »frankh/src/ioread.c« 

TextFile

#include <stdio.h>

char	HRPORT[] = "/drv/hrport";

initio()

{
	register int	pid;
	register int	fd;
	int status;

	/*
	 *	Load the IPC driver
	 */
	pid = spawn("/dev/null", "/etc/load", "load", HRPORT, NULL);
	while (wait(&status) != pid)
		;
/*	printf("status 0x%x\n", status);		*/
	if (status != 0)
		exit(status);
}

cloio()
{
	register int	pid;
	register int	fd;
	int status;

	pid = spawn("/dev/null", "/etc/uload", "uload", HRPORT, NULL);
	while (wait(NULL) != pid)
		;
}


/*
 * Spawn off a command.
 */
spawn(tp, np, ap)
char *tp;
char *np;
char *ap;
{
	register int pid;
	register int fd;

	if ((pid=fork()) != 0)
	{
		if ( pid < 0 )
			panic("Couldn't fork ", np);
		return (pid);
	}
	if ((fd=open(tp, 2)) < 0)
		panic("Cannot open ", tp, NULL);
	dup2(0, 1);
	dup2(0, 2);
	execv(np, &ap);
	panic("Cannot execute ", np, NULL);
	return (pid);
}


/*
 * Print out a list of error messages and exit.
 */
panic(cp)
char *cp;
{
	register char **cpp;

	close(0);
	open("/dev/console", 2);
	for (cpp=&cp; *cpp!=NULL; cpp++)
		printl(*cpp);
	printl("\n");
	exit(0377);
}


/*
 * Print out a string on the standard output.
 */
printl(cp1)
register char *cp1;
{
	register char *cp2;

	for (cp2=cp1; *cp2; cp2++)
		;
	write(0, cp1, cp2-cp1);
}