diff options
author | Case Duckworth | 2022-07-09 23:13:39 -0500 |
---|---|---|
committer | Case Duckworth | 2022-07-09 23:13:39 -0500 |
commit | 9a09be3fa83e402038326e8426665fa94d73273d (patch) | |
tree | 9c78cff7c37a47106825658fc93e56fe72825fd3 | |
parent | Add COPYING (diff) | |
download | thesauracles-9a09be3fa83e402038326e8426665fa94d73273d.tar.gz thesauracles-9a09be3fa83e402038326e8426665fa94d73273d.zip |
Cache results
-rwxr-xr-x | thesauracles | 9 |
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 | |||
16 | hops=3 | 16 | hops=3 |
17 | 17 | ||
18 | query() { | 18 | query() { |
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 |