From de06b48c36f64842b2417daea999df54e40528e0 Mon Sep 17 00:00:00 2001 From: Leonid Evdokimov Date: Fri, 12 Jul 2024 23:00:06 +0300 Subject: [PATCH] Add ENV{SMHASHER_WORDS} to override `/usr/share/dict/words` dictionary --- HashMapTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HashMapTest.cpp b/HashMapTest.cpp index 76a52759..1ebdb2b9 100644 --- a/HashMapTest.cpp +++ b/HashMapTest.cpp @@ -18,7 +18,8 @@ using namespace std; std::vector HashMapInit(bool verbose) { std::vector words; std::string line; - std::string filename = "/usr/share/dict/words"; + const char* const env_words = getenv("SMHASHER_WORDS"); + std::string filename(env_words ? env_words : "/usr/share/dict/words"); int lines = 0, sum = 0; std::ifstream wordfile(filename.c_str()); if (!wordfile.is_open()) {