aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eet/src/bin/eet_main.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/eet/src/bin/eet_main.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/libraries/eet/src/bin/eet_main.c b/libraries/eet/src/bin/eet_main.c
index 0d577ad..8a93d11 100644
--- a/libraries/eet/src/bin/eet_main.c
+++ b/libraries/eet/src/bin/eet_main.c
@@ -69,6 +69,63 @@ do_eet_list(const char *file)
69} /* do_eet_list */ 69} /* do_eet_list */
70 70
71static void 71static void
72do_eet_stats(const char *file)
73{
74 int i, num;
75 int count[2] = { 0, 0 };
76 int size[2] = { 0, 0 };
77 char **list;
78 Eet_File *ef;
79 Eet_Dictionary *ed;
80
81 ef = eet_open(file, EET_FILE_MODE_READ);
82 if (!ef)
83 {
84 ERR("cannot open for reading: %s", file);
85 exit(-1);
86 }
87
88 printf("*** sections stats ***\n");
89 list = eet_list(ef, "*", &num);
90 if (list)
91 {
92 for (i = 0; i < num; i++)
93 {
94 const void *ro = NULL;
95 void *rw = NULL;
96 int tsize;
97
98 ro = eet_read_direct(ef, list[i], &tsize);
99 if (!ro) rw = eet_read(ef, list[i], &tsize);
100 printf(rw ? "%s of size %i is compressed.\n" : "%s of size %i is not compressed.\n", list[i], tsize);
101 count[rw ? 0 : 1]++;
102 size[rw ? 0 : 1] += tsize;
103 free(rw);
104 }
105 free(list);
106 }
107
108 printf("*** dictionary ***\n");
109 ed = eet_dictionary_get(ef);
110 if (ed)
111 {
112 printf("%i strings inside the dictionary.\n", eet_dictionary_count(ed));
113 }
114 else
115 {
116 printf("no dictionary in this file.\n");
117 }
118 printf("*** global ***\n");
119 printf("%i sections\n", num);
120 printf("- %i of them are compressed (%02.2f%%) expanding in %i bytes.\n",
121 count[0], (float) count[0] * 100 / (float) num, size[0]);
122 printf("- %i of them are directly mappable in memory (%02.2f%%) representing %i bytes.\n",
123 count[1], (float) count[1] * 100 / (float) num, size[1]);
124
125 eet_close(ef);
126}
127
128static void
72do_eet_extract(const char *file, 129do_eet_extract(const char *file,
73 const char *key, 130 const char *key,
74 const char *out, 131 const char *out,
@@ -366,6 +423,7 @@ help:
366 " eet -r FILE.EET KEY remove KEY in FILE.EET\n" 423 " eet -r FILE.EET KEY remove KEY in FILE.EET\n"
367 " eet -c FILE.EET report and check the signature information of an eet file\n" 424 " eet -c FILE.EET report and check the signature information of an eet file\n"
368 " eet -s FILE.EET PRIVATE_KEY PUBLIC_KEY sign FILE.EET with PRIVATE_KEY and attach PUBLIC_KEY as it's certificate\n" 425 " eet -s FILE.EET PRIVATE_KEY PUBLIC_KEY sign FILE.EET with PRIVATE_KEY and attach PUBLIC_KEY as it's certificate\n"
426 " eet -t FILE.EET give some statistic about a file\n"
369 ); 427 );
370 eet_shutdown(); 428 eet_shutdown();
371 return -1; 429 return -1;
@@ -437,6 +495,8 @@ help:
437 do_eet_check(argv[2]); 495 do_eet_check(argv[2]);
438 else if ((!strcmp(argv[1], "-s")) && (argc > 4)) 496 else if ((!strcmp(argv[1], "-s")) && (argc > 4))
439 do_eet_sign(argv[2], argv[3], argv[4]); 497 do_eet_sign(argv[2], argv[3], argv[4]);
498 else if ((!strcmp(argv[1], "-t")) && (argc > 2))
499 do_eet_stats(argv[2]);
440 else 500 else
441 goto help; 501 goto help;
442 502