I certead tihs slmal pgarrom jsut a few mnieuts ago. It'll mkae winirtg in tihs new and faitciasnng sylte mcuh eiesar, I hpoe.
/* spelling.c
** Copyright (C) 2003 Bálint Balogh
** This program is free software released under the GNU
** General Public License Version 2 or any later version. */
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
/* This is needed because of strfry() */
#ifndef __GLIBC__
#error This program needs the GNU C library
"This program needs the GNU C library" (portable #error)
#endif
#define INCREMENT (1024)
#define MAX_ITERATION (64)
int main( int argc, char *argv[] )
{
char *word = NULL;
char *original = NULL;
size_t length = 0;
size_t allocated = 0;
int ch;
while (1) {
ch = getchar();
if ( !isalpha( ch ) ) {
if ( length ) {
if ( length > 3 ) {
unsigned i = 0;
char end = word[length - 1];
memcpy( original, word + 1, length - 2 );
word[length - 1] = 0;
do {
strfry( word + 1 );
i++;
} while ( i < MAX_ITERATION
&& !memcmp( original, word + 1, length - 2 ) );
word[length - 1] = end;
}
word[length] = 0;
fputs( word, stdout );
length = 0;
}
if ( ch == EOF ) return 0;
putchar( ch );
} else {
if ( allocated <= length + 1 ) {
allocated += INCREMENT;
if ( (word = realloc( word, allocated )) == NULL
|| (original = realloc( original, allocated )) == NULL ) {
fprintf( stderr, "%s: Out of memory. Aborting.\n", argv[0] );
return -1;
}
}
word[length++] = ch;
}
}
}
[Eidt:] Bgfuix.