diff options
author | wrmr | 2024-11-09 02:04:33 -0500 |
---|---|---|
committer | wrmr | 2024-11-09 02:04:33 -0500 |
commit | 38987f3f5a3919ac81ba419e05ac8610c269faff (patch) | |
tree | dc76c691f0e7d8385224ede708b9390b50b68dff /net.c | |
parent | 12d5d0df5c4b958bbb5cc339a9e556c50136a974 (diff) |
rename buf_t to str_t, and consolidate str.c/h with strv.c/h
Diffstat (limited to 'net.c')
-rw-r--r-- | net.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; |