gawk

[old] Sed-like interface to the Gopher protocol
Log | Files | Refs | LICENSE

commit b562cc7e674b9116daa0d25819bc3154aa3f267d
parent 427c28844a8b71d6b4acda08c1375fc6d7aa0bed
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Thu, 24 Dec 2020 15:49:07 -0800

Add some support for type 7

Although your search is limited to a single word it is now possible.

Diffstat:
Mmain.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c @@ -240,10 +240,19 @@ too_big: int gph_send(int sock, const char *message) { - if (send(sock, message, strlen(message), 0) == -1) { + int status; + char *query; + + if ((query = strchr(message, '?'))) + *query = '\t'; + status = send(sock, message, strlen(message), 0); + if (query) + *query = '?'; + if (status == -1) { warn("unable to send message"); return 1; } + if (shutdown(sock, SHUT_WR)) { warn("shutdown"); return 1; @@ -530,6 +539,7 @@ cextern(int argc, const char **argv, int index, const char **item) int cgoto(int argc, const char **argv, int index, const char **item) { + /* TODO: implement 7 type support */ if (**item == '1') return gawk(itemtoaddr(item)); warnc(EFTYPE, "%d", index);