ref: e7c9090ec696e9cc776f915a73dcd3a4c6067639
parent: d649586e750604585369429b82963dbed434307d
author: james palmer <foura@biobuf.link>
date: Tue Jun 8 08:43:09 EDT 2021
make print fns and ctl fn return what the vfprint call returns
--- a/acme.h
+++ b/acme.h
@@ -41,12 +41,12 @@
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 *);
--- a/window.c
+++ b/window.c
@@ -97,14 +97,17 @@
}
}
-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 @@
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