From 38987f3f5a3919ac81ba419e05ac8610c269faff Mon Sep 17 00:00:00 2001 From: wrmr Date: Sat, 9 Nov 2024 02:04:33 -0500 Subject: rename buf_t to str_t, and consolidate str.c/h with strv.c/h --- net.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'net.c') diff --git a/net.c b/net.c index 0d6604e..87fe659 100644 --- a/net.c +++ b/net.c @@ -129,12 +129,12 @@ static int fetch_file(const struct addr *adr, struct buf *buf, enum doc_type *do perr("file not found"); return -1; } - buf_init(buf, 1024); + str_init(buf, 1024); char b[256]; while (fgets(b, sizeof b, f)) { - buf_cat(buf, strv(b)); + str_cat(buf, strv(b)); } - buf_catc(buf, 0); + str_catc(buf, 0); fclose(f); *doct = DOC_PLAIN; return 0; @@ -173,18 +173,18 @@ static int fetch_gopher(const struct addr *adr, struct buf *buf, enum doc_type * perr("write failure"); return -1; } - buf_init(buf, 64); + str_init(buf, 64); char inbuf[256]; for (;;) { ssize_t n = read(s, inbuf, sizeof inbuf); if (n < 0) { perr("read error"); - buf_free(buf); + str_free(buf); close(s); return -1; } if (!n) break; - buf_cat(buf, (strv_t) { inbuf, n }); + str_cat(buf, (strv_t) { inbuf, n }); } close(s); return 0; -- cgit 1.4.1-2-gfad0