2
#include "charset_auto_russian.h"
4
main(int argc, char *argv[]) {
7
char word[256],phrase[8192];
8
unsigned long a[4]={0,0,0,0};
12
if ((argc!=2)&&(argc!=3)) {
13
printf("Usage: %s <file name> [<max words>]\n",argv[0]);
17
if (argc==3) mw=atoi(argv[2]);
22
printf("Failed to open specified file. Check permissions!\n");
29
if (i) strcat(phrase," ");
31
for(st=0;word[st]=='"'||word[st]=='\''||word[st]=='(';st++);
32
if (strlen(word)<1) continue;
33
for(len=strlen(word)-1;word[len]==','||word[len]=='.'||word[len]=='!'||word[len]=='?'||word[len]==';'||word[len]=='-'||word[len]==':'||word[len]=='"'||word[len]=='\''||word[len]==')';len--);
34
if (strlen(word)<1) continue;
36
strcat(phrase,word+st);
38
if (strlen(phrase)<5) continue;
40
a[autocharset_russian_uc(phrase,strlen(phrase))]++;
41
// a[autocharset_russian(phrase,strlen(phrase))]++;
43
// a[autocharset_russian(word+st,len+1-st)]++;
47
printf("Win: %lu, Koi: %lu, Alt: %lu, UTF: %lu\n",a[0],a[1],a[3],a[2]);
62
if (i) strcat(phrase," ");
64
for(st=0;word[st]=='"'||word[st]=='\''||word[st]=='(';st++);
65
if (strlen(word)<1) continue;
66
for(len=strlen(word)-1;word[len]==','||word[len]=='.'||word[len]=='!'||word[len]=='?'||word[len]==';'||word[len]=='-'||word[len]==':'||word[len]=='"'||word[len]=='\''||word[len]==')';len--);
67
if (strlen(word)<1) continue;
69
strcat(phrase,word+st);
71
if (strlen(phrase)<5) continue;
73
i=autocharset_russian_uc(phrase,strlen(phrase));
74
// i=autocharset_russian(phrase,strlen(phrase));
75
// i=autocharset_russian(word+st,len+1-st);
77
if (i==0) printf("Win: %s\n",phrase);
78
else if (i==1) printf("Koi: %s\n",phrase);
79
else if (i==2) printf("UTF: %s\n",phrase);
80
else if (i==3) printf("ALT: %s\n",phrase);