From 3aedb36e68b88c293b1e763b7e715f18bf11da27 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 28 May 2004 22:42:41 +0000
Subject: [PATCH] check $SPELL for an alternative spell checker if we didn't
 get one from the command line and/or rcfile, as Pico does

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1776 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog  |  2 ++
 src/nano.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index b1450cd1..d78ec880 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -208,6 +208,8 @@ CVS code -
 	  after the terminal is properly set up, so that we can restore
 	  it easily after a resize. (DLR)
 	- Add missing cast to char when calling do_char(). (DLR)
+	- Check $SPELL for an alternative spell checker if we didn't get
+	  one from the command line and/or rcfile, as Pico does. (DLR)
 - nano.h:
 	- Since REGEXP_COMPILED is only used in search.c, convert it
 	  from a flag to a static int there. (DLR)
diff --git a/src/nano.c b/src/nano.c
index b136b949..1aebe419 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -3387,6 +3387,17 @@ int main(int argc, char *argv[])
 #endif
 #endif /* !DISABLE_JUSTIFY */
 
+#ifndef DISABLE_SPELLER
+    /* If we don't have an alternative spell checker after reading the
+     * command line and/or rcfile, check $SPELL for one, as Pico
+     * does. */
+    if (alt_speller == NULL) {
+	char *spellenv = getenv("SPELL");
+	if (spellenv != NULL)
+	    alt_speller = mallocstrcpy(NULL, spellenv);
+    }
+#endif
+
     if (tabsize == -1)
 	tabsize = 8;
 
-- 
GitLab