Discard too long lines in dictionary file: add warning and test
This commit is contained in:
parent
94a15dfc4e
commit
b7daafd28d
4
hyphen.c
4
hyphen.c
|
@ -444,6 +444,10 @@ for (k = 0; k < 2; k++) {
|
||||||
if (!feof(f) && strchr(buf, '\n') == NULL) {
|
if (!feof(f) && strchr(buf, '\n') == NULL) {
|
||||||
int c;
|
int c;
|
||||||
while ((c = fgetc(f)) != '\n' && c != EOF);
|
while ((c = fgetc(f)) != '\n' && c != EOF);
|
||||||
|
/* issue warning if not a comment */
|
||||||
|
if (buf[0] != '%') {
|
||||||
|
fprintf(stderr, "Warning: skipping too long pattern (more than %lu chars)\n", sizeof(buf));
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ alt4.test \
|
||||||
alt5.test \
|
alt5.test \
|
||||||
alt6.test \
|
alt6.test \
|
||||||
alt7.test \
|
alt7.test \
|
||||||
|
longlines.test \
|
||||||
compound.test \
|
compound.test \
|
||||||
compound2.test \
|
compound2.test \
|
||||||
compound3.test \
|
compound3.test \
|
||||||
|
@ -50,6 +51,9 @@ alt6.word \
|
||||||
alt7.hyph \
|
alt7.hyph \
|
||||||
alt7.pat \
|
alt7.pat \
|
||||||
alt7.word \
|
alt7.word \
|
||||||
|
longlines.hyph \
|
||||||
|
longlines.pat \
|
||||||
|
longlines.word \
|
||||||
alt.hyph \
|
alt.hyph \
|
||||||
alt.pat \
|
alt.pat \
|
||||||
alt.word \
|
alt.word \
|
||||||
|
@ -105,6 +109,7 @@ alt4.test \
|
||||||
alt5.test \
|
alt5.test \
|
||||||
alt6.test \
|
alt6.test \
|
||||||
alt7.test \
|
alt7.test \
|
||||||
|
longlines.test \
|
||||||
alt.test \
|
alt.test \
|
||||||
basealt2.test \
|
basealt2.test \
|
||||||
basealt.test \
|
basealt.test \
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
a=bc=d
|
|
@ -0,0 +1,10 @@
|
||||||
|
ISO8859-1
|
||||||
|
LEFTHYPHENMIN 1
|
||||||
|
RIGHTHYPHENMIN 1
|
||||||
|
% Check whether characters over MAX_CHARS are not treated as new line
|
||||||
|
% This test is valid as long as MAX_CHARS is 100
|
||||||
|
%
|
||||||
|
% Following pattern should result in a=bc=d hyphenation
|
||||||
|
a1b2c1d
|
||||||
|
% and should not be overriden by pattern from too long comment (over MAX_CHARS characters)
|
||||||
|
%|------------------------------ this part is 100 characters long --------------------------------|a8b9c8d
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
DIR="`dirname $0`"
|
||||||
|
NAME="`basename $0 .test`"
|
||||||
|
$DIR/test.sh $NAME.pat $NAME.word $NAME.hyph
|
|
@ -0,0 +1 @@
|
||||||
|
abcd
|
Loading…
Reference in New Issue