2 * Copyright (C) ARM Limited 2010-2014. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
10 * The Makefile in the daemon folder builds and executes 'escape'
11 * 'escape' creates configuration_xml.h from configuration.xml and events_xml.h from events-*.xml
12 * these genereated xml files are then #included and built as part of the gatord binary
21 static void print_escaped_path(char *path) {
25 for (; *path != '\0'; ++path) {
26 printf("%c", isalnum(*path) ? *path : '_');
30 int main(int argc, char *argv[]) {
37 for (i = 1; i < argc && argv[i][0] == '-'; ++i) ;
39 fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
45 if ((in = fopen(path, "r")) == NULL) {
46 fprintf(stderr, "Unable to open '%s': %s\n", path, strerror(errno));
50 printf("static const unsigned char ");
51 print_escaped_path(path);
61 // Write out a null character after the contents of the file but do not increment len
62 printf(" 0x%.2x", (ch == EOF ? 0 : ch));
68 printf("\n};\nstatic const unsigned int ");
69 print_escaped_path(path);
70 printf("_len = %i;\n", len);