summaryrefslogtreecommitdiff
path: root/src/tools/genunicode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/genunicode.c')
-rw-r--r--src/tools/genunicode.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/tools/genunicode.c b/src/tools/genunicode.c
new file mode 100644
index 0000000..0329ace
--- /dev/null
+++ b/src/tools/genunicode.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2026 Peter Mikkelsen <petermikkelsen10@gmail.com>
+ *
+ * This file is part of aplwc.
+ *
+ * Aplwc is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Aplwc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with aplwc. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+static char *files[] = {
+ "DerivedCoreProperties.txt",
+ "PropList.txt"
+};
+
+int
+main(int argc, char *argv[])
+{
+ FILE *f;
+ char *dir, *buf;
+ size_t dir_size, tmp_size, max_size, i, nfiles;
+
+ assert(argc == 2);
+ dir = argv[1];
+ dir_size = strlen(dir);
+
+ if(dir[dir_size-1] == '/')
+ dir_size--;
+
+ nfiles = sizeof(files)/sizeof(files[0]);
+
+ max_size = 0;
+ for(i = 0; i < nfiles; i++){
+ tmp_size = strlen(files[i]);
+ if(tmp_size > max_size)
+ max_size = tmp_size;
+ }
+ max_size += dir_size + 2;
+ buf = malloc(max_size);
+ assert(buf != NULL);
+ memcpy(buf, dir, dir_size);
+ buf[dir_size] = '/';
+
+ for(i = 0; i < sizeof(files)/sizeof(files[0]); i++){
+ memcpy(buf+dir_size+1, files[i], strlen(files[i])+1);
+ f = fopen(buf, "r");
+ assert(f != NULL);
+ fclose(f);
+
+ printf("/* Unicode file %s read from %s */\n", files[i], buf);
+ }
+
+ return 0;
+}