]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
look: use WORDLIST environment variable to find word list
authorSami Kerola <kerolasa@iki.fi>
Sat, 12 Aug 2017 08:31:11 +0000 (09:31 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 21 Aug 2017 08:48:20 +0000 (10:48 +0200)
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
misc-utils/look.c

index 503e3858417f56c9b77f05b39c66ccb5aa4d2073..cca83416ece16adf2919842ae39db5f888dcd298 100644 (file)
@@ -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
index 60fbbbfca1a7fd1445a7fc63fb086a6e29bff885..d2699bfdd695c2dc963c23601f08a94e7a62c226 100644 (file)
@@ -104,7 +104,11 @@ main(int argc, char *argv[])
 
        setlocale(LC_ALL, "");
 
-       file = _PATH_WORDS;
+       if ((file = getenv("WORDLIST")) && !access(file, R_OK))
+               /* use the WORDLIST */;
+       else
+               file = _PATH_WORDS;
+
        termchar = '\0';
        string = NULL;          /* just for gcc */