home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / txtutl / cspelsrc.arc / CSPELLA.C < prev    next >
Text File  |  1987-12-09  |  49KB  |  2,320 lines

  1.  
  2.               /*              PROGRAM dumb.C                 */
  3.               /*              by Peter A. Banks              */
  4.               /*             Home phone 481-8242             */
  5.               /*             Work Phone 568-4855             */
  6.               /*         Compiled  under Turbo C (tcc)       */
  7.               /*         linked  with Microsoft linker       */
  8.               /*          Turbo's linker did not work        */
  9.  
  10.  
  11.  
  12.  
  13. #include "stdio.h"
  14.  
  15. #include "io.h"
  16.  
  17. #include "alloc.h"
  18.  
  19. #include "conio.h"
  20.  
  21. #include "ctype.h"
  22.  
  23. #include "stdlib.h"
  24.  
  25. #include "dir.h"
  26.     
  27. #include "string.h"
  28.      
  29. #include "DOS.H"
  30.  
  31. #include "limits.h"
  32.  
  33. #include "stddef.h"
  34.  
  35.  
  36.  
  37. #define NO_DEBUG
  38.  
  39. #define LINELIM  255 /* maX NUMBER 
  40. CHARACTERS PER LINE */
  41.  
  42. #define WORDSTAR 0
  43.  
  44. #define SEDT_PTP 144
  45.  
  46. #define MAXWRD 20  
  47.  
  48. #define MAXLINE  255
  49.  
  50. #define CRET 13
  51.  
  52. #define DEL  127
  53.  
  54. #define PERIOD 46
  55.  
  56. #define BCKSP  8
  57.  
  58. #define COLON 58
  59.  
  60. #define SLASH 47
  61.  
  62. #define BCKSLSH  92
  63.  
  64. #define HYPHEN 45
  65.  
  66.     
  67.            /* Globals varables define */
  68.  
  69. int video = 0;
  70. int wrrd = 0;
  71. int totwrd; /* TOTAL WORDS */
  72. int  mspwrd; /* miss-spelled words */
  73. int result; /* RESULT OF FOPEN */
  74. int letcnt = 0; /* LETTER COUNT  OF WORD */
  75. int hyphcnt = 0; /* LETTER COUNT  OF WORD */
  76. int perdex = 0;   /* pointer of personal dictionary */
  77. int lnlength = 0; /* length of line */
  78. long int memaval;
  79. char  *path ;
  80. char  *drive;
  81. char  *dirr ;
  82. char  *nam  ;
  83. char  *ext  ; 
  84. char  srcline [MAXLINE];
  85. char  wordtex[MAXWRD] = "";  /* word extracted from source line */
  86. char  hyphtex[MAXWRD] = "";  /* word extracted from source line with hyphen */
  87. char  srchtx[MAXWRD];  /* word extracted from source line */
  88. char  srchtex[MAXWRD];  /* word extracted from source line */
  89. char  *dctenv = NULL;
  90. char  *chrpnt = NULL;
  91. char outln [MAXLINE];
  92. char perdctt = 1;
  93. unsigned char hyphen = 0;
  94. unsigned char hyphen1 = 0;
  95. unsigned char hyphen2 = 0;
  96. unsigned char marker = SEDT_PTP;
  97. char  *srcdir = NULL;
  98. char fylnam [60];
  99. char tmmpnam [60];
  100. char perdctnam [60];
  101. char  *tmpnam;
  102. char  *tmpfyl;
  103. FILE *source;
  104. FILE *perdct;
  105. FILE *output;
  106. FILE *temp;
  107.  
  108.         /* dictionaries defined */
  109.  
  110. #define THREELN  478 
  111. extern char threedct [THREELN] [4];
  112. int threesiz = THREELN;
  113.         
  114. #define FOURLN  1439
  115. extern char fourdct [FOURLN] [5];
  116.  
  117. #define FIVELN  1968
  118. extern char fivedct [FIVELN] [6];    
  119.  
  120. #define SIXLN  2378
  121.  
  122. extern char sixdct [SIXLN] [7];
  123.  
  124. #define SEVNLN  2382
  125. extern char sevndct [SEVNLN] [8];
  126.  
  127. #define EIGHTLN 2013
  128. extern char eightdct [EIGHTLN] [9];
  129.  
  130. #define  NINELN 1807
  131. extern char ninedct [NINELN] [10];
  132.  
  133. #define  TENLN 1331
  134. extern char tendct [TENLN] [11];
  135.  
  136. #define  ELEVENLN 943
  137. extern char elevendct [ELEVENLN] [12];
  138.  
  139. #define  TWELVELN 529
  140. extern char twelvedct [TWELVELN] [13];
  141.  
  142. #define  T3TENLN 347
  143. extern char t3tendct [T3TENLN] [14];
  144.  
  145. #define  FORTENLN 156
  146. extern char fortendct [FORTENLN] [15];
  147.  
  148. #define  FIVTENLN 74
  149. extern char fivtendct [FIVTENLN] [16];  
  150.  
  151. #define  SIXTENLN 42
  152. extern char sixtendct [SIXTENLN] [17]; 
  153.  
  154. #define  SEVTENLN 18
  155. extern char sevtendct [SEVTENLN] [18];
  156.  
  157. #define EITENLN 4
  158. extern char eitendct [EITENLN] [19];
  159.  
  160. int persize;
  161. extern char personaldct [1500] [21];
  162.  
  163. int collums;
  164. int page;
  165. int mode;
  166.  
  167. #ifdef  TIMER
  168. struct time st_time;
  169. struct time end_time;
  170. struct time tot_time;
  171. #endif TIMER
  172.  
  173.  
  174.  
  175. union REGS reg;
  176.  
  177. void GOTOXY(x,y)
  178. int x,y;
  179. {
  180. #ifdef CLONE
  181. reg.h.ah = 2;
  182. reg.h.bh = page;
  183. reg.h.dl = x;
  184. reg.h.dh = y;
  185. int86(0x10,®,®);
  186. #endif CLONE
  187.  
  188. #ifdef RAINBOW
  189. cprintf("\033[%1d;%1df",y,x);
  190. #endif RAINBOW
  191. }
  192.  
  193. void selpage(page)
  194. int page;
  195. {
  196. reg.h.ah = 5;
  197. reg.h.al = 131;
  198. reg.h.bh = page;
  199. reg.h.bl = 01;
  200. int86(0x10,®,®);
  201. }
  202.  
  203.  
  204. int getmode()
  205. {
  206. reg.h.ah = 15;
  207. reg.h.al = 0;
  208. reg.h.bh = 0;
  209. reg.h.bl = 0;
  210. int86(0x10,®,®);
  211. mode = reg.h.al;
  212. page = reg.h.bh;
  213. collums = reg.h.ah;
  214. #ifdef DEBUG
  215. printf("%d  active page  %d   mode    %d collums",page,mode,collums);
  216. getche();
  217. #endif DEBUG
  218. }
  219.        
  220. void CLRSCRN()
  221. {
  222. #ifdef CLONE
  223. reg.h.ah = 6;
  224. reg.h.al = 25;
  225. reg.h.bh = 7;
  226. reg.h.ch = 0;
  227. reg.h.cl = 0;
  228. reg.h.dl = 79;
  229. reg.h.dh = 25;
  230. int86(0x10,®,®);
  231. #endif CLONE
  232.  
  233. #ifdef RAINBOW
  234. cprintf("\033[2J");
  235. #endif RAINBOW
  236.  
  237. GOTOXY(0,0);
  238. }
  239.  
  240. #ifdef  CLONE
  241.  
  242. void scrolup(x)
  243. int x;
  244. {
  245.         reg.h.ah = 6;
  246.         reg.h.al = x;
  247.         reg.h.bh = 7;
  248.         reg.h.ch = 6;
  249.         reg.h.cl = 0;
  250.         reg.h.dl = 79;
  251.         reg.h.dh = 20;
  252.         int86(0x10,®,®);
  253.         GOTOXY(00,19);
  254. }
  255.  #endif CLONE
  256.  
  257. #ifdef CLONE
  258.      
  259. void scroldwn(x)
  260. int x;
  261. {
  262. GOTOXY(30,22);
  263. reg.h.ah = 7;
  264. reg.h.al = x;
  265. reg.h.bh = 7;
  266. reg.h.ch = 22;
  267. reg.h.cl = 30;
  268. reg.h.dl = 60;
  269. reg.h.dh = 25;
  270. int86(0x10,®,®);
  271. }
  272. #endif CLONE
  273.  
  274.  
  275.  
  276. char  *getpath(filnm)
  277. char  filnm [60];
  278. {
  279. char  *dirr;
  280. char  *ptr;
  281. int    lnlgth;
  282. int    indx;
  283. lnlgth = strlen(filnm);
  284. while ((filnm[lnlgth] != COLON) && (filnm[lnlgth] != SLASH) && (filnm[lnlgth] != BCKSLSH))
  285. lnlgth--;
  286. if (coreleft())
  287. dirr = malloc (61);
  288. ptr = dirr;
  289. for(indx = 0; indx <=lnlgth; indx++)
  290. {
  291. *ptr = filnm[indx];
  292. ptr++;
  293. }
  294. if(filnm [indx-1] == COLON)
  295. {
  296. *ptr = SLASH;
  297. ptr++;
  298. }
  299. *ptr = 0;
  300. return(dirr);
  301. }         
  302.  
  303.  
  304.         
  305.         
  306.         
  307.  
  308.  
  309.         
  310. void dumpdic()
  311.      {
  312.  
  313.       char buf;
  314.       int totdic = 0;
  315.       register int index = 0;        
  316.  
  317. #ifdef RAINBOW
  318.       GOTOXY(00,19);
  319. #endif RAINBOW
  320.  
  321.       while (index < THREELN)
  322.       {
  323.       totdic++;
  324. #ifdef CLONE  
  325.       scrolup (1);
  326.       cprintf ("%d     %s   %d  ",index,threedct [index],totdic );
  327. #endif CLONE
  328.  
  329. #ifdef RAINBOW
  330.       cprintf ("%d     %s   %d  \n\r",index,threedct [index],totdic);
  331. #endif RAINBOW
  332.  
  333.       index++;
  334.       }
  335.     
  336.       index = 0;
  337.     
  338.       while (index < FOURLN)
  339.       {
  340.       totdic++;
  341. #ifdef CLONE  
  342.       scrolup (1);
  343.       cprintf ("%d     %s   %d   ",index,fourdct [index], totdic);
  344. #endif CLONE
  345.  
  346. #ifdef RAINBOW
  347.       cprintf ("%d     %s   %d  \n\r ",index,fourdct [index], totdic);
  348. #endif RAINBOW
  349.  
  350.       index++;
  351.       }
  352.  
  353.       index = 0;
  354.  
  355.       while (index < FIVELN)
  356.       {
  357.       totdic++;
  358.  
  359. #ifdef CLONE
  360.       scrolup (1);
  361.       cprintf ("%d     %s   %d ",index,fivedct [index],totdic ); 
  362. #endif CLONE
  363.  
  364. #ifdef RAINBOW
  365.       cprintf ("%d     %s   %d \n\r",index,fivedct [index],totdic ); 
  366. #endif
  367.  
  368.      index++;
  369.       }
  370.       index = 0;
  371.  
  372.       while (index < SIXLN)
  373.       {
  374.       totdic++;
  375. #ifdef CLONE
  376.       scrolup (1);
  377.       cprintf ("%d     %s  %d ",index,sixdct [index],totdic ); 
  378. #endif CLONE
  379.  
  380. #ifdef RAINBOW
  381.       cprintf ("%d     %s  %d \n\r",index,sixdct [index],totdic ); 
  382. #endif RAINBOW
  383.  
  384.       index++;
  385.       }
  386.  
  387.       index = 0;
  388.       while (index < SEVNLN)
  389.          
  390.       {         
  391.       totdic++;
  392. #ifdef CLONE
  393.       scrolup (1);
  394.       cprintf ("%d     %s  %d ",index,sevndct [index],totdic ); 
  395. #endif CLONE
  396.  
  397. #ifdef RAINBOW
  398.       cprintf ("%d     %s  %d \n\r",index,sevndct [index],totdic ); 
  399. #endif RAINBOW
  400.  
  401.       index++;
  402.       }
  403.         index = 0;
  404.       while (index < EIGHTLN)
  405.          
  406.       {         
  407.       totdic++;
  408. #ifdef CLONE
  409.       scrolup (1);
  410.       cprintf ("%d     %s  %d ",index,eightdct [index],totdic ); 
  411. #endif CLONE
  412.  
  413. #ifdef RAINBOW
  414.         cprintf ("%d     %s  %d \n\r",index,eightdct [index],totdic ); 
  415. #endif RAINBOW
  416.  
  417.      index++;
  418.       }
  419.  
  420.  
  421.  
  422.  
  423.  
  424.         index = 0;
  425.         
  426.       while (index < NINELN)
  427.          
  428.       {         
  429.       totdic++;
  430. #ifdef CLONE
  431.       scrolup (1);
  432.       cprintf ("%d     %s  %d ",index,ninedct [index],totdic );
  433. #endif CLONE
  434. #ifdef RAINBOW
  435.       cprintf ("%d     %s  %d \n\r",index,ninedct [index],totdic ); 
  436. #endif RAINBOW
  437.  
  438.       index++;
  439.       }
  440.       index = 0;
  441.           
  442.       while (index < TENLN)
  443.          
  444.       {         
  445.       totdic++;
  446. #ifdef CLONE
  447.       scrolup (1);
  448.       cprintf ("%d     %s  %d ",index,tendct [index],totdic );
  449. #endif CLONE
  450. #ifdef RAINBOW
  451.       cprintf ("%d     %s  %d \n\r",index,tendct [index],totdic ); 
  452. #endif RAINBOW
  453.       index++;
  454.       }
  455.       index = 0;
  456.           
  457.       while (index < ELEVENLN)
  458.          
  459.       {         
  460.       totdic++;
  461. #ifdef CLONE
  462.       scrolup (1);
  463.       cprintf ("%d     %s  %d ",index,elevendct [index],totdic );
  464. #endif CLONE
  465. #ifdef RAINBOW
  466.       cprintf ("%d     %s  %d \n\r",index,elevendct [index],totdic ); 
  467. #endif RAINBOW
  468.       index++;
  469.       }
  470.  
  471.       index = 0;
  472.           
  473.       while (index < TWELVELN)
  474.          
  475.       {         
  476.       totdic++;
  477.  
  478. #ifdef CLONE
  479.       scrolup (1);
  480.       cprintf ("%d     %s  %d ",index,twelvedct [index],totdic );
  481. #endif CLONE
  482. #ifdef RAINBOW
  483.       cprintf ("%d     %s  %d \n\r",index,twelvedct [index],totdic ); 
  484. #endif RAINBOW
  485.       index++;
  486.       }
  487.       index = 0;
  488.          
  489.       while (index < T3TENLN)
  490.          
  491.       {         
  492.       totdic++;
  493. #ifdef CLONE
  494.       scrolup (1);
  495.       cprintf ("%d     %s  %d ",index,t3tendct [index],totdic );
  496. #endif CLONE
  497. #ifdef RAINBOW
  498.       cprintf ("%d     %s  %d \n\r",index,t3tendct [index],totdic ); 
  499. #endif RAINBOW
  500.        index++;
  501.       }
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.       index = 0;
  513.  
  514.       while (index < FORTENLN)
  515.          
  516.       {         
  517.       totdic++;
  518.       
  519. #ifdef CLONE
  520.       scrolup (1);
  521.       cprintf ("%d     %s  %d ",index,fortendct [index],totdic );
  522. #endif CLONE
  523. #ifdef RAINBOW
  524.       cprintf ("%d     %s  %d \n\r",index,fortendct [index],totdic ); 
  525. #endif RAINBOW
  526.       index++;
  527.       }
  528.       index = 0;
  529.  
  530.       while (index < FIVTENLN)
  531.          
  532.       {         
  533.       totdic++;
  534. #ifdef CLONE
  535.       scrolup (1);
  536.       cprintf ("%d     %s  %d ",index,fivtendct [index],totdic );
  537. #endif CLONE
  538. #ifdef RAINBOW
  539.       cprintf ("%d     %s  %d \n\r",index,fivtendct [index],totdic ); 
  540. #endif RAINBOW
  541.       index++;
  542.       }
  543.  
  544.       index = 0;
  545.  
  546.       while (index < SIXTENLN)
  547.          
  548.       {         
  549.       totdic++;
  550. #ifdef CLONE
  551.       scrolup (1);
  552.       cprintf ("%d     %s  %d ",index,sixtendct [index],totdic );
  553. #endif CLONE
  554. #ifdef RAINBOW
  555.       cprintf ("%d     %s  %d \n\r",index,sixtendct [index],totdic ); 
  556. #endif RAINBOW
  557.       index++;
  558.       }
  559.       index = 0;
  560.  
  561.       while (index < SEVTENLN)
  562.          
  563.       {         
  564.       totdic++;
  565. #ifdef CLONE
  566.       scrolup (1);
  567.       cprintf ("%d     %s  %d ",index,sevtendct [index],totdic );
  568. #endif CLONE
  569. #ifdef RAINBOW
  570.       cprintf ("%d     %s  %d \n\r",index,sevtendct [index],totdic ); 
  571. #endif RAINBOW
  572.       index++;
  573.       }
  574.       index = 0;
  575.  
  576.       while (index < EITENLN)
  577.          
  578.       {         
  579.       totdic++;
  580.  
  581. #ifdef CLONE
  582.       scrolup (1);
  583.       cprintf ("%d     %s  %d ",index,eitendct [index],totdic );
  584. #endif CLONE
  585. #ifdef RAINBOW
  586.       cprintf ("%d     %s  %d \n\r",index,eitendct [index],totdic ); 
  587. #endif RAINBOW
  588.       index++;
  589.       }
  590. #ifdef CLONE
  591.       scrolup (1);
  592.       cprintf(" The  total  number  of  word  in  dictionary  =  %d  ",totdic);  
  593.       scrolup (1);
  594.       cprintf(" type any key to return to operating system ___\b\b");
  595. #endif CLONE
  596.  
  597. #ifdef RAINBOW
  598.  cprintf ("\n\r The  total  number  of  word  in  dictionary  =  %d \n\r ",totdic); 
  599.  cprintf ("\n\r type any key to return to operating system ___\b\b");
  600. #endif CLONE
  601.       getch ();
  602.       CLRSCRN();
  603.  
  604. #ifdef RAINBOW
  605.         cputs("\033[00;24r");
  606. #endif RAINBOW
  607.  
  608.       exit(0);
  609.       }
  610.  
  611.  
  612. char *header =
  613. "                         COPYRIGHT (C) by Peter A. Banks\n\r"
  614. "                                 SUPA-DUPA-SPELLA\n\r"
  615. "                                  C-Version  1.0";
  616.  
  617.  
  618.  
  619. char *help_screen  =  
  620. "  The CSPELLA  command line is\r\n\r\n"
  621. "  CSPELLA <FILENAME> <USERDIC> -V -D -N -M?\r\n\r\n"
  622. "  -V enable Video display of text\r\n"
  623. "  -D dumps all of the dictionaries to Video Screen\r\n"
  624. "  -M allows user to define mark character\r\n\r\n"
  625. "  -N WARNING DO NOT USE WITH SEDT OR PTP. LOSS OF DATA WILL RESULT\r\n"
  626. "  -N Is used for WORDSTAR Compatitibility Only.\r\n\r\n"              
  627. "  Switches can be place before or after the file names\r\n\r\n"
  628. "  Source Document must be listed before the optional Personal Dictionary\r\n\r\n" 
  629. "  Please hit any key to continue___\b\b";
  630.  
  631.  
  632.  
  633. #ifdef CLONE
  634.  
  635. char *srcdoc = 
  636. "   Enter document to be Spelled [Default Exit]\n\r"
  637. "   ________________________________________________________________________";
  638.  
  639.  
  640.  
  641. char *personaldctnam =
  642. "   Enter Personal dictionary [Default None]\n\r"
  643. "   ________________________________________________________________________"; 
  644.  
  645. #endif CLONE
  646.  
  647. #ifdef RAINBOW
  648.  
  649. char *srcdoc = 
  650. "  Enter document to be Spelled [Default Exit]\n\r"
  651. "  ________________________________________________________________________";
  652.  
  653.  
  654.  
  655. char *personaldctnam =
  656. "  Enter Personal dictionary [Default None]\n\r"
  657. "  ________________________________________________________________________"; 
  658.  
  659. #endif RAINBOW
  660.  
  661.  
  662.  
  663. char *set_enviroment = 
  664. "                 CSPELLA   is   not   defined   in   AUTOEXEC.BAT.\n\r\n\r"
  665. "                    Place  the  following   in   Autoexec.bat.\n\r\n\r"
  666. "                        Set CSPELLA=DRV:\\CSPELLA PATH \n\r\n\r\n\r"
  667. "                 The directory that Cspella is in should also be\n\r"
  668. "                 placed in MSDOS PATH statement the Autoexec.bat.\n\r\n\r"
  669. "                           PATH=DRV:\\CSPELLA PATH\\;\n\r\n\r\n\r"
  670. "                           Hit any key to continue___\b\b";
  671.  
  672.  
  673. char ootbuff [12288];
  674. char inbuff [12288];
  675.  
  676.  
  677. void setfyl(argc,argv)
  678.         int argc;
  679.         char **argv;
  680.         {
  681.     int newdir;   
  682.     int  ind,xx;
  683.     char buf,pd,src;
  684.     char bufa;
  685.     newdir = 0;
  686.     pd = 0;
  687.     src = 0;
  688.     dctenv = getenv("CSPELLA");
  689.     CLRSCRN();
  690.     cputs(header); 
  691.  
  692.     if (dctenv==NULL)
  693.     {
  694.     GOTOXY(00,06);
  695.     cputs(set_enviroment);
  696.     getch();
  697.     CLRSCRN();
  698.     cputs(header); 
  699.     }
  700.     if (argc == 1)
  701.     {
  702.     GOTOXY(00,05);
  703.     cputs(help_screen);
  704.     getch();
  705.     CLRSCRN();
  706.     cputs(header); 
  707.     }
  708.     else 
  709.     {
  710.     ind =1;
  711.     while (ind < argc)
  712.     {
  713.     if (argv[ind][0] == '-')
  714.     {
  715.     switch (argv[ind][1])
  716.     {
  717.     case 'N': 
  718.                 marker = WORDSTAR;
  719.                 break;
  720.     case 'M': 
  721.                 marker = argv[ind][2];
  722.                 break;
  723.     case 'D': 
  724.                 dumpdic();
  725.                 break;
  726.     case 'V': 
  727.                 video = 121;
  728.                 break;
  729.     }  /* end case */
  730.     }
  731.     else
  732.     if (!src) 
  733.     {
  734.     strcpy(fylnam,argv[ind]);
  735.     src = 255;
  736.     }
  737.     else
  738.     if (src)
  739.     {
  740.     pd = 131;
  741.     strcpy(perdctnam,argv[ind]);
  742.     }
  743.     ind++;
  744.     } /* end while */
  745.     GOTOXY(00,07);
  746.     puts(srcdoc);
  747.     GOTOXY(3,8);
  748.  
  749.     if (src)
  750.        {
  751.        cputs(fylnam);
  752.  
  753.        if ((source = fopen(fylnam,"rt")) == NULL)
  754.            {
  755.            GOTOXY(3,9);
  756.            perror("Could  not open FILE try again");
  757.            GOTOXY(3,8);
  758.            }
  759.          }
  760.     } /* END ELSE */
  761.  
  762.        if ((source == NULL) || (argc == 1)) 
  763.              while (source== NULL)
  764.             {
  765.             GOTOXY(00,07);
  766.             cputs(srcdoc);
  767.             GOTOXY(3,8);
  768.             gets(fylnam);
  769.             ind = strlen(fylnam);
  770.             if (ind == 0)            
  771.                     {
  772.                     CLRSCRN();
  773.                     GOTOXY(0,0);
  774.                     cputs("exiting to operating system");
  775.  
  776. #ifdef RAINBOW
  777.         cputs("\033[00;24r");
  778. #endif RAINBOW
  779.  
  780.                     exit(0);
  781.                     }
  782.  
  783.  
  784.        if ((source = fopen(fylnam,"rt")) == NULL)
  785.            {
  786.            GOTOXY(3,9);
  787.            perror("Could  not open FILE try again");
  788.            GOTOXY(3,8);
  789.            }
  790.            }
  791.    if ((strchr(fylnam,COLON)) || (strchr(fylnam,SLASH)) || (strchr(fylnam,BCKSLSH)))
  792.    {  /* finds the directory is in and save it in srcdir */ 
  793.    srcdir=getpath(fylnam);
  794.    tmpfyl = strcat(srcdir,"$$$$.TMP");
  795.     }
  796.     else
  797.     tmpfyl = "$$$$.TMP";        
  798.         
  799.       if ((output = fopen(tmpfyl,"wt")) == NULL)
  800.       { /* open file for spelled document to go into */
  801.       GOTOXY(3,9);
  802.       perror("Could  not open temp FILE try again");
  803.       ClRSCRN();
  804.  
  805. #ifdef RAINBOW
  806.         cputs("\033[00;24r");
  807. #endif RAINBOW
  808.  
  809.       exit(0);
  810.       }
  811.       setvbuf(output,ootbuff,_IOFBF,12288);        
  812.       setvbuf(source,inbuff,_IOFBF,12288);        
  813.    
  814.  
  815.   
  816.      /* code for Personal Dictionary needed next */
  817.     GOTOXY(00,10);
  818.     puts(personaldctnam);
  819.     GOTOXY(3,11);
  820.         
  821.     if  (pd)
  822.     {
  823.     cputs(perdctnam);
  824.     if ((perdct = fopen(perdctnam,"rt")) == NULL)
  825.     if (dctenv == NULL)
  826.                     {
  827.                      GOTOXY(3,13);
  828.                      perror("file error try again ");
  829.                      GOTOXY(3,11);
  830.                     }
  831.     else
  832.     {
  833.     strcpy(perdctnam,(strcat(dctenv,perdctnam)));
  834.     if ((perdct = fopen(perdctnam,"rt")) == NULL)
  835.     {
  836.     GOTOXY(3,13);
  837.     perror("Could  not open FILE try again");
  838.     GOTOXY(3,11);
  839.     }
  840.     }
  841.     }
  842.  
  843.     else    
  844.     newdir = 3;
  845.     ind = 12;
  846.     if (perdct == NULL)  
  847.             while ((perdct== NULL) && (ind))
  848.             {
  849.             GOTOXY(00,10);
  850.             puts(personaldctnam);
  851.             GOTOXY(3,11);
  852.             gets(perdctnam);
  853.             ind = strlen(perdctnam);
  854.             if((ind) && ((perdct = fopen(perdctnam,"rt")) == NULL))
  855.                 {
  856.                     if (dctenv == NULL)
  857.                     {
  858.                      GOTOXY(3,13);
  859.                      perror("file error try again ");
  860.                      GOTOXY(3,11);
  861.                     }
  862.                     else
  863.                     {
  864.                      strcpy(perdctnam,(strcat(dctenv,perdctnam)));
  865.                      if ((perdct = fopen(perdctnam,"rt")) == NULL)
  866.                         {
  867.                           GOTOXY(3,13);
  868.                           perror("Could  not open FILE try again");
  869.                           GOTOXY(3,11);
  870.                         }
  871.                     }
  872.                 }
  873.               else
  874.              newdir = 3;
  875.              }
  876.         
  877.     if ((newdir)
  878.          &&    
  879.     ((strchr(perdctnam,COLON))
  880.          || 
  881.     (strchr(perdctnam,SLASH))
  882.          || 
  883.     (strchr(perdctnam,BCKSLSH))))
  884.   /*finds the directory is in and save it in dctenv */ 
  885.     dctenv=getpath(perdctnam);
  886.  
  887.     if (perdct)
  888.     {
  889.     strcpy(personaldct[0],"@@@@@@@@@@@@@@@@");
  890.     ind =1;
  891.  
  892.     while ((!feof(perdct)) && (ind <= 1498))
  893.     {
  894.     fgets(personaldct [ind],20,perdct);
  895.     xx=strlen(personaldct[ind]);
  896.     xx--;
  897.     personaldct[ind][xx]=0;
  898.     ind++;
  899.     }
  900.  
  901.     ind--;
  902.  
  903.     strcpy(personaldct[ind],"[[[[[[[[[[[[[[[[");
  904.  
  905.         persize = ind;
  906.         fclose(perdct); 
  907.         ind =0;
  908.  
  909.    }  
  910.    else persize= 0;
  911.   }
  912.         
  913. int   serperdct (key)
  914.       char *key;
  915.         {
  916.         int high,low,mid,result;
  917.         high =persize;
  918.         low = 0;
  919.         while (low < (high-1))
  920.         {      
  921.         mid = (low+high)/2;
  922.         if ((low+high)%2 == 1) mid++;
  923.         result = strcmp(key,personaldct[mid]);
  924.  
  925. #ifdef DEBUG
  926.         scrolup (1);
  927.         cprintf("%s   key   %s   personal dct %d ",key,personaldct[mid],result);
  928.         getch();
  929. #endif DEBUG
  930.  
  931.         if (result == 0) return (9999);
  932.         else
  933.         if (result < 0) high = mid;
  934.         else
  935.         low = mid;
  936.         }
  937.         return (0);
  938.         }
  939.    
  940.         
  941.         
  942. int     wordsearch(key,lngth)
  943.         
  944.         char  *key;
  945.         int   lngth;
  946.         {
  947.         int location;
  948.         char *wrd;
  949.         wrd = 0;
  950.         switch(lngth)
  951.         {
  952.         case 5:
  953.         wrd = bsearch (key,fivedct,FIVELN,6,strcmp);
  954.         break;
  955.         case 4:
  956.         wrd = bsearch (key,fourdct,FOURLN,5,strcmp);
  957.         break;
  958.         case 3:
  959.         wrd =bsearch (key,threedct,THREELN,4,strcmp);
  960.         break;
  961.         case 6:
  962.         wrd = bsearch (key,sixdct,SIXLN,7,strcmp);
  963.         break;
  964.         case 7:
  965.         wrd = bsearch (key,sevndct,SEVNLN,8,strcmp);
  966.         break;
  967.         case 8:
  968.         wrd = bsearch (key,eightdct,EIGHTLN,9,strcmp);
  969.         break;
  970.         case 9:
  971.         wrd = bsearch (key,ninedct,NINELN,10,strcmp);
  972.         break;
  973.         case 10:
  974.         wrd = bsearch (key,tendct,TENLN,11,strcmp);
  975.         break;
  976.         case 11:
  977.         wrd = bsearch (key,elevendct,ELEVENLN,12,strcmp);
  978.         break;
  979.         case 12:
  980.         wrd = bsearch (key,twelvedct,TWELVELN,13,strcmp);
  981.         break;
  982.         case 13:
  983.         wrd = bsearch (key,t3tendct,T3TENLN,14,strcmp);
  984.         break;
  985.         case 14:
  986.         wrd = bsearch (key,fortendct,FORTENLN,15,strcmp);
  987.         break;
  988.         case 15:
  989.         wrd = bsearch (key,fivtendct,FIVTENLN,16,strcmp);
  990.         break;
  991.         case 16:
  992.         wrd = bsearch (key,sixtendct,SIXTENLN,17,strcmp);
  993.         break;
  994.         case 17:
  995.         wrd = bsearch (key,sevtendct,SEVTENLN,18,strcmp);
  996.         break;
  997.         case 18:
  998.         wrd = bsearch (key,eitendct,EITENLN,19,strcmp);
  999.         }
  1000.         if (!wrd)
  1001.         return (0);
  1002.         else
  1003.         return (127);
  1004.         }
  1005.  
  1006.  
  1007.  
  1008.  
  1009. int    stripsufix(lngth)
  1010.        int      lngth;
  1011.        {
  1012.        int wrd; 
  1013.        char     tex [21];
  1014.        int lstch;  /* last chariter in string */
  1015.        strcpy(tex,srchtex);
  1016.        lstch = lngth;
  1017.        wrd =0;
  1018.        switch(tex [(--lstch)])
  1019.         {
  1020.       case 'S':
  1021.                 tex[lstch]= 0;
  1022.                 wrd = wordsearch(tex,lstch);
  1023.  
  1024. #ifdef DEBUG
  1025.                 scrolup (1);
  1026.                 printf("%s %s strip plural s",tex,srchtex); 
  1027.                 getch ();
  1028. #endif DEBUG
  1029.  
  1030.                 if (wrd) return(wrd);
  1031.                 lstch--;
  1032.  
  1033.                 if ((tex[lstch]=='E') && (lngth >=5)) /* strip es*/
  1034.                 {
  1035.                 tex[lstch]= 0;
  1036.                 wrd = wordsearch(tex,lstch);
  1037.  
  1038. #ifdef DEBUG
  1039.  
  1040.                 scrolup (1);
  1041.                 cprintf("%s %s strip es ",tex,srchtex); 
  1042.                 getch ();
  1043.  
  1044.  #endif DEBUG
  1045.                 if (wrd) return(wrd);
  1046.                 if ((tex[--lstch]=='I') && (lngth >=5))  /* strip ies*/
  1047.                 {
  1048.                 tex[lstch++]= 'Y';
  1049.                 tex[lstch]=0;
  1050.                 wrd = wordsearch(tex,lstch);
  1051.  
  1052.  
  1053. #ifdef DEBUG
  1054.                          
  1055.                 scrolup (1);
  1056.                 cprintf("%s   %s str i add y ",tex,srchtex);  
  1057.                 getch ();
  1058.  
  1059. #endif DEBUG
  1060.                 if (wrd) return(wrd);
  1061.                }
  1062.                }
  1063.           else
  1064.  
  1065.            if ((tex[lstch]=='R') && (lngth >=5))
  1066.                {
  1067.                 /*       strip rs   */
  1068.                tex[lstch]= 0;
  1069.                wrd = wordsearch(tex,lstch);
  1070.                if (wrd) return(wrd);
  1071.                lstch--;
  1072.                if ((tex[lstch]=='E') && (lngth >=6))  /* strip ers*/
  1073.                {
  1074.                tex[lstch]= 0;
  1075.                wrd = wordsearch(tex,lstch);
  1076.  
  1077. #ifdef DEBUG
  1078.                 scrolup (1);
  1079.                 cprintf("%s %s strip ers",tex,srchtex);   
  1080.                 getch ();
  1081.  
  1082. #endif DEBUG
  1083.                 if (wrd) return(wrd);
  1084.                 if ((tex[--lstch]=='I') && (lngth >=6))  /* strip iers*/
  1085.                 {
  1086.                 tex[lstch++]= 'Y';
  1087.                 tex[lstch]=0;
  1088.                 wrd = wordsearch(tex,lstch);
  1089.  
  1090.  #ifdef DEBUG
  1091.  
  1092.                 scrolup (1);
  1093.                 cprintf("%s %s strip I add  Y ",tex,srchtex);    
  1094.                 getch();
  1095.  
  1096. #endif DEBUG
  1097.                 return(wrd);
  1098.                 }
  1099.                 }
  1100.                 }
  1101.  else
  1102.  
  1103.              if ((tex[lstch] == 'G')
  1104.                 &&
  1105.                (tex[--lstch] == 'N') 
  1106.                 && 
  1107.                 (tex[--lstch] == 'I') 
  1108.                 &&
  1109.                 (lngth >=7))  /* ings   */
  1110.                 {  
  1111.                 tex[lstch]=0;
  1112.                 wrd = wordsearch(tex,lstch);
  1113.  
  1114. #ifdef DEBUG
  1115.   
  1116.                 scrolup (1);
  1117.                 cprintf("%s %s  removing ings  ",tex,srchtex); 
  1118.                 getch ();
  1119.  
  1120. #endif DEBUG
  1121.  
  1122.                 if (wrd) return(wrd);
  1123.                 tex[lstch]='E';
  1124.                 lstch++;
  1125.                 tex[lstch]=0;
  1126.                 wrd = wordsearch(tex,lstch);
  1127. #ifdef DEBUG
  1128.  
  1129.                 scrolup (1);
  1130.                 cprintf("%s %s  add E ",tex,srchtex);
  1131.                 getch ();
  1132.  
  1133. #endif DEBUG
  1134.                 return(wrd);
  1135.                 }
  1136.           else
  1137.  
  1138.             if ((tex[lstch] == 39) && (lngth >=5)) /* strip 's  */
  1139.                 {
  1140.                 tex[lstch]= 0;
  1141.                 wrd = wordsearch(tex,lstch);
  1142.  
  1143. #ifdef DEBUG
  1144.  
  1145.                 scrolup (1);
  1146.                 cprintf("%s %s ",tex,srchtex); 
  1147.                 getch(); 
  1148.  
  1149. #endif DEBUG
  1150.  
  1151.                return(wrd);
  1152.                 }
  1153.   
  1154.           else
  1155.  
  1156.             if  ((tex[lstch] == 'S')
  1157.                 &&
  1158.                 (tex[(--lstch)] == 'E') 
  1159.                 && 
  1160.                 (tex[(--lstch)] == 'N') 
  1161.                 &&
  1162.                 (lngth >=7))  /* ness   */
  1163.                 {  
  1164.                 tex[lstch]=0;
  1165.                 wrd = wordsearch(tex,lstch);
  1166.  
  1167. #ifdef DEBUG    
  1168.                 scrolup (1);
  1169.                 cprintf("%s %s  ness ",tex,srchtex);
  1170.                 
  1171.                 getch (); 
  1172.  
  1173. #endif DEBUG
  1174.                 if (wrd) return(wrd);
  1175.                 lstch--;
  1176.                 if (tex[lstch] == 'I')
  1177.                 {
  1178.                 tex[lstch]='Y';           /* business  to busy */
  1179.                 tex[++lstch]=0;
  1180.                 wrd = wordsearch(tex,lstch);
  1181.  
  1182. #ifdef DEBUG
  1183.                 scrolup (1);
  1184.                 cprintf("%s %s ",tex,srchtex);
  1185.       
  1186.                 getch ();   
  1187. #endif DEBUG
  1188.                 }
  1189.                 }
  1190.    
  1191.                 else
  1192.  
  1193.        if ((tex[lstch]   == 'N') &&
  1194.            (tex[--lstch] == 'O') && 
  1195.            (tex[--lstch] == 'I') && 
  1196.            (letcnt > 6))
  1197.           {
  1198.           tex[lstch]=0;
  1199.           wrd = wordsearch(tex,lstch);
  1200.  
  1201. #ifdef DEBUG
  1202.  
  1203.           scrolup(1);
  1204.           cprintf("%s %s ",tex,srchtex);  
  1205.           getch();
  1206.  
  1207. #endif DEBUG
  1208.  
  1209.           if (wrd) return(wrd);
  1210.           
  1211.           tex[lstch++]='E';
  1212.           tex[lstch]=0;
  1213.           wrd = wordsearch(tex,lstch);
  1214.  
  1215. #ifdef DEBUG
  1216.  
  1217.           scrolup(1);
  1218.           cprintf("%s %s ",tex,srchtex);  
  1219.           getch();
  1220.  
  1221. #endif DEBUG
  1222.       
  1223.           if (wrd) return(wrd);
  1224.           lstch--;             
  1225.  
  1226.           if (( tex[--lstch] == 'T')  && ( letcnt > 6 ))
  1227.           {
  1228.           tex[lstch] = 0;
  1229.           wrd = wordsearch(tex,lstch);
  1230.           if (wrd) return (wrd);
  1231.  
  1232.  
  1233.           if (( tex[--lstch] == 'A')  &&  ( tex[--lstch] == 'C')
  1234.               && ( tex[--lstch] == 'I') && ( letcnt > 9 ))
  1235.           {
  1236.           tex[lstch] = 0;
  1237.           wrd = wordsearch(tex,lstch);
  1238.           if (wrd) return (wrd);
  1239.  
  1240. #ifdef DEBUG
  1241.  
  1242.           scrolup(1);
  1243.           cprintf("%s %s ",tex,srchtex);  
  1244.           getch();
  1245.  
  1246. #endif DEBUG
  1247.  
  1248.           tex[lstch] = 'Y';
  1249.           tex[++lstch] = 0;
  1250.  
  1251.           wrd = wordsearch(tex,lstch);
  1252.  
  1253. #ifdef DEBUG
  1254.  
  1255.           scrolup(1);
  1256.           cprintf("%s %s ",tex,srchtex);  
  1257.           getch();
  1258.  
  1259. #endif DEBUG
  1260.  
  1261.           return(wrd);
  1262.           }
  1263.           }
  1264.           }
  1265.           
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.                
  1272.          /* END OF S CASE  */
  1273.  
  1274.         case 'D':
  1275.                 tex[lstch]= 0;
  1276.                 wrd = wordsearch(tex,lstch);
  1277.  
  1278. #ifdef DEBUG
  1279.                 cprintf("%s %s remove d",tex,srchtex); 
  1280.       scrolup (1);
  1281.  
  1282.                 getch ();
  1283. #endif DEBUG
  1284.  
  1285.                if (wrd) return(wrd);
  1286.                 lstch--;
  1287.                 if ((tex[lstch]=='E')  && (lngth >=5)) 
  1288.                 {
  1289.                 tex[lstch]= 0;
  1290.                 wrd = wordsearch(tex,lstch);
  1291.  
  1292. #ifdef DEBUG
  1293.                 cprintf("%s %s ",tex,srchtex); 
  1294.                 scrolup (1);
  1295.  
  1296.                 getch ();
  1297. #endif DEBUG
  1298.                 if (wrd) return(wrd);
  1299.                 lstch--;
  1300.                 if ((tex[lstch]=='I') && (lngth >=5))  /* strip ies*/
  1301.                 {
  1302.                 tex[lstch]= 'Y';
  1303.                 tex[++lstch]=0;
  1304.                 wrd = wordsearch(tex,lstch);
  1305.  
  1306. #ifdef DEBUG
  1307.  
  1308.                 cprintf("%s %s ",tex,srchtex); 
  1309.       scrolup (1);
  1310.  
  1311.                 getch ();
  1312.  
  1313. #endif DEBUG
  1314.                 }
  1315.                 }
  1316.                 return(wrd);
  1317.                               
  1318.    
  1319.         case 'R':
  1320.                 tex[lstch]= 0;
  1321.                 wrd = wordsearch(tex,lstch);
  1322.  
  1323. #ifdef DEBUG
  1324.  
  1325.                 cprintf("%s %s remove R",tex,srchtex); 
  1326.       scrolup (1);
  1327.  
  1328.                 getch();
  1329.  
  1330. #endif DEBUG
  1331.  
  1332.                 if (wrd) return(wrd);
  1333.                 if ((tex[--lstch]=='E') && (lngth >=5)) 
  1334.                 {
  1335.                 tex[lstch]= 0;
  1336.                 wrd = wordsearch(tex,lstch);
  1337.   
  1338. #ifdef DEBUG
  1339.  
  1340.                 cprintf("%s %s remover er",tex,srchtex);  
  1341.       scrolup (1);
  1342.  
  1343.                 getch();
  1344. #endif DEBUG
  1345.  
  1346.               if (wrd) return(wrd);
  1347.  
  1348.                 if ((tex[--lstch]=='I')  && (lngth >=5))  /* strip ies*/
  1349.                 {
  1350.                 tex[lstch]= 'Y';
  1351.                 tex[++lstch]=0;
  1352.                 wrd = wordsearch(tex,lstch);
  1353. #ifdef DEBUG
  1354.  
  1355.                 cprintf("%s %s ",tex,srchtex); 
  1356.       scrolup (1);
  1357.  
  1358.                 getch ();
  1359. #endif DEBUG
  1360.  
  1361.                 }
  1362.                 }
  1363.                 return(wrd);
  1364.  
  1365.  
  1366.         case 'G':
  1367.                 if ((tex[--lstch]== 'N') && (tex[--lstch] == 'I') 
  1368.                 &&
  1369.                 (lngth >=5))  /* ing   */
  1370.                 {  
  1371.                 tex[lstch]=0;
  1372.                 wrd = wordsearch(tex,lstch);
  1373. #ifdef DEBUG
  1374.   
  1375.                 scrolup(1);
  1376.                 cprintf("%s %s removing ing ",tex,srchtex);  
  1377.                 getch ();
  1378.  
  1379. #endif DEBUG
  1380.                 if (wrd) return(wrd);
  1381.                 tex[lstch]='E';
  1382.                 lstch++;
  1383.                 tex[lstch]=0;
  1384.                 wrd = wordsearch(tex,lstch);
  1385. #ifdef DEBUG
  1386.  
  1387.                 scrolup(1);
  1388.                 cprintf("%s %s add e",tex,srchtex);
  1389.                 getch ();
  1390. #endif DEBUG
  1391.                 }
  1392.                 return(wrd);
  1393.  
  1394.  
  1395.  
  1396. case 'Y':
  1397.                 if ((tex[--lstch]== 'L') &&
  1398.                 (lngth >=5))  /* ly   */
  1399.                 {
  1400.                 tex[lstch]=0;
  1401.                 wrd = wordsearch(tex,lstch);
  1402.  
  1403. #ifdef DEBUG
  1404.                 scrolup(1);
  1405.                 cprintf("%s %s ",tex,srchtex);  
  1406.                 getch();
  1407. #endif DEBUG
  1408.                 if (wrd) return(wrd);
  1409.                 }
  1410.             else
  1411.                 if ((tex[lstch]== 'C') &&
  1412.                 (lngth >=5))  /* cy   */
  1413.                 {  
  1414.                 tex[lstch]='T';
  1415.                 lstch++;
  1416.                 tex[lstch] = 0;
  1417.                 wrd = wordsearch(tex,lstch);
  1418. #ifdef DEBUG
  1419.  
  1420.                 scrolup(1);
  1421.                 cprintf("%s %s ",tex,srchtex);   
  1422.                 getch();
  1423. #endif DEBUG
  1424.                 }
  1425.                 return(wrd);
  1426.  
  1427.                 
  1428. case 'T':
  1429.          if ((tex[--lstch] == 'S') && (letcnt > 4))
  1430.           {
  1431.           tex[lstch]=0;
  1432.           wrd = wordsearch(tex,lstch);
  1433.           if (wrd) return(wrd);
  1434.           {
  1435.           if((tex[--lstch] == 'E') && (letcnt >= 6))
  1436.           {
  1437.           tex[lstch]=0;
  1438.           wrd = wordsearch(tex,lstch);
  1439.  
  1440. #ifdef DEBUG
  1441.           scrolup(1);
  1442.           cprintf("%s %s ",tex,srchtex);  
  1443.           getch();
  1444. #endif DEBUG
  1445.  
  1446.  
  1447.           if (wrd) return(wrd);
  1448.           if ((tex[--lstch] == 'I') && (letcnt > 7))
  1449.           {
  1450.           tex[lstch] = 'Y';
  1451.           tex[++lstch] = 0;
  1452.           wrd = wordsearch(tex,lstch);
  1453.  
  1454.  
  1455. #ifdef DEBUG
  1456.           scrolup(1);
  1457.           cprintf("%s %s ",tex,srchtex);  
  1458.           getch();
  1459. #endif DEBUG
  1460.  
  1461.         return(wrd);
  1462.           }
  1463.           }   
  1464.           }
  1465.           }
  1466.           else
  1467.  
  1468. #ifdef DEBUG
  1469.  
  1470.           scrolup(1);
  1471.           cprintf("%s        %c",tex,srchtex[lstch]);  
  1472.           getch();
  1473.  
  1474. #endif DEBUG
  1475.  
  1476.           if ((tex[lstch] == 'N') 
  1477.           &&
  1478.           (tex[--lstch] == 'E')
  1479.            &&
  1480.           (tex[--lstch] == 'M'))  /* remove ment */
  1481.           {
  1482.           tex[lstch]=0;
  1483.           wrd = wordsearch(tex,lstch);
  1484.  
  1485. #ifdef DEBUG
  1486.   
  1487.           scrolup(1);
  1488.           cprintf("%s %s ",tex,srchtex);  
  1489.           getch();
  1490.  
  1491. #endif DEBUG
  1492.  
  1493.           if (wrd) return(wrd);
  1494.           if ((tex[--lstch] == 'I') && (letcnt > 7))
  1495.           {
  1496.           tex[lstch] = 'Y';
  1497.           tex[++lstch] = 0;
  1498.           wrd = wordsearch(tex,lstch);
  1499. #ifdef DEBUG
  1500.  
  1501.           scrolup(1);
  1502.           cprintf("%s %s ",tex,srchtex);  
  1503.           getch();
  1504.  
  1505. #endif DEBUG
  1506.  
  1507.           }
  1508.           }
  1509.           return(wrd);
  1510.  
  1511.              
  1512.  
  1513. case 'H':
  1514.          if ((tex[(--lstch)] == 'T') || (tex[lstch] == 'S')) 
  1515.           {
  1516.           tex[lstch]=0;
  1517.           wrd = wordsearch(tex,lstch);
  1518.  
  1519. #ifdef DEBUG
  1520.           scrolup(1);
  1521.           cprintf("%s %s ",tex,srchtex);  
  1522.           getch();
  1523. #endif DEBUG
  1524.  
  1525.           if (wrd) return(wrd);
  1526.           if ((tex[(--lstch)] == 'I') && (letcnt > 5))
  1527.           {
  1528.           tex[lstch] = 'Y';
  1529.           tex[++lstch] = 0;
  1530.           wrd = wordsearch(tex,lstch);
  1531.  
  1532. #ifdef DEBUG
  1533.  
  1534.           scrolup(1);
  1535.           cprintf("%s %s ",tex,srchtex);  
  1536.           getch();
  1537.  
  1538. #endif DEBUG
  1539.  
  1540.           }   
  1541.           }
  1542.           return (wrd);         
  1543.  
  1544.  
  1545.      case 'E':
  1546.           if ((tex[--lstch] == 'V') && (tex[--lstch] == 'I') && (letcnt > 5))
  1547.           {
  1548.           tex[lstch]=0;
  1549.           wrd = wordsearch(tex,lstch);
  1550.  
  1551. #ifdef DEBUG
  1552.  
  1553.           scrolup(1);
  1554.           cprintf("%s %s ",tex,srchtex);  
  1555.           getch();
  1556.  
  1557. #endif DEBUG
  1558.  
  1559.           if (wrd) return(wrd);
  1560.  
  1561.           tex[lstch]= 'E';
  1562.           tex[++lstch] = 0;
  1563.           wrd = wordsearch(tex,lstch);
  1564.  
  1565. #ifdef DEBUG
  1566.  
  1567.           scrolup(1);
  1568.           cprintf("%s %s ",tex,srchtex);  
  1569.           getch();
  1570.  
  1571. #endif DEBUG
  1572.  
  1573.           return(wrd);
  1574.           }
  1575.  
  1576.         case 'N':
  1577.  
  1578.           if ((tex[--lstch] == 'O') && (tex[--lstch] == 'I') && (letcnt > 5))
  1579.           {
  1580.           tex[lstch]=0;
  1581.           wrd = wordsearch(tex,lstch);
  1582.  
  1583. #ifdef DEBUG
  1584.  
  1585.           scrolup(1);
  1586.           cprintf("%s %s ",tex,srchtex);  
  1587.           getch();
  1588.  
  1589. #endif DEBUG
  1590.  
  1591.           if (wrd) return(wrd);
  1592.           
  1593.           tex[lstch++]='E';
  1594.           tex[lstch]=0;
  1595.           wrd = wordsearch(tex,lstch);
  1596.  
  1597. #ifdef DEBUG
  1598.  
  1599.           scrolup(1);
  1600.           cprintf("%s %s ",tex,srchtex);  
  1601.           getch();
  1602.  
  1603. #endif DEBUG
  1604.       
  1605.           if (wrd) return(wrd);
  1606.           lstch--;             
  1607.  
  1608.           if (( tex[--lstch] == 'T')  && ( letcnt > 6 ))
  1609.           {
  1610.           tex[lstch] = 0;
  1611.           wrd = wordsearch(tex,lstch);
  1612.           if (wrd) return (wrd);
  1613.  
  1614.  
  1615.           if (( tex[--lstch] == 'A')  &&  ( tex[--lstch] == 'C')
  1616.               && ( tex[--lstch] == 'I') && ( letcnt > 9 ))
  1617.           {
  1618.           tex[lstch] = 0;
  1619.           wrd = wordsearch(tex,lstch);
  1620.           if (wrd) return (wrd);
  1621.  
  1622. #ifdef DEBUG
  1623.  
  1624.           scrolup(1);
  1625.           cprintf("%s %s ",tex,srchtex);  
  1626.           getch();
  1627.  
  1628. #endif DEBUG
  1629.  
  1630.           tex[lstch] = 'Y';
  1631.           tex[++lstch] = 0;
  1632.  
  1633.           wrd = wordsearch(tex,lstch);
  1634.  
  1635. #ifdef DEBUG
  1636.  
  1637.           scrolup(1);
  1638.           cprintf("%s %s ",tex,srchtex);  
  1639.           getch();
  1640.  
  1641. #endif DEBUG
  1642.  
  1643.           return(wrd);
  1644.           }
  1645.           }
  1646.           }
  1647.  
  1648.  
  1649.           } /* end of switch statement */
  1650.           return(wrd);
  1651.           } /* end of procedure        */
  1652.  
  1653.  
  1654.  
  1655.  
  1656. struct  misspword 
  1657. {
  1658. char textword[MAXLINE];
  1659. char edtedword[MAXLINE];
  1660. char action;
  1661. struct misspword *grtrthan;
  1662. struct misspword *lessthan;
  1663. };
  1664. struct misspword rot; 
  1665. struct misspword *root; 
  1666. struct misspword *prrt; 
  1667.  
  1668. char found;
  1669. char wrytt;
  1670.  
  1671.  
  1672.  
  1673.  
  1674. void    wrtheep(prt)
  1675. struct misspword *prt; 
  1676.         {
  1677.  
  1678.         if (prt==NULL)
  1679.         {
  1680.         if (coreleft())
  1681.         root = malloc(sizeof(rot));
  1682.         prt= root; 
  1683.         strcpy(prt->textword,srchtex);
  1684.         prt->lessthan = NULL;
  1685.         prt->grtrthan = NULL;
  1686. #ifdef CLONE
  1687.         scroldwn(1);
  1688.         cprintf("%s",wordtex);
  1689.         if (video) GOTOXY(0,19);
  1690. #endif CLONE
  1691.  
  1692.  
  1693.  
  1694. #ifdef RAINBOW
  1695.         if (video)
  1696.         cprintf("\033[22;30f%s              \033[19;00f",wordtex);
  1697.         else
  1698.         cprintf("\033[22;30f%s             \r",wordtex);
  1699.  
  1700. #endif RAINBOW
  1701.  
  1702. #ifdef DEBUG
  1703.  
  1704.           scrolup(1);
  1705.           cprintf("root created NULL");  
  1706.           getch();
  1707.  
  1708. #endif DEBUG
  1709.  
  1710.           }
  1711.  
  1712.         else
  1713.  
  1714.         if (0 == stricmp(prt->textword,srchtex))
  1715.         found = 'F';
  1716.  
  1717.         else 
  1718.  
  1719.         if(0 < stricmp(prt->textword,srchtex))
  1720.         {
  1721.  
  1722.         if (prt->lessthan == NULL)
  1723.         {
  1724.         if (coreleft())
  1725.         prt->lessthan = malloc(sizeof(rot));
  1726.         prt=prt->lessthan;
  1727.         strcpy(prt->textword,srchtex);
  1728.         prt->lessthan = NULL;
  1729.         prt->grtrthan = NULL;
  1730.  
  1731. #ifdef CLONE
  1732.         scroldwn(1);
  1733.         cputs(wordtex);
  1734.         if (video) GOTOXY(0,19);
  1735. #endif CLONE
  1736.  
  1737.  
  1738. #ifdef RAINBOW
  1739.         if (video)
  1740.         cprintf("\033[22;30f%s              \033[19;00f",wordtex);
  1741.         else
  1742.         cprintf("\033[22;30f%s             \r",wordtex);
  1743.  
  1744. #endif RAINBOW
  1745.  
  1746. #ifdef DEBUG
  1747.  
  1748.           scrolup(1);
  1749.           cprintf("node less than created");  
  1750.           getch();
  1751.  
  1752. #endif DEBUG
  1753.  
  1754.         }
  1755.         else
  1756.         wrtheep(prt->lessthan);
  1757.         }
  1758.  
  1759.         else
  1760.  
  1761.         if(0 > stricmp(prt->textword,srchtex)) 
  1762.         {
  1763.         if (prt->grtrthan == NULL)
  1764.         {
  1765.         if (coreleft())
  1766.         prt->grtrthan = malloc(sizeof(rot));
  1767.         prt=prt->grtrthan;
  1768.         strcpy(prt->textword,srchtex);
  1769.         prt->lessthan = NULL;
  1770.         prt->grtrthan = NULL;
  1771.  
  1772. #ifdef CLONE
  1773.         scroldwn(1);
  1774.         cputs(wordtex);
  1775.         if (video) GOTOXY(0,19);
  1776. #endif CLONE
  1777.  
  1778. #ifdef RAINBOW
  1779.         if (video)
  1780.         cprintf("\033[22;30f%s              \033[19;00f",wordtex);
  1781.         else
  1782.         cprintf("\033[22;30f%s             \r",wordtex);
  1783.  
  1784. #endif RAINBOW
  1785.  
  1786.  
  1787. #ifdef DEBUG
  1788.  
  1789.           scrolup(1);
  1790.           cputs("node greater than created");  
  1791.           getch();
  1792.  
  1793. #endif DEBUG
  1794.  
  1795.          }
  1796.         else
  1797.         wrtheep(prt->grtrthan);
  1798.         }
  1799.         }
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806. void readheep(prt)
  1807. struct misspword *prt; 
  1808.        {
  1809.         char buf;
  1810.         if (prt->lessthan != NULL)
  1811.          readheep(prt->lessthan);
  1812. #ifdef CLONE
  1813.         scrolup(2);
  1814. #endif CLONE
  1815.  
  1816.          cprintf("   Add to dictionary  %s ??  ___\b\b",prt->textword);
  1817.          buf = (char)getche();
  1818.  
  1819.          if ((buf =='Y') || (buf =='y'))
  1820.          {
  1821.          fprintf(perdct,"%s\n",prt->textword);
  1822.  
  1823. #ifdef RAINBOW
  1824.         cputs("_  ADDED \n\r");
  1825. #endif RAINBOW
  1826.  
  1827. #ifdef CLONE
  1828.          cputs("_  ADDED");
  1829. #endif CLONE
  1830.          }
  1831.         else
  1832.          if ((buf == 'q') || (buf == 'Q'))
  1833.         {
  1834.         CLRSCRN();
  1835.  
  1836. #ifdef RAINBOW
  1837.         cputs("\033[00;24r");
  1838. #endif RAINBOW
  1839.  
  1840.         exit(0);
  1841.         }
  1842.          if (prt->grtrthan != NULL) readheep(prt->grtrthan);
  1843.         }
  1844.  
  1845.  
  1846. void reedheep(prt)
  1847. struct misspword *prt; 
  1848.        {
  1849.         char buf;
  1850.         if (prt->lessthan != NULL)
  1851.          reedheep(prt->lessthan);
  1852.  
  1853.          
  1854.          while ((1 > strcmp(personaldct[perdex],prt->textword))
  1855.          && 
  1856.          ( perdex < persize))
  1857.          {
  1858.          fprintf(perdct,"%s\n",personaldct[perdex]);
  1859.          perdex++;
  1860.          }
  1861.  
  1862. #ifdef CLONE
  1863.         scrolup(2);
  1864. #endif CLONE
  1865.  
  1866.      
  1867.          cprintf("   Add to dictionary  %s ??  ___\b\b",prt->textword);
  1868.          buf = (char)getche();
  1869.  
  1870. #ifdef RAINBOW
  1871.         cputs("\n\r\n\r");
  1872. #endif RAINBOW
  1873.  
  1874.          if ((buf =='Y') || (buf =='y'))
  1875.          {
  1876.          fprintf(perdct,"%s\n",prt->textword);
  1877.  
  1878. #ifdef RAINBOW
  1879.         cputs("_  ADDED \n\r\n\r");
  1880. #endif RAINBOW
  1881.  
  1882. #ifdef CLONE
  1883.          cputs("_  ADDED");
  1884. #endif CLONE
  1885.      
  1886.          }
  1887.          if ((buf == 'q') || (buf == 'Q'))
  1888.         {
  1889.         CLRSCRN();
  1890.  
  1891. #ifdef RAINBOW
  1892.         cputs("\033[00;24r");
  1893. #endif RAINBOW
  1894.  
  1895.         exit(0);
  1896.         }
  1897.          if (prt->grtrthan != NULL) reedheep(prt->grtrthan);
  1898.         }
  1899.  
  1900. char *newdic= "   Enter New Personal Dictionary file name \n\r"
  1901. "   _________________________________________________________________________\r   ";
  1902.  
  1903.  
  1904. void  addtodic()
  1905.         {
  1906.         int   ind;
  1907.         char  buf, buf1;
  1908.  
  1909.  
  1910. #ifdef  TIMER
  1911.         unsigned char hunsec,sec,min;
  1912. #endif TIMER
  1913.  
  1914. #ifdef  TIMER
  1915.  
  1916.         gettime(&end_time);
  1917.  
  1918.         if (end_time.ti_hund < st_time.ti_hund)
  1919.           {
  1920.           end_time.ti_hund = end_time.ti_hund +100;
  1921.           end_time.ti_sec--;
  1922.           } /* borrow */
  1923.          hunsec = end_time.ti_hund - st_time.ti_hund;
  1924.   
  1925.          if (end_time.ti_sec < st_time.ti_sec)
  1926.           { 
  1927.           end_time.ti_sec = end_time.ti_sec + 60;
  1928.           end_time.ti_min--;
  1929.           }
  1930.  
  1931.          sec = end_time.ti_sec - st_time.ti_sec;
  1932.        
  1933.          min = end_time.ti_min - st_time.ti_min;
  1934.  
  1935. #endif TIMER
  1936.  
  1937. #ifdef CLONE
  1938.         scrolup(14);
  1939.         cprintf("\07\07                %d words       %d miss-spelled",totwrd,mspwrd);
  1940. #endif CLONE
  1941.  
  1942. #ifdef RAINBOW
  1943.  
  1944.         GOTOXY(0,19);
  1945.  cprintf("\07\07                %d words       %d miss-spelled\n\r\n\r",totwrd,mspwrd);
  1946. #endif RAINBOW
  1947.  
  1948. #ifdef TIMER
  1949. #ifdef CLONE
  1950.    scrolup(2);
  1951.    cprintf("           PROCESS TIME TOOK %02d min :%02d.%02d sec",min,sec,hunsec);
  1952. #endif CLONE
  1953.  
  1954. #ifdef RAINBOW
  1955. cprintf("\n\r\n\r             PROCESS TIME TOOK %02d min :%02d.%02d sec/n/r",min,sec,hunsec);
  1956. #endif RAINBOW
  1957. #endif TIMER
  1958.  
  1959. #ifdef  CLONE
  1960.         scrolup(2);
  1961. #endif  CLONE
  1962.       
  1963.         cprintf ("   Save the source file as a .b$k file? (n)  ___\b\b");
  1964.         buf = (char) getche();
  1965.  
  1966. #ifdef RAINBOW
  1967.         cputs("\n\r\n\r");
  1968. #endif RAINBOW
  1969.  
  1970.         fclose(output);
  1971.         fclose(source);
  1972.  
  1973.         if ((buf == 'Y') || (buf == 'y'))
  1974.         {
  1975.         strcpy(tmmpnam,fylnam);
  1976.         letcnt = strlen(fylnam); 
  1977.         while (letcnt >=1)        
  1978.         {
  1979.         if (tmmpnam[letcnt] == '.')
  1980.         {
  1981.         tmmpnam[letcnt]=0;
  1982.         break;
  1983.         }
  1984.       
  1985.  
  1986. #ifdef DEBUG
  1987.  
  1988.         scrolup(1);
  1989.         cprintf("%d\n\r",letcnt);
  1990.  
  1991. #endif DEBUG
  1992.  
  1993.         letcnt--;
  1994.         }
  1995.         strcat (tmmpnam,".b$k");
  1996.  
  1997.  
  1998. #ifdef DEBUG
  1999.  
  2000.         cprintf ("\n\r%s\n\r",tmmpnam);
  2001.         getch(); 
  2002.  
  2003. #endif DEBUG
  2004.  
  2005.         rename (fylnam,tmmpnam);
  2006.         rename (tmpfyl,fylnam);
  2007.         }
  2008.         else
  2009.         {
  2010.         unlink(fylnam);
  2011.         rename (tmpfyl,fylnam);
  2012.         }
  2013.  
  2014.         if ((!persize) && (mspwrd))
  2015.         {
  2016.  
  2017. #ifdef CLONE
  2018.         scrolup(2);
  2019.         cprintf("   Create a Personal dictionary? [Default no]___\b\b");
  2020.         buf = (char) getche(); 
  2021. #endif CLONE
  2022.  
  2023. #ifdef RAINBOW
  2024.         cprintf("   Create a Personal dictionary? [Default no]___\b\b");
  2025.         buf = (char) getche(); 
  2026.         cputs("\n\r\n\r");
  2027. #endif RAINBOW
  2028.  
  2029.         if ((buf == 'y') ||  (buf == 'Y'))
  2030.         {
  2031.         ind = 12;
  2032.  
  2033. #ifdef CLONE
  2034.  
  2035.         scrolup(1);
  2036.         cputs(newdic);
  2037.         gets(perdctnam);
  2038.         scrolup(1);
  2039.  
  2040. #endif CLONE
  2041.  
  2042. #ifdef RAINBOW
  2043.         cputs(newdic);
  2044.         gets(perdctnam);
  2045.         cputs("\n\r\n\r");
  2046. #endif RAINBOW
  2047.  
  2048.         ind = strlen(perdctnam);
  2049.  
  2050.  
  2051.     if (((!strchr(perdctnam,COLON))
  2052.          || 
  2053.     (!strchr(perdctnam,SLASH))
  2054.          || 
  2055.     (!strchr(perdctnam,BCKSLSH)))
  2056.       &&
  2057.     (dctenv))
  2058.     strcpy(perdctnam,(strcat(dctenv,perdctnam)));
  2059.  
  2060.     if((ind) && (!access(perdctnam,06)))
  2061.         {
  2062.         fclose (perdct);
  2063. #ifdef CLONE
  2064.         scrolup(2);
  2065. #endif CLONE
  2066.  
  2067.  
  2068.    cprintf ("   The File already exists do you wish to overwrite (N) ___\b\b");
  2069.         buf = (char) getche();
  2070.  
  2071. #ifdef RAINBOW
  2072.         cputs("\n\r\n\r");
  2073. #endif RAINBOW
  2074.  
  2075.         if ((buf == 'Y') || (buf == 'y'))
  2076.          perdct = fopen(perdctnam,"wt");
  2077.          }
  2078.          else
  2079.          perdct = fopen(perdctnam,"wt");
  2080.         if (perdct) readheep(root);
  2081.         }
  2082.         }
  2083.         else
  2084.         if ((persize) && (mspwrd))
  2085.         {
  2086. #ifdef CLONE
  2087.         scrolup(2);
  2088. #endif CLONE
  2089.  
  2090.   cprintf("   Do you wish to add any words to your personal dictionary (N)___\b\b");
  2091.          buf = (char)getche();
  2092.  
  2093. #ifdef RAINBOW
  2094.         cputs("\n\r\n\r");
  2095. #endif RAINBOW
  2096.  
  2097.          if ((buf == 'y') || (buf == 'Y'))
  2098.          {
  2099.           perdct = fopen(perdctnam,"wt");
  2100.  
  2101.           perdex = 1;
  2102.  
  2103.           reedheep(root);
  2104.  
  2105.           while (perdex < persize)
  2106.           {
  2107.           fprintf(perdct,"%s\n",personaldct[perdex]);
  2108.           perdex++;
  2109.           }
  2110.           fclose (perdct); 
  2111.  
  2112.         }
  2113.         }
  2114.         }        
  2115.       
  2116.  
  2117. void  cdecl main(argc,argv)
  2118.         int argc;
  2119.         char **argv;
  2120.         {
  2121.         char  buf;
  2122.         int  tmplnth = 0;
  2123.         int  dex;      /* pointer of line */
  2124.  
  2125. #ifdef  CLONE
  2126.         getmode();
  2127. #endif CLONE
  2128.  
  2129.         setcbrk(0); /* turns control c checking off */
  2130.         setfyl (argc,argv);    
  2131.  
  2132. #ifdef  TIMER  
  2133.         gettime(&st_time);        
  2134. #endif  TIMER
  2135.  
  2136. #ifdef RAINBOW
  2137.         GOTOXY(0,12);
  2138.         cputs("\033[06;19r \033[?4l");
  2139.         /* set scroll region and jump scroll for speed */
  2140.     
  2141. #endif RAINBOW
  2142.  
  2143.  
  2144.         GOTOXY(30,21);        
  2145.         cputs("MISSPELLED WORDS");
  2146.         GOTOXY(27,5);
  2147.         cputs("Hit any key to stop SPELLA");
  2148.         GOTOXY(0,19);
  2149.  
  2150.         while (!feof(source))
  2151.         {
  2152.         fgets(srcline,MAXLINE,source);
  2153.         if (feof(source)) break;
  2154.         if (video)
  2155.         {
  2156. #ifdef CLONE
  2157.         scrolup(1);
  2158.         cputs(srcline);
  2159. #endif CLONE
  2160.  
  2161. #ifdef RAINBOW
  2162.         cprintf("%s\r",srcline);
  2163. #endif RAINBOW
  2164.  
  2165.  
  2166.  
  2167.         }
  2168.  
  2169.         lnlength = strlen(srcline);
  2170.         dex = 0; 
  2171.              
  2172.         while (dex <= lnlength)
  2173.         {
  2174.     while ((isalpha(srcline[dex])) || ((letcnt) && (srcline[dex] == 39)))
  2175.         {
  2176.         hyphen1 = 0;
  2177.         wordtex[letcnt] = srcline[dex];
  2178.         if (hyphen2)
  2179.         hyphtex[hyphcnt++] = srcline[dex];
  2180.         letcnt++;
  2181.         dex++;
  2182.         }
  2183.         
  2184.         if ((letcnt) && (srcline[dex]==HYPHEN) && (dex == (lnlength-2)))
  2185.         {
  2186.  
  2187. #ifdef DEBUG
  2188.  
  2189.         scrolup(1);
  2190.         cputs("\n\rHyphen detected at end of line\n\r");
  2191.         getch();              
  2192.  
  2193. #endif DEBUG
  2194.  
  2195.  
  2196.         hyphen = 255;
  2197.         hyphen1 =255;
  2198.         hyphen2 =255;
  2199.         hyphcnt =0;
  2200.         }
  2201.  
  2202.         if (( letcnt >=3) && (letcnt <= 20) && (!hyphen1))
  2203.         {
  2204.         totwrd++;
  2205.         wordtex[letcnt] = 0;
  2206.         strcpy(srchtex,wordtex);
  2207.         strupr(srchtex);
  2208.         wrrd=wordsearch(srchtex,letcnt);
  2209.  
  2210.         if((!wrrd) && (letcnt >= 4))
  2211.         wrrd = stripsufix(letcnt);
  2212.  
  2213.         if ((!wrrd) && (persize))
  2214.         {
  2215.         strcpy(srchtex,wordtex);
  2216.         strupr(srchtex);
  2217.  
  2218. #ifdef DEBUG
  2219.  
  2220.         scrolup(1);
  2221.         cprintf("srchtex %s   %s",srchtex,wordtex);
  2222.  
  2223. #endif DEBUG
  2224.  
  2225.         wrrd =serperdct (srchtex);
  2226.         }
  2227.  
  2228.         if (!wrrd)
  2229.         {
  2230.         tmplnth=strlen(outln);
  2231.         outln[tmplnth++]=marker;
  2232.         outln[tmplnth]=0;
  2233.         if (hyphen2)
  2234.         {
  2235.         hyphtex[hyphcnt]=0;
  2236.         strcat(outln,hyphtex);
  2237.         }
  2238.         else
  2239.         strcat(outln,wordtex);
  2240.         mspwrd++;
  2241.         wrtheep(root);
  2242.         tmplnth=strlen(outln);
  2243.         outln[tmplnth++]=srcline[dex];
  2244.         outln[tmplnth]=0;
  2245.         wordtex[0]=0;
  2246.         letcnt = 0;
  2247.         hyphen2 =0;
  2248.         }
  2249.  
  2250.         else
  2251.  
  2252.         {
  2253.         if (hyphen2)
  2254.         {
  2255.         hyphtex[hyphcnt]=0;
  2256.         strcat(outln,hyphtex);
  2257.         }
  2258.         else
  2259.         strcat(outln,wordtex);
  2260.         tmplnth=strlen(outln);
  2261.         outln[tmplnth++]=srcline[dex];
  2262.         outln[tmplnth]=0;
  2263.         letcnt = 0;
  2264.         wordtex[0]=0;
  2265.         hyphen2 =0;
  2266.         }
  2267.         }
  2268.  
  2269.         else
  2270.  
  2271.         if (((letcnt) && (!hyphen) && (!hyphen1))
  2272.             ||
  2273.            ((letcnt)  && (hyphen) && (hyphen1)))
  2274.         {
  2275.         wordtex[letcnt] = 0;
  2276.         hyphen = 0;
  2277.         strcat(outln,wordtex);
  2278.         tmplnth=strlen(outln);
  2279.         outln[tmplnth++]=srcline[dex];
  2280.         outln[tmplnth]=0;
  2281.         }
  2282.  
  2283.         else
  2284.  
  2285.         {
  2286.         tmplnth=strlen(outln);
  2287.         outln[tmplnth++]=srcline[dex];
  2288.         outln[tmplnth]=0;
  2289.         }
  2290.         if (!hyphen1)
  2291.         {
  2292.         wordtex[letcnt] = 0;
  2293.         letcnt = 0;
  2294.         }
  2295.         dex++;
  2296.         }
  2297.  
  2298.         fputs(outln,output);
  2299.         outln[0]=0;
  2300.  
  2301.         if (kbhit()) 
  2302.         {
  2303.         CLRSCRN();
  2304.         puts("Program interupted exiting to operating system ");
  2305.  
  2306. #ifdef RAINBOW
  2307.         cputs("\033[00;24r");
  2308. #endif RAINBOW
  2309.  
  2310.         exit(0);
  2311.         }
  2312.         }
  2313.         addtodic();
  2314.         CLRSCRN ();
  2315.  
  2316. #ifdef RAINBOW
  2317.         cputs("\033[00;24r");
  2318. #endif RAINBOW
  2319.         exit(0);
  2320.         }