about summary refs log tree commit diff
path: root/tr2cyr_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'tr2cyr_exec.c')
-rw-r--r--tr2cyr_exec.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tr2cyr_exec.c b/tr2cyr_exec.c
new file mode 100644
index 0000000..762dc5e
--- /dev/null
+++ b/tr2cyr_exec.c
@@ -0,0 +1,23 @@
+#include <locale.h>
+#include <stdio.h>
+#include <wchar.h>
+
+#include "tr2cyr.h"
+
+
+static wint_t reader(size_t i, void *arg)
+{
+    return getwchar();
+}
+
+static int writer(wchar_t ch, void *arg)
+{
+    (void)arg;
+    return putwchar(ch) == WEOF ? -1 : 0;
+}
+
+int main(int argc, char **argv)
+{
+    setlocale(LC_CTYPE, "");
+    tr2cyr(&reader, 0, &writer, 0);
+}