gawk

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

commit 86a094f1f0386a9db4eca4f2f4ab7b615314bb24
parent 335acd2a4c30a0d488101c23eead25c603beee3c
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Wed, 23 Dec 2020 14:34:04 -0800

Rename and refine getcache()

The name ``getcache'' is misleading so it is now ``tmp_mkpath''.

Use `_' as a field separator rather than `-' which is what the
filesystem separator is replaced with.

Diffstat:
Mmain.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/main.c b/main.c @@ -626,13 +626,13 @@ execute(int argc, const char **argv, int depth, const char *cache, } void -getcache(char *cache, const char **addr) +tmp_mkpath(char *cache, const char **addr) { char tmp[MY_PATH_MAX]; - strlcpy(tmp, addr[AR_PATH], MY_PATH_MAX); + strlcpy(tmp, addr[AR_PATH], sizeof(tmp)); tr(tmp, '/', '-'); - snprintf(cache, MY_PATH_MAX, "%s/%s-%s-%s", tmpdir, addr[AR_HOST], addr[AR_PORT], tmp); + snprintf(cache, MY_PATH_MAX, "%s/%s_%s_%s", tmpdir, addr[AR_HOST], addr[AR_PORT], tmp); } int @@ -647,7 +647,7 @@ gawk(const char **addr) int done; int mycache; - getcache(cache, addr); + tmp_mkpath(cache, addr); if (exists(cache)) mycache = 0; else {