From e491cf8ad72d6752af8dac345d3bbc491e21a13a Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Tue, 28 Jun 2005 16:37:40 +0000 Subject: 0.1.6 * Function name is changed to conform LibRCC naming conventions * AutoConf Improvements * Release Script * Other minor changes --- examples/Makefile.am | 7 +++++++ examples/example.c | 31 +++++++++++++++++++++++++++++++ examples/input.txt | 4 ++++ 3 files changed, 42 insertions(+) create mode 100644 examples/Makefile.am create mode 100644 examples/example.c create mode 100644 examples/input.txt (limited to 'examples') diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..fb93b58 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,7 @@ +bin_PROGRAMS= example +example_SOURCES= example.c +example_LDADD= ../src/librcd.la +EXTRA_DIST= input.txt + +test: example + cat input.txt | ./example diff --git a/examples/example.c b/examples/example.c new file mode 100644 index 0000000..9666ae5 --- /dev/null +++ b/examples/example.c @@ -0,0 +1,31 @@ +#include +#include +#include + +main() { + enum russian_charsets res; + char buf[255]; + int l; + + while (fgets(buf,255,stdin)) { + if (strlen(buf)<2) break; + + res = get_russian_charset(buf,0); + switch(res) { + case RUSSIAN_CHARSET_WIN: + printf("CP1251: "); + break; + case RUSSIAN_CHARSET_ALT: + printf("CP866 : "); + break; + case RUSSIAN_CHARSET_KOI: + printf("KOI8-R: "); + break; + case RUSSIAN_CHARSET_UTF8: + printf("UTF8 : "); + break; + } + printf("%s",buf); + if (buf[strlen(buf)-1]!='\n') printf("\n"); + } +} diff --git a/examples/input.txt b/examples/input.txt new file mode 100644 index 0000000..8ea6e44 --- /dev/null +++ b/examples/input.txt @@ -0,0 +1,4 @@ +ÐÒÉ×ÅÔ +ïðèâåò +¯à¨¢¥â +привет -- cgit v1.2.3