#include #include #include #include #define true 1 #define false 0 struct { char *us, *gb; } words[] = { { "color", "colour" }, /* { "program", "programme" }, */ /* programme except for computer programs */ { "CCW", "ACW" }, /* Counter/Anti Clockwise */ { "neighbor", "neighbour" }, { "Adobe now considers", "Adobe now consider" }, { "behavior", "behaviour" }, { "centered", "centred" }, { "center", "centre" }, { "dialog", "dialogue" }, { "license", "licence" }, { "argument", "arguement" }, { "delimiter", "delimiter" }, /* Otherwise the miter transform would lead to misspellings */ { "miter", "mitre" }, { "recognize", "recognise" }, { "realize", "realise" }, /* careful about meter/metre because parameter does not become parametre */ NULL }; static char *strcasestr(const char *haystack, const char *needle) { const char *npt, *hpt; int hch, nch; for ( ; *haystack!='\0' ; ++haystack ) { for ( hpt = haystack, npt = needle; *npt!='\0'; ++hpt, ++npt ) { hch = *hpt; nch = *npt; if ( isupper(hch)) hch = tolower(hch); if ( isupper(nch)) nch = tolower(nch); if ( nch!=hch ) break; } if ( *npt=='\0' ) return( (char *) haystack ); } return( NULL ); } static void caserpl(char *to,int flen, char *rpl) { int i, ch=0, och; for ( i=0 ; i0 ) { for ( mpt = line+strlen(line); mpt>=pt+flen; --mpt ) mpt[len] = *mpt; caserpl(pt,flen,rpl); } else if ( len<0 ) { caserpl(pt,flen,rpl); for ( mpt=pt+flen; *mpt; ++mpt ) mpt[len] = *mpt; mpt[len] = 0; } else caserpl(pt,flen,rpl); pt += rlen; } } #define LINE_MAX 40 static char linebuffers[LINE_MAX][200]; static int anyneedles(int start, int end) { int l,i; for ( l=start; l, %d.\n", tm->tm_year+1900 ); fprintf( output, "#\n" ); fprintf( output, "#, fuzzy\n" ); fprintf( output, "msgid \"\"\n" ); fprintf( output, "msgstr \"\"\n" ); fprintf( output, "\"Project-Id-Version: %4d%02d%02d\\n\"\n", tm->tm_year+1990, tm->tm_mon+1, tm->tm_mday ); fprintf( output, "\"POT-Creation-Date: 2006-05-07 20:02-0700\\n\"\n" ); fprintf( output, "\"PO-Revision-Date: %4d-%02d-%02d %02d:%02d-0800\\n\"\n", tm->tm_year+1990, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min ); fprintf( output, "\"Last-Translator: George Williams, \\n\"\n" ); fprintf( output, "\"Language-Team: LANGUAGE \\n\"\n" ); fprintf( output, "\"MIME-Version: 1.0\\n\"\n" ); fprintf( output, "\"Content-Type: text/plain; charset=UTF-8\\n\"\n" ); fprintf( output, "\"Content-Transfer-Encoding: 8bit\\n\"\n" ); fprintf( output, "\"Plural-Forms: nplurals=2; plural=n!=1\\n\"\n" ); while ( fgets(linebuffers[0],sizeof(linebuffers[0]),input)!=NULL ) { if ( linebuffers[0][0]=='\n' ) break; } while ( !feof(input)) { l=0; while ( l