/* * Copyright (C) 2026 Peter Mikkelsen * * 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 . */ #include #include #include #include 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; }