forsyth20121205-174063a80cc13 years agoHistory
35 lines · 496 B · C
RawDownload
#include "lib9.h"#include <a.out.h>#include <dynld.h> typedef struct Fd Fd;struct Fd {	int	fd;}; static longreadfd(void *a, void *buf, long nbytes){	return read(((Fd*)a)->fd, buf, nbytes);} static vlongseekfd(void *a, vlong off, int t){	return seek(((Fd*)a)->fd, off, t);} static voiderrfd(char *s){	werrstr("%s", s);} Dynobj*dynloadfd(int fd, Dynsym *sym, int nsym, ulong maxsize){	Fd f; 	f.fd = fd;	return dynloadgen(&f, readfd, seekfd, errfd, sym, nsym, maxsize);}