home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
wp_dtp
/
ispell.lha
/
local.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-28
|
1KB
|
76 lines
/*
* handles local words. simple hack. no pride.
*
* (Thanks tgr! Not a bad hack. --- LJR)
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <proto/all.h>
#include "ispell.h"
static int localcount = 0;
#define MAXLINELEN 70
struct wptr
{
struct wptr *next;
char word[4];
} *wptr;
void lldump (void)
{
FILE *f;
char localname[32];
struct wptr *p, *q;
int loc;
int len;
strcpy (localname, "local.words");
if (localcount)
sprintf (localname + strlen (localname), "%d", localcount);
f = fopen (localname, "w");
if (f != NULL)
{
loc = 0;
for (p = wptr; p;)
{
q = p->next;
len = strlen (p->word) + 1;
if (len + loc > MAXLINELEN)
{
putc ('\n', f);
loc = 0;
}
if (loc == 0)
{
fprintf (f, " ispell'local'words");
loc = 19;
}
fputc (' ', f);
fputs (p->word, f);
loc += len;
free (p);
p = q;
}
wptr = NULL;
fclose (f);
}
localcount++;
}
void llinsert (char *s)
{
int len;
struct wptr *p;
len = 5 + strlen (s);
if ((p = malloc (len)))
{
strcpy (p->word, s);
p->next = wptr;
wptr = p;
}
}