~foura/libacme

27e08900d5716c2b3bb909fdc6cbe0bcfbb137ee — james palmer 5 months ago 0f90115
awincat: take an fd not a path
2 files changed, 3 insertions(+), 8 deletions(-)

M acme.h
M window.c
M acme.h => acme.h +1 -1
@@ 43,7 43,7 @@ void	awincloseall(void);

void	awinctl(AWin *, char *, ...);
void	awinclear(AWin *);
int		awincat(AWin *, char *);
int		awincat(AWin *, int fd);
void	awinprint(AWin *, char *, ...);
void	awinerror(AWin *, char *, ...);
void	awinfatal(AWin *, char *, ...);

M window.c => window.c +2 -7
@@ 104,19 104,14 @@ awinclear(AWin *w)
}

int
awincat(AWin *w, char *file)
awincat(AWin *w, int fd)
{
	int body, fd;
	int body;
	char *buf;
	long n;
	
	buf = malloc(8*1024);
	body = awinfsopen(w, "body", OWRITE);
	fd = open(file, OREAD);
	if(fd < 0) {
		awinerror(w, "awincat read: %r");
		return -1;
	}
		
	while((n=read(fd, buf, 8*1024)) > 0) {
		if(write(body, buf, n) != n) {