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

⟦5a0811d09⟧ TextFile

    Length: 1969 (0x7b1)
    Types: TextFile
    Notes: UNIX file
    Names: »junk.c«

Derivation

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

TextFile

#include <stdio.h>
#include <signal.h>


char	HRIPC[]	= "/drv/hripc",
	CLEAR[]	= "/bin/sclear",
	DMGR[]	= "/usr/hr/bin/dmgr",
	SMGR[]	= "/usr/hr/bin/smgr",
	TEXT[]	= "/usr/hr/bin/text",
	GMGR[]	= "/usr/hr/bin/gmgr",
	CLOCK[]	= "/usr/hr/bin/clock";

char	*progs[] = { DMGR, SMGR, TEXT, GMGR, CLOCK };
char	*pname[] = { "dmgr", "smgr", "text", "gmgr", "clock" };
int	ppid[5];

main()
{
	register int	pid;
	register int	i;
	int status;
	while (1) {
		
		
	/*
	 *	Load the IPC driver
	 */
	pid = spawn("/dev/null", "sclear", "sclear", "w",NULL);
		while(wait(&status) != pid);
	pid = spawn("/dev/null", "font_demo", "font_demo",NULL);
	sleep(24);
	kill(pid,SIGKILL);
	pid = spawn("/dev/null", "sclear","sclear","w",NULL);
	while(wait(&status) != pid);
	pid = spawn("/dev/null","rotcube","rotcube",NULL);
	sleep(6);
	kill(pid,SIGKILL);
	pid = spawn("/dev/null","sclear","sclear","w",NULL);
	while(wait(&status) != pid);
	pid = spawn("/dev/null","pencil","pencil",NULL);
	sleep(6);
	kill(pid,SIGKILL);
	pid = spawn("/dev/null","csoup","csoup",NULL);
	sleep(6);
	}
}



/*
 * Wait for the given process to complete.
 */
waitc(p1)
register int p1;
{
	register int p2;

	while ((p2=wait(NULL))>=0 && p2!=p1)
		;
}


/*
 * 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);
}