aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-23 11:18:54 +0200
committerlemon <lsof@mailbox.org>2025-10-23 11:18:54 +0200
commit0a51f5b8d9b3d98225382277a176fa85ccdb5ab8 (patch)
treed4d4fa38c04db077bac14137f965d51385f87b6a /common.h
parentcb199f47ca31b079212fe4fd3987e5ba39b12273 (diff)
use libc's stdout/stderr; also eliminate some unnecessary recursion in bfmt
Diffstat (limited to 'common.h')
-rw-r--r--common.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/common.h b/common.h
index 6f01da0..9c9fd70 100644
--- a/common.h
+++ b/common.h
@@ -541,11 +541,17 @@ rsiter(int *i, uvlong rs)
/********/
struct wbuf {
- char *buf;
- const uint cap;
- uint len;
- int fd;
+ union {
+ struct {
+ char *buf;
+ const uint cap;
+ uint len;
+ int fd;
+ };
+ void *fp;
+ };
bool err;
+ bool isfp;
};
/* read-only file mapping that is at least 1 page larger than the real file
@@ -562,9 +568,10 @@ struct embedfile {
size_t len;
};
-#define MEMBUF(buf, cap) { (buf), (cap), .fd = -1 }
-#define FDBUF(buf, cap, fd_) { (buf), (cap), .fd = (fd_) }
+#define MEMBUF(buf_, cap_) { .buf = (buf_), .cap = (cap_), .fd = -1 }
+#define FDBUF(buf_, cap_, fd_) { .buf = (buf_), .cap = (cap_), .fd = (fd_) }
extern struct wbuf bstdout, bstderr;
+void ioinit(void);
void iowrite(struct wbuf *, const void *src, int n);
void ioputc(struct wbuf *, uchar);
void ioflush(struct wbuf *);