summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-07-09 23:13:39 -0500
committerCase Duckworth2022-07-09 23:13:39 -0500
commit9a09be3fa83e402038326e8426665fa94d73273d (patch)
tree9c78cff7c37a47106825658fc93e56fe72825fd3
parentAdd COPYING (diff)
downloadthesauracles-9a09be3fa83e402038326e8426665fa94d73273d.tar.gz
thesauracles-9a09be3fa83e402038326e8426665fa94d73273d.zip
Cache results
-rwxr-xr-xthesauracles9
1 files changed, 6 insertions, 3 deletions
diff --git a/thesauracles b/thesauracles index 3891d18..aafa3c8 100755 --- a/thesauracles +++ b/thesauracles
@@ -16,9 +16,12 @@ wf=/tmp/thesauracles
16hops=3 16hops=3
17 17
18query() { 18query() {
19 response="$(mktemp /tmp/thesauracles.XXXXXX)" 19 response="/tmp/$1.thesauracles"
20 trap "rm -f $response" KILL 20 if [ ! -f "$response" ]; then
21 curl "dict://$dict_server/d:$1:$dict_database" >"$response" 2>/dev/null 21 curl "dict://$dict_server/d:$1:$dict_database" >"$response" 2>/dev/null
22 else
23 sleep 0.3
24 fi
22 if grep -q 552 "$response"; then 25 if grep -q 552 "$response"; then
23 return 1 26 return 1
24 fi 27 fi