~foura/libacme

e7c9090ec696e9cc776f915a73dcd3a4c6067639 — james palmer 5 months ago d649586
make print fns and ctl fn return what the vfprint call returns
2 files changed, 21 insertions(+), 12 deletions(-)

M acme.h
M window.c
M acme.h => acme.h +4 -4
@@ 41,12 41,12 @@ AWin *	awincreate(void);
void	awinclose(AWin *);
void	awincloseall(void);

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


M window.c => window.c +17 -8
@@ 97,14 97,17 @@ awincloseall(void)
	}
}

void
int
awinctl(AWin *w, char *fmt, ...)
{
	va_list args;
	int ret;
	
	va_start(args, fmt);
	vfprint(w->ctlfd, fmt, args);
	ret = vfprint(w->ctlfd, fmt, args);
	va_end(args);
	
	return ret;
}

void


@@ 140,50 143,56 @@ awincat(AWin *w, int fd)
	return 0;
}

void
int
awinprint(AWin *w, char *fmt, ...)
{
	int fd;
	int ret;
	va_list args;
	
	fd = awinfsopen(w, "body", OWRITE);
	
	va_start(args, fmt);
	vfprint(fd, fmt, args);
	ret = vfprint(fd, fmt, args);
	va_end(args);
	
	close(fd);
	return ret;
}

void
int
awinerror(AWin *w, char *fmt, ...)
{
	int fd;
	int ret;
	va_list args;
	
	fd = awinfsopen(w, "errors", OWRITE);
	
	va_start(args, fmt);
	vfprint(fd, fmt, args);
	ret = vfprint(fd, fmt, args);
	va_end(args);
	
	close(fd);
	return ret;
}

void
int
awinfatal(AWin *w, char *fmt, ...)
{
	int fd;
	int ret;
	va_list args;
	
	fd = awinfsopen(w, "body", OWRITE);
	
	va_start(args, fmt);
	vfprint(fd, fmt, args);
	ret = vfprint(fd, fmt, args);
	va_end(args);
	
	awinclose(w);
	close(fd);
	return ret;
}

void