Subject: using ispell with pine

From: [email-masked] (Suhaib Khan)
Date: Mon, 4 Dec 1995 10:55:52 +0300 (GMT+0300)

Apologies if this has been answered n times before - we do not have full
internet access at this site.

Is is possible to use the interactive spell checker ispell with pine
to check composed messages before they are sent?

Please email you reply to: [email-masked]

regards,
Suhaib Khan

---

From: [email-masked] (Jerry Lynch)
Date: 8 Dec 1995 18:09:52 -0500

> Please email you reply to: [email-masked]

Option 1:
Set your "alternate editor" to: /usr/bin/ispell -x

Option 2:
You can recompile applying the following patch written by John R. 
Violette and modified by me to invoke "ispell -x" instead of "ispell" (so 
you don't collect a bunch of backup files all over the place).
 
Jerry	<[email-masked]>

-------------------------------------------------------------------
*** ../pine3.91//pico/ebind.h	Wed Jun 15 18:18:25 1994
--- .//pico/ebind.h	Wed Aug  9 11:06:32 1995
***************
*** 99,107 ****
  	{CTRL|'O',		suspend_composer},
  	{CTRL|'P',		backline},
  	{CTRL|'R',		insfile},
! #ifdef	SPELLER
! 	{CTRL|'T',		spell},
! #endif	/* SPELLER */
  	{CTRL|'U',		yank},
  	{CTRL|'V',		forwpage},
  	{CTRL|'W',		forwsearch},
--- 99,107 ----
  	{CTRL|'O',		suspend_composer},
  	{CTRL|'P',		backline},
  	{CTRL|'R',		insfile},
! #ifdef SPELLER
! 	{CTRL|'T',		ispell},
! #endif 
  	{CTRL|'U',		yank},
  	{CTRL|'V',		forwpage},
  	{CTRL|'W',		forwsearch},
***************
*** 155,163 ****
  	{CTRL|'O',		filewrite},
  	{CTRL|'P',		backline},
  	{CTRL|'R',		insfile},
! #ifdef	SPELLER
! 	{CTRL|'T',		spell},
! #endif	/* SPELLER */
  	{CTRL|'U',		yank},
  	{CTRL|'V',		forwpage},
  	{CTRL|'W',		forwsearch},
--- 155,163 ----
  	{CTRL|'O',		filewrite},
  	{CTRL|'P',		backline},
  	{CTRL|'R',		insfile},
! #ifdef SPELLER
! 	{CTRL|'T',		ispell},
! #endif 
  	{CTRL|'U',		yank},
  	{CTRL|'V',		forwpage},
  	{CTRL|'W',		forwsearch},
*** ../pine3.91//pico/efunc.h	Tue Sep 27 12:04:00 1994
--- .//pico/efunc.h	Wed Aug  9 11:07:55 1995
***************
*** 243,251 ****
  extern	int readpattern(char *);
  extern	int forscan(int *, char *, int);
  
! /* spell.c */
  #ifdef	SPELLER
! extern	int spell(int, int);
  #endif
  
  /* window.c */
--- 243,251 ----
  extern	int readpattern(char *);
  extern	int forscan(int *, char *, int);
  
! /* os_unix.c */
  #ifdef	SPELLER
! extern	int ispell(int, int);
  #endif
  
  /* window.c */
***************
*** 446,454 ****
  extern	int readpattern();
  extern	int forscan();
  
! /* spell.c */
  #ifdef	SPELLER
! extern	int spell();
  #endif
  
  /* window.c */
--- 446,454 ----
  extern	int readpattern();
  extern	int forscan();
  
! /* os_unix.c */
  #ifdef	SPELLER
! extern	int ispell();
  #endif
  
  /* window.c */
*** ../pine3.91//pico/os_unix.c	Mon Oct 10 19:28:57 1994
--- .//pico/os_unix.c	Wed Aug  9 11:34:17 1995
***************
*** 676,681 ****
--- 676,811 ----
  }

