|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1261 (0x4ed)
Types: TextFile
Notes: UNIX file
Names: »kclear.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »frankh/src/junk/kclear.c«
└─⟦this⟧ »hr/src/port/kclear.c«
#include <stdio.h>
char HRPORT[] = "/drv/hrport";
main()
{
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);
fd = open("/dev/port", 2);
outb(fd, 0x205, 02);
outb(fd, 0x1f, 0);
outb(fd, 0x1f, 8);
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);
}