diff options
Diffstat (limited to 'libraries/eet/src/bin')
-rw-r--r-- | libraries/eet/src/bin/Makefile.am | 2 | ||||
-rw-r--r-- | libraries/eet/src/bin/Makefile.in | 6 | ||||
-rw-r--r-- | libraries/eet/src/bin/eet_main.c | 60 |
3 files changed, 66 insertions, 2 deletions
diff --git a/libraries/eet/src/bin/Makefile.am b/libraries/eet/src/bin/Makefile.am index ba7d67e..89c68f1 100644 --- a/libraries/eet/src/bin/Makefile.am +++ b/libraries/eet/src/bin/Makefile.am | |||
@@ -17,5 +17,5 @@ EXTRA_PROGRAMS = eet | |||
17 | 17 | ||
18 | eet_SOURCES = eet_main.c | 18 | eet_SOURCES = eet_main.c |
19 | eet_CFLAGS = @EET_CFLAGS@ | 19 | eet_CFLAGS = @EET_CFLAGS@ |
20 | eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ | 20 | eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ @EXOTIC_LIBS@ |
21 | eet_LDFLAGS = @lt_enable_auto_import@ | 21 | eet_LDFLAGS = @lt_enable_auto_import@ |
diff --git a/libraries/eet/src/bin/Makefile.in b/libraries/eet/src/bin/Makefile.in index 4a899f5..a7e94cb 100644 --- a/libraries/eet/src/bin/Makefile.in +++ b/libraries/eet/src/bin/Makefile.in | |||
@@ -138,6 +138,8 @@ EINA_LIBS = @EINA_LIBS@ | |||
138 | EVIL_CFLAGS = @EVIL_CFLAGS@ | 138 | EVIL_CFLAGS = @EVIL_CFLAGS@ |
139 | EVIL_LIBS = @EVIL_LIBS@ | 139 | EVIL_LIBS = @EVIL_LIBS@ |
140 | EXEEXT = @EXEEXT@ | 140 | EXEEXT = @EXEEXT@ |
141 | EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ | ||
142 | EXOTIC_LIBS = @EXOTIC_LIBS@ | ||
141 | FGREP = @FGREP@ | 143 | FGREP = @FGREP@ |
142 | GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ | 144 | GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ |
143 | GNUTLS_LIBS = @GNUTLS_LIBS@ | 145 | GNUTLS_LIBS = @GNUTLS_LIBS@ |
@@ -177,6 +179,8 @@ PACKAGE_URL = @PACKAGE_URL@ | |||
177 | PACKAGE_VERSION = @PACKAGE_VERSION@ | 179 | PACKAGE_VERSION = @PACKAGE_VERSION@ |
178 | PATH_SEPARATOR = @PATH_SEPARATOR@ | 180 | PATH_SEPARATOR = @PATH_SEPARATOR@ |
179 | PKG_CONFIG = @PKG_CONFIG@ | 181 | PKG_CONFIG = @PKG_CONFIG@ |
182 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
183 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
180 | RANLIB = @RANLIB@ | 184 | RANLIB = @RANLIB@ |
181 | SED = @SED@ | 185 | SED = @SED@ |
182 | SET_MAKE = @SET_MAKE@ | 186 | SET_MAKE = @SET_MAKE@ |
@@ -259,7 +263,7 @@ AM_CPPFLAGS = \ | |||
259 | bin_PROGRAMS = @EET_PRG@ | 263 | bin_PROGRAMS = @EET_PRG@ |
260 | eet_SOURCES = eet_main.c | 264 | eet_SOURCES = eet_main.c |
261 | eet_CFLAGS = @EET_CFLAGS@ | 265 | eet_CFLAGS = @EET_CFLAGS@ |
262 | eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ | 266 | eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ @EXOTIC_LIBS@ |
263 | eet_LDFLAGS = @lt_enable_auto_import@ | 267 | eet_LDFLAGS = @lt_enable_auto_import@ |
264 | all: all-am | 268 | all: all-am |
265 | 269 | ||
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 | ||
71 | static void | 71 | static void |
72 | do_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 | |||
128 | static void | ||
72 | do_eet_extract(const char *file, | 129 | do_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 | ||