+ /*
+ /*
+  * ispell  - fork off ispell while in message composition 
+  *           ispell support added by John R. Violette Bell Canada
+  *           due to pine FAQ suggestion of using alternate editor
+  *           and setting to ispell to use ispell but then one
+  *           can't have an alternate editor so I made the CTRL-T
+  *           binding call ispell which is a stripped down version
+  *           of alt_editor
+  */
+ ispell(f, n)
+ {
+     char   eb[NLINE];				/* buf holding edit command */
+     char   *fn;					/* tmp holder for file name */
+     char   *cp;
+     char   *args[MAXARGS];			/* ptrs into edit command */
+     char   *writetmp();
+     int	   child, pid, i, done = 0;
+     long   l;
+ #if	defined(POSIX) || defined(sv3) || defined(COHERENT) || defined(isc) || defined(neb)
+     int    stat;
+ #else
+     union  wait stat;
+ #endif
+     FILE   *p;
+     SIGTYPE (*ohup)(), (*oint)(), (*osize)(), (*ostop)(), (*ostart)();
+ 
+     /* hack by JRV Bell Canada to hard-code ispell to CTRL-T in compose of
+        pine */
+     strcpy(eb, SPELLER);
+ 
+     if((fn=writetmp(0, 1)) == NULL){		/* get temp file */
+ 	emlwrite("Problem writing temp file for alt editor", NULL);
+ 	return(-1);
+     }
+ 
+     strcat(eb, " ");
+     strcat(eb, fn);
+ 
+     cp = eb;
+     for(i=0; *cp != '\0';i++){			/* build args array */
+ 	if(i < MAXARGS){
+ 	    args[i] = NULL;			/* in case we break out */
+ 	}
+ 	else{
+ 	    emlwrite("Too many args for command!", NULL);
+ 	    return(-1);
+ 	}
+ 
+ 	while(isspace(*cp))
+ 	  if(*cp != '\0')
+ 	    cp++;
+ 	  else
+ 	    break;
+ 
+ 	args[i] = cp;
+ 
+ 	while(!isspace(*cp))
+ 	  if(*cp != '\0')
+ 	    cp++;
+ 	  else
+ 	    break;
+ 
+ 	if(*cp != '\0')
+ 	  *cp++ = '\0';
+     }
+ 
+     args[i] = NULL;
+ 
+     if(Pmaster)
+       (*Pmaster->raw_io)(0);			/* turn OFF raw mode */
+ 
+     emlwrite("Invoking speller...", NULL);
+ 
+     if(child=fork()){			/* wait for the child to finish */
+ 	ohup = signal(SIGHUP, SIG_IGN);	/* ignore signals for now */
+ 	oint = signal(SIGINT, SIG_IGN);
+ #ifdef	TIOCGWINSZ
+         osize = signal(SIGWINCH, SIG_IGN);
+ #endif
+ 
+ /*
+  * BUG - wait should be made non-blocking and mail_pings or something 
+  * need to be done in the loop to keep the imap stream alive
+  */
+ 	while((pid=(int)wait(&stat)) != child)
+ 	  ;
+ 
+ 	signal(SIGHUP, ohup);	/* restore signals */
+ 	signal(SIGINT, oint);
+ #ifdef	TIOCGWINSZ
+         signal(SIGWINCH, osize);
+ #endif
+     }
+     else{				/* spawn editor */
+ 	signal(SIGHUP, SIG_DFL);	/* let editor handle signals */
+ 	signal(SIGINT, SIG_DFL);
+ #ifdef	TIOCGWINSZ
+         signal(SIGWINCH, SIG_DFL);
+ #endif
+ 
+ 	if(execvp(args[0], args) < 0) {
+ 	  if (errno == ENOENT) {
+ 	    emlwrite("\007Error: can't execute %s; not in $PATH", SPELLER);
+ 	  } else {
+ 	    emlwrite("\007Error: can't execute %s; system error", SPELLER);
+ 	  }
+ 	  sleep(3);
+ 	  exit(1);
+         }
+     }
+ 
+     if(Pmaster)
+       (*Pmaster->raw_io)(1);		/* turn ON raw mode */
+ 
+     /*
+      * replace edited text with new text 
+      */
+     curbp->b_flag &= ~BFCHG;		/* make sure old text gets blasted */
+     readin(fn, 0);			/* read new text overwriting old */
+     unlink(fn);				/* blast temp file */
+     curbp->b_flag |= BFCHG;		/* mark dirty for packbuf() */
+ 
+     /* JRV only need if in Pine not Pico standalone */
+     if(Pmaster)
+       ttopen();				/* reset the signals */
+     refresh(0, 1);			/* redraw */
+     return(0);
+ }
+ 
  
  /*
   *  bktoshell - suspend and wait to be woken up
*** ../pine3.91//pico/os_unix.h	Mon Oct 10 19:29:05 1994
--- .//pico/os_unix.h	Wed Aug  9 11:05:31 1995
***************
*** 130,141 ****
  /*
   * What and where the tool that checks spelling is located.  If this is
   * undefined, then the spelling checker is not compiled into pico.
   */
! #if	defined(COHERENT) || defined(AUX)
! #define SPELLER         "/bin/spell"
! #else
! #define	SPELLER		"/usr/bin/spell"
! #endif
  
  /* memcpy() is no good for overlapping blocks.  If that's a problem, use
   * the memmove() in ../c-client
--- 130,139 ----
  /*
   * What and where the tool that checks spelling is located.  If this is
   * undefined, then the spelling checker is not compiled into pico.
+  * ispell support added by John R. Violette Bell Canada [email-masked]
+  * ispell must be in the user's path.
   */
! #define SPELLER "ispell -x"
  
  /* memcpy() is no good for overlapping blocks.  If that's a problem, use
   * the memmove() in ../c-client

---

From: [email-masked] (Jerry Lynch)
Date: 8 Dec 1995 18:09:52 -0500

Option 1:

Option 2:
 
Jerry	<[email-masked]>

! /* spell.c */
  #ifdef	SPELLER
  
  /* window.c */
--- 243,251 ----
  
! /* os_unix.c */
  #ifdef	SPELLER
  
  /* window.c */
***************
*** 446,454 ****
  
! /* spell.c */
  #ifdef	SPELLER
! extern	int spell();
  #endif
  
  /* window.c */
--- 446,454 ----
  
! /* os_unix.c */
  #ifdef	SPELLER
! extern	int ispell();
  #endif
  
  /* window.c */

+ /*
+ /*
  
  /*