/*
Right Right!
First and Foremost: I didnt not write this code from scratch!!! I know that Erwin
originally released a version that used ispell - but it was much more complicated than
this (and didn't seem to work for Alot of people :P) So I re-worked it to work for MY
Mud, using bits and pieces I found around elsewhere. Again, I did NOT write this code
from scratch.

This, on the other hand, is extremely easy.

Simply plop the code into string.c, or wherever your string editor commands are,
then do a search for "void string_add" - It should give you a function that, if you
scroll down a bit, contains all your string editing . commands (.f, .c etc).

And Add this:
*/

        if (!str_cmp(arg1, ".i"))
        {
        send_to_char("{CRunning Spellcheck:{x\n\r",ch);
        spell_check(ch, *ch->desc->pString);
            return;
        }

/* Thats it! Now here's the actual code! */

void spell_check (CHAR_DATA * ch, char *string)
{
        char buf[MSL];
        char newstring[MSL];
        char lines[MSL];
        char chr;
        FILE *fp;
        char *rstr;
        int i = 0;

        newstring[0] = 0;
        lines[0] = 0;

        if (string == NULL)
                return;

        for (rstr = string; *rstr; rstr++)
        {
                if (*rstr != '\r' && *rstr != '~')
                {
                        if (*rstr == '{') // Change this to whatever your color code is
                        {
                                rstr++;
                        }
                        else if (*rstr == '\n')
                        {
                                newstring[i] = ' ';
                                i++;
                        }
                        else
                        {
                                newstring[i] = *rstr;
                                i++;
                        }
                }
        }
        newstring[i] = 0;

        fp = fopen ("check.txt", "w");
        fprintf (fp, "!\n\r%s\n\r", newstring);
        fclose (fp);                                             // ispell should be installed
        sprintf (buf, "cat check.txt | ispell -a > check.txt");  // by default on most linux
        system (buf);                                            // machines.
        if ((fp = fopen ("check.txt", "r")) != NULL)
        {
                i = 0;
                while (!feof (fp))
                {
                        chr = getc (fp);
                        lines[i] = chr;
                        i++;
                }
                lines[i] = 0;
                fclose (fp);
                system ("rm check.txt");
                newstring[0] = 0;
                i = 0;
                for (rstr = str_dup (lines); *rstr; rstr++)
                {
                        if (*rstr == '\n' && *(rstr + 1) == '\n')
                        {
                                rstr++;
                        }
                        else
                        {
                                newstring[i] = *rstr;
                                i++;
                        }
                }
                free_string(rstr);
                newstring[i] = 0;
                strcat (newstring, "\n\r\n\r");
                send_to_char (newstring, ch);
        }
        return;
}


/* 
Boom! All done. Now enter the game, go into a string editor (maybe notes, or
descriptions?) and type .i! You should get a printout that looks like this:

> *** Starting Spell Check:
@(#) International Ispell Version 3.1.20 (but really Aspell 0.50.3)
& autorescue 29 9: auto rescue, auto-rescue, autocue, attires, outrace, rescue ...


What's all that mean? It means that the word 'autorescue' was not found in the dictionary,
and the words following it are suggested replacements. Yahoo!

This should be easy enough to install and get running - If there are any questions,
feel free to contact me, or your other local code guru for help. :)
 */