From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: Sami Kerola <kerolasa@iki.fi>
Subject: [PATCH] look: use WORDLIST environment variable to find word list
Date: Sat, 12 Aug 2017 09:32:08 +0100 [thread overview]
Message-ID: <20170812083208.1208-2-kerolasa@iki.fi> (raw)
In-Reply-To: <20170812083208.1208-1-kerolasa@iki.fi>
The WORDLIST is the same hunspell(1) and ispell(1) uses to achieve the same.
Apparently aspell(1) does not work with files like traditional dict lists.
Reference: https://github.com/hunspell/hunspell/blob/master/man/hunspell.1#L388
Reference: http://www.skrenta.com/rt/man/ispell.1.html
Reference: http://aspell.net/man-html/Creating-an-Individual-Word-List.html#Creating-an-Individual-Word-List
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
misc-utils/look.1 | 5 +++++
misc-utils/look.c | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/misc-utils/look.1 b/misc-utils/look.1
index 503e38584..cca83416e 100644
--- a/misc-utils/look.1
+++ b/misc-utils/look.1
@@ -101,6 +101,11 @@ sort -d /etc/passwd -o /tmp/look.dict
look -t: root:foobar /tmp/look.dict
.nf
.RE
+.SH ENVIRONMENT
+.TP
+.B WORDLIST
+Path to a dictionary file. The environment variable has greater priority
+than the dictionary path defined in FILES segment.
.SH FILES
.IP "\fB/usr/share/dict/words\fR" 4
the dictionary
diff --git a/misc-utils/look.c b/misc-utils/look.c
index 60fbbbfca..00061f2a3 100644
--- a/misc-utils/look.c
+++ b/misc-utils/look.c
@@ -104,7 +104,12 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
- file = _PATH_WORDS;
+ if ((file = getenv("WORDLIST"))) {
+ if (access(file, R_OK))
+ err(EXIT_FAILURE, "WORDLIST=%s", file);
+ } else
+ file = _PATH_WORDS;
+
termchar = '\0';
string = NULL; /* just for gcc */
--
2.14.1
next prev parent reply other threads:[~2017-08-12 8:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-12 8:32 [PATCH] isosize: iterate over all arguments even when something fails Sami Kerola
2017-08-12 8:32 ` Sami Kerola [this message]
2017-08-14 9:12 ` [PATCH] look: use WORDLIST environment variable to find word list Karel Zak
2017-08-15 18:13 ` Sami Kerola
2017-08-21 9:20 ` Karel Zak
2017-08-14 9:08 ` [PATCH] isosize: iterate over all arguments even when something fails Karel Zak
2017-08-15 18:23 ` Sami Kerola
2017-08-21 9:20 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170812083208.1208-2-kerolasa@iki.fi \
--to=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox