Hi, Since this bug isn't apparently going anywhere, I took the liberty to NMU new version of an to DELAYED/10-day. debdiff attached :)
-- "rm -rf" only sounds scary if you don't have backups
diff -u an-0.95/an.c an-0.95/an.c --- an-0.95/an.c +++ an-0.95/an.c @@ -136,7 +136,9 @@ bitmask_t *letter_mask; /* bit masks for letters */ int alphabet = 0; /* number of letters in alphabet */ int letters[256]; /* list of letter positions used */ -int letterpos[256]; /* list of letter positions */ +int letterpos[256]; /* list of letter positions, = pos, -1 or -2 */ +#define LETTERPOS_IGN -1 +#define LETTERPOS_BAD -2 int *letter_freq; /* Frequency each letter appears in words array */ int *letter_index; @@ -233,7 +235,7 @@ printf (_(" -n, --number NUM\tprint maximum of NUM anagrams\n")); printf (_(" -w, --words\t\tprint words that PHRASE letters make\n")); printf (_(" -t, --test ANAG\ttest if ANAG can be made with PHRASE\n")); - printf (_(" -u, --used PHRASE\tFlag PHRASE letters allready used\n")); + printf (_(" -u, --used PHRASE\tFlag PHRASE letters already used\n")); printf (_(" --help\t\tdisplay this help and exit\n")); printf (_(" --version\t\toutput version information and exit\n")); #ifdef HAVE64 @@ -273,14 +275,36 @@ setlocale (LC_CTYPE, "C"); #endif + + /* Find which letters are relevant, + * default to LETTERPOS_IGN = -1 = 'punctuation' (ignore) + * except for LETTERPOS_BAD = -2 = lower case letter not in string, or digit + * and then set every lower case letter that is in the string + * to a real value. + */ + + for (loop1 = 0; loop1 < 256; loop1++) { + letterpos[loop1] = islower(loop1)||isdigit(loop1) + ? LETTERPOS_BAD + : LETTERPOS_IGN; + } + + for (loop1 = 0; argv[optind][loop1] != '\0'; loop1++) { + int lc=tolower(argv[optind][loop1]); + if(islower(lc)) { + /* set a dummy value of 0, will change it later */ + letterpos[lc] = '\0'; + } + } + mask = 1; for (loop1 = 0; loop1 < 256; loop1++) { - letterpos[loop1] = -1; - if (islower(loop1)) { + if (letterpos[loop1] == '\0') { if (mask == 0) { fprintf(stderr,_("Not enough bits in bitmask type to work on your language.\n")); return 1; } + /* Fill the real letter position for this real lower case letter */ letters[alphabet]=loop1; letterpos[loop1]=alphabet; alphabet++; @@ -576,7 +600,7 @@ { int n; /* Start point in WORDS array */ - int end=0; /* End point in WORDS array */ + int end=let_hash[alphabet+1];/* End point in WORDS array */ int high; /* Loop counter */ /* WORDS[] is sorted by letter frequency and length, from longest to shortest, therefore we can jump to the first word of the length of @@ -631,7 +655,7 @@ if ((*word_mask[n] & *phrase_mask) == *word_mask[n]) { /* If NUM_WORD_MASKS is greater than 1 we must check the rest of the masks, otherwise we know we have a match as we have - allready checked the first mask and don't need to do + already checked the first mask and don't need to do anything else here as a match is assumed */ if (num_word_masks[n] > 1) { @@ -863,9 +887,19 @@ /* If letter is punctuation go to next letter */ - if (letterpos[(unsigned char)letter] == -1) + if (letterpos[(unsigned char)letter] == LETTERPOS_IGN) continue; + /* if letter is a forbidden lower case letter return false */ + if (letterpos[(unsigned char)letter] == LETTERPOS_BAD) { + +#ifdef FORCE_ANSI + free (avail); +#endif + + return (FALSE); + } + /* Check if letter is available for use (useit==TRUE) */ useit = check_letter (*current_word, phrase_word, avail); @@ -895,7 +929,7 @@ /* Check if LETTER is contained in PHRASE_WORD and has not been used - allready */ + already */ int check_letter (letter, phrase_word, avail) unsigned char letter; @@ -991,7 +1025,7 @@ int word_ok; char *temp_string; int have_a_letter; - int have_a_digit; + int have_something_unwanted; /* Initial allocation of WORDS[] array, will realloc later if more than BLOCKSIZE words found */ @@ -1029,16 +1063,17 @@ may make this an option) */ have_a_letter = FALSE; - have_a_digit = FALSE; + have_something_unwanted = FALSE; for (temp_string = line; *temp_string; temp_string++) { - if (letterpos[(unsigned char)*temp_string]!=-1) - have_a_letter = TRUE; - if (isdigit (*temp_string)) { - have_a_digit = TRUE; - break; + if (letterpos[(unsigned char)*temp_string]==LETTERPOS_BAD) { + have_something_unwanted = TRUE; + break; } + + if (letterpos[(unsigned char)*temp_string]>=0) + have_a_letter = TRUE; } - if (!have_a_letter || have_a_digit) + if (!have_a_letter || have_something_unwanted) continue; @@ -1201,7 +1236,7 @@ /* If letter is punctuation mark skip to next letter */ int l = letterpos[(unsigned char)*word]; - if (l == -1) + if (l < 0) continue; @@ -1238,7 +1273,7 @@ while (loop1--) { tmpptr = *words++; for (; *tmpptr != '\0'; tmpptr++) { - if (letterpos[(unsigned char)*tmpptr]==-1) + if (letterpos[(unsigned char)*tmpptr]<0) continue; else letter_freq[letterpos[(unsigned char)*tmpptr]]++; @@ -1397,14 +1432,14 @@ /* Check to make sure punctuation appears at the end of words */ - if (letterpos[(unsigned char)*let1]==-1) { - if (letterpos[(unsigned char)*let2]==-1) + if (letterpos[(unsigned char)*let1]<0) { + if (letterpos[(unsigned char)*let2]<0) return 0; else return 1; } - if (letterpos[(unsigned char)*let2]==-1) + if (letterpos[(unsigned char)*let2]<0) return -1; @@ -1438,13 +1473,13 @@ int c2; do { - if (letterpos[(unsigned char)*s1]==-1) { - if (letterpos[(unsigned char)*s2]==-1) + if (letterpos[(unsigned char)*s1]<0) { + if (letterpos[(unsigned char)*s2]<0) return 0; else return 1; } - if (letterpos[(unsigned char)*s2]==-1) + if (letterpos[(unsigned char)*s2]<0) return 1; while (*(s1 + 1) == *s1) s1++; @@ -1606,7 +1641,7 @@ /* Get length of STRING without punctuation marks, assumes STRING is - allready lowercase, returns STRING length */ + already lowercase, returns STRING length */ int no_punc_len (string) unsigned char *string; diff -u an-0.95/Makefile an-0.95/Makefile --- an-0.95/Makefile +++ an-0.95/Makefile @@ -1,4 +1,4 @@ -# an v0.93 - Anagram generator +# an v0.95 - Anagram generator # Copyright (C) 1996 Free Software Foundation # Copyright (C) 1995,1996 Richard Jones # diff -u an-0.95/an.6 an-0.95/an.6 --- an-0.95/an.6 +++ an-0.95/an.6 @@ -30,7 +30,7 @@ .TP .I \-u, --used string -Considers that letters in \fIstring\fP have allready used when analyzing +Considers that letters in \fIstring\fP have already used when analyzing letters in \fBPHRASE\fP .TP diff -u an-0.95/COPYRIGHT an-0.95/COPYRIGHT --- an-0.95/COPYRIGHT +++ an-0.95/COPYRIGHT @@ -1,4 +1,4 @@ - an v0.94 - Anagram generator + an v0.95 - Anagram generator Copyright (C) 1996 Free Software Foundation. Copyright (C) 1995,1996 Richard Jones Copyright (C) 2001-2004 Paul Martin diff -u an-0.95/debian/changelog an-0.95/debian/changelog --- an-0.95/debian/changelog +++ an-0.95/debian/changelog @@ -1,3 +1,12 @@ +an (0.95-3.1) unstable; urgency=low + + * Non-maintainer upload to delayed + * Incorporate speedup and fixes patches + from Phil Carmody <thefatp...@yahoo.co.uk>, + (Closes: #234744) + + -- Riku Voipio <riku.voi...@iki.fi> Sun, 18 Jan 2009 23:18:05 +0200 + an (0.95-3) unstable; urgency=low * Bugfixes: diff -u an-0.95/debian/copyright an-0.95/debian/copyright --- an-0.95/debian/copyright +++ an-0.95/debian/copyright @@ -8,7 +8,7 @@ The original author of this program, who appears to have disappeared, was Richard Jones <rich...@deep-thought.org>. - an v0.93 - Anagram generator + an v0.95 - Anagram generator Copyright (C) 1996 Free Software Foundation. Copyright (C) 1995,1996 Richard Jones Portions copyright (C) 2000-2004 Paul Martin only in patch2: unchanged: --- an-0.95.orig/README +++ an-0.95/README @@ -1,4 +1,4 @@ -an v0.94 - Anagram Generator +an v0.95 - Anagram Generator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Generates anagrams for a phrase supplied by the user, the words used in the only in patch2: unchanged: --- an-0.95.orig/lib/Makefile +++ an-0.95/lib/Makefile @@ -1,4 +1,4 @@ -# an v0.93 - Anagram generator +# an v0.95 - Anagram generator # Copyright (C) 1996 Free Software Foundation # Copyright (C) 1995,1996 Richard Jones #