summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2010-07-12 13:59:03 +0200
committerMichal Čihař <michal@cihar.com>2010-07-12 13:59:03 +0200
commit451335d49caec7fe444116f419788777232470cb (patch)
tree7f92d1839d1a3cd79a5522118f55fc3d4115d0cb /contrib
parent3a164601a15bc5d6c4cd507bff402e0c60b3af3a (diff)
Imported Upstream version 1.28.0
Diffstat (limited to 'contrib')
-rw-r--r--contrib/CMakeLists.txt1
-rw-r--r--contrib/convert/CMakeLists.txt9
-rw-r--r--contrib/convert/makeconverttable.c42
3 files changed, 52 insertions, 0 deletions
diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
index 23c5823..9e5880d 100644
--- a/contrib/CMakeLists.txt
+++ b/contrib/CMakeLists.txt
@@ -91,3 +91,4 @@ endif (INSTALL_LSB_INIT)
# Build some examples
# We do not install them intentionally, just check whether they still compile
add_subdirectory(smscgi)
+add_subdirectory(convert)
diff --git a/contrib/convert/CMakeLists.txt b/contrib/convert/CMakeLists.txt
new file mode 100644
index 0000000..3cea524
--- /dev/null
+++ b/contrib/convert/CMakeLists.txt
@@ -0,0 +1,9 @@
+project (Gammu-contrib-convert C)
+
+include(GammuTuneCompiler)
+
+# We use Gammu
+include_directories("${Gammu_BINARY_DIR}/include")
+
+add_executable(makeconverttable "makeconverttable.c")
+target_link_libraries(makeconverttable libGammu)
diff --git a/contrib/convert/makeconverttable.c b/contrib/convert/makeconverttable.c
new file mode 100644
index 0000000..b3d398b
--- /dev/null
+++ b/contrib/convert/makeconverttable.c
@@ -0,0 +1,42 @@
+/**
+ * Simple tool to create conversion table
+ */
+
+#include <gammu.h>
+
+int main(int argc, char *argv[])
+{
+ unsigned char InputBuffer[10000], Buffer[10000];
+ FILE *file;
+ int size, i, j = 0;
+
+ if (argc != 2) {
+ printf("Usage: makeconverttable FILE\n");
+ return 1;
+ }
+
+ file = fopen(argv[1], "rb");
+ if (file == NULL) {
+ printf("Failed to open file: %s\n", argv[1]);
+ return 2;
+ }
+ size = fread(InputBuffer, 1, 10000 - 1, file);
+ fclose(file);
+
+ InputBuffer[size] = 0;
+ InputBuffer[size + 1] = 0;
+
+ ReadUnicodeFile(Buffer, InputBuffer);
+
+ for (i = 0; i < ((int)UnicodeLength(Buffer)); i++) {
+ j++;
+ if (j == 100) {
+ printf("\"\\\n\"");
+ j = 0;
+ }
+ printf("\\x%02x\\x%02x", Buffer[i * 2], Buffer[i * 2 + 1]);
+ }
+ printf("\\x00\\x00");
+ return 0;
+}
+