gawk

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

commit 033dc22130ac8897bdb3bc1e07413fbeac89f360
parent db48c99467b4fae2152c7db8afa4389f2053112b
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Wed,  6 Jan 2021 14:41:50 -0800

Remove automatic command on caching a file

This is what the `;' separator can be used for. It doesn't really
need to be done by the program, especially in this way, aliases
would be a better way.

Diffstat:
MMakefile | 2+-
Mconfig.def.h | 3---
Mmain.c | 12+++---------
3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile @@ -14,7 +14,7 @@ all: ${TARGET} .c.o: ${CC} -c ${CFLAGS} $< -${OBJS}: Makefile config.def.h +${OBJS}: Makefile config.h config.h: cp config.def.h $@ diff --git a/config.def.h b/config.def.h @@ -3,9 +3,6 @@ /* how long to wait for response in ms */ static int const timeout = 5 * 1000; -/* command which gets run when a file is cached */ -static char const cache_command[] = "p"; - /* default address if arguments are ommited */ static char *default_address[] = { /* path, host, port */ diff --git a/main.c b/main.c @@ -372,12 +372,12 @@ gawk(char **addr) int mycache; tmp_mkpath(cache, addr); - if (exists(cache)) + if (exists(cache)) { mycache = 0; - else { - mycache = 1; + } else { if (gopher(addr, cache, 0) == 1) return ERROR; + mycache = 1; } ++depth; @@ -385,14 +385,8 @@ gawk(char **addr) snprintf(prompt, sizeof(prompt), "(%d) [%s] %s ", depth, addr[AR_HOST], addr[AR_PATH]); done = 0; - - if (mycache) { - strlcpy(inbuf, cache_command, sizeof(inbuf)); - goto execute; - } while (!fatal && done <= 0 && input(inbuf, sizeof(inbuf), separators[0], prompt, stdin) == 0) { -execute: done = execute(cache, inbuf, depth, addr); }