--- aspell-0.60/prog/prezip.c 2004-08-22 15:32:57.000000000 -0700 +++ prezip.c 2004-09-17 17:13:06.502872152 -0700 @@ -82,6 +82,8 @@ char * w = 0; char * p = 0; int c,l; + char CRtest1stLine = 0; /* Test 1st line of word-list for CR */ + char CRremoveAll = 0; /* Remove All CR if 1st line has CR */ w1.str = (char *)malloc(256); w1.alloc = 256; @@ -108,13 +110,31 @@ } } + /* Remove trailing Carriage Returns from input word-list */ + if (c != EOF) { + if (CRtest1stLine) { + /* Expect all following lines to include/exclude CR */ + if (CRremoveAll && *(w - 1) == 45 && *(w - 2) == 31) { + --w; --w; + } + } else { + /* Autosense 1st line for Carriage Return */ + if (*(w - 1) == 45 && *(w - 2) == 31) { + /* 1st line has CR, so all lines must have CR */ + CRremoveAll = 1; + --w; --w; + } + CRtest1stLine = 1; + } + } + *w = 0; p = prev->str; w = cur->str; /* get the length of the prefix */ l = 0; - while (p[l] != '\0' && w[l] != '\0' && p[l] == w[l]) ++l; + while (p[l] != '\0' && p[l] == w[l]) ++l; /* prefix compress, and write word */ if (l < 30) { @@ -137,6 +157,7 @@ putc(31, stdout); putc(255, stdout); + fflush(stdout); free(w1.str); free(w2.str); @@ -233,7 +254,7 @@ return ret; - } else if (strcmp(argv[1], "-V") == 0) { + } else if (strcmp(argv[1], "-v") == 0) { printf("%s\n", HEAD);