summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/rcgen.cc71
1 files changed, 39 insertions, 32 deletions
diff --git a/plugingui/rcgen.cc b/plugingui/rcgen.cc
index 5eb3a4c..a30f7b4 100644
--- a/plugingui/rcgen.cc
+++ b/plugingui/rcgen.cc
@@ -29,43 +29,50 @@
int main(int argc, char *argv[])
{
- printf("/* This file is autogenerated by rcgen. Do not modify! */\n");
- printf("#include \"resource_data.h\"\n");
- printf("\n");
- printf("const rc_data_t rc_data[] =\n");
+ printf("/* This file is autogenerated by rcgen. Do not modify! */\n");
+ printf("#include \"resource_data.h\"\n");
+ printf("\n");
+ printf("const rc_data_t rc_data[] =\n");
printf("{\n");
- int i = 1;
- while(i < argc) {
- printf(" { \":%s\", ", argv[i]);
-
- std::string data;
- FILE *fp = fopen(argv[i], "rb");
- if(!fp) {
- fprintf(stderr, "Could not read file '%s' - quitting\n", argv[i]);
- return 1;
- }
+ int i = 1;
+ while(i < argc)
+ {
+ printf(" {\n \":%s\", ", argv[i]);
- char buf[32];
- while(!feof(fp)) {
- size_t sz = fread(buf, 1, sizeof(buf), fp);
- data.append(buf, sz);
- }
- fclose(fp);
+ std::string data;
+ FILE *fp = fopen(argv[i], "rb");
+ if(!fp)
+ {
+ fprintf(stderr, "Could not read file '%s' - quitting\n", argv[i]);
+ return 1;
+ }
- printf("%d,\n \"", (int)data.length());
- for(size_t j = 0; j < data.length(); j++) {
- if(j != 0 && j % 16 == 0) printf("\"\n \"");
- printf("\\%o", (unsigned char)data[j]);
- }
+ char buf[32];
+ while(!feof(fp))
+ {
+ std::size_t sz = fread(buf, 1, sizeof(buf), fp);
+ data.append(buf, sz);
+ }
+ fclose(fp);
- printf("\" },\n");
-
- i++;
- }
+ printf("%d,\n \"", (int)data.length());
+ for(std::size_t j = 0; j < data.length(); ++j)
+ {
+ if((j != 0) && (j % 16) == 0)
+ {
+ printf("\"\n \"");
+ }
+ printf("\\%o", (unsigned char)data[j]);
+ }
-printf(" { \"\", 0, 0 }\n");
-printf("};\n");
+ printf("\"\n },\n");
- return 0;
+ ++i;
+ }
+
+ printf(" { \"\", 0, 0 }\n");
+ printf("};\n");
+
+ return 0;
}