summaryrefslogtreecommitdiff
path: root/src/bin/eet
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-10-31 05:58:50 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-10-31 05:58:50 +0000
commitcf8a61527f02646f54de348b25ae8b457ef4ab27 (patch)
tree6ee0c6881bbbaae600f28bc06e7e6eff73ac7025 /src/bin/eet
parent0ca47806af120962ec3318b760253cf437131281 (diff)
efl: backport r78689.
SVN revision: 78690
Diffstat (limited to 'src/bin/eet')
-rw-r--r--src/bin/eet/eet_main.c56
1 files changed, 45 insertions, 11 deletions
diff --git a/src/bin/eet/eet_main.c b/src/bin/eet/eet_main.c
index 8a93d11..eff7207 100644
--- a/src/bin/eet/eet_main.c
+++ b/src/bin/eet/eet_main.c
@@ -44,11 +44,12 @@ static int _eet_main_log_dom = -1;
44#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_main_log_dom, __VA_ARGS__) 44#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_main_log_dom, __VA_ARGS__)
45 45
46static void 46static void
47do_eet_list(const char *file) 47do_eet_list(const char *file, Eina_Bool verbose)
48{ 48{
49 int i, num; 49 Eina_Iterator *it;
50 char **list; 50 Eet_Entry *entry;
51 Eet_File *ef; 51 Eet_File *ef;
52 unsigned long long total = 0;
52 53
53 ef = eet_open(file, EET_FILE_MODE_READ); 54 ef = eet_open(file, EET_FILE_MODE_READ);
54 if (!ef) 55 if (!ef)
@@ -57,12 +58,38 @@ do_eet_list(const char *file)
57 exit(-1); 58 exit(-1);
58 } 59 }
59 60
60 list = eet_list(ef, "*", &num); 61 it = eet_list_entries(ef);
61 if (list) 62 EINA_ITERATOR_FOREACH(it, entry)
62 { 63 {
63 for (i = 0; i < num; i++) 64 if (verbose)
64 printf("%s\n", list[i]); 65 {
65 free(list); 66 if (entry->alias)
67 {
68 printf("%s is an alias for %s\n",
69 entry->name, eet_alias_get(ef, entry->name));
70 }
71 else
72 {
73 if (entry->compression)
74 printf("%s start at %i with a size of %i Bytes with an uncompressed size of %i Bytes.\n",
75 entry->name, entry->offset, entry->size, entry->data_size);
76 else
77 printf("%s start at %i with a size of %i Bytes.\n",
78 entry->name, entry->offset, entry->size);
79 total += entry->size;
80 }
81 }
82 else
83 {
84 printf("%s\n", entry->name);
85 }
86 }
87 eina_iterator_free(it);
88
89 if (verbose)
90 {
91 printf("*** ***\n");
92 printf("Total payload size : %lli.\n", total);
66 } 93 }
67 94
68 eet_close(ef); 95 eet_close(ef);
@@ -415,7 +442,7 @@ main(int argc,
415help: 442help:
416 printf( 443 printf(
417 "Usage:\n" 444 "Usage:\n"
418 " eet -l FILE.EET list all keys in FILE.EET\n" 445 " eet -l [-v] FILE.EET list all keys in FILE.EET\n"
419 " eet -x FILE.EET KEY [OUT-FILE] [CRYPTO_KEY] extract data stored in KEY in FILE.EET and write to OUT-FILE or standard output\n" 446 " eet -x FILE.EET KEY [OUT-FILE] [CRYPTO_KEY] extract data stored in KEY in FILE.EET and write to OUT-FILE or standard output\n"
420 " eet -d FILE.EET KEY [OUT-FILE] [CRYPTO_KEY] extract and decode data stored in KEY in FILE.EET and write to OUT-FILE or standard output\n" 447 " eet -d FILE.EET KEY [OUT-FILE] [CRYPTO_KEY] extract and decode data stored in KEY in FILE.EET and write to OUT-FILE or standard output\n"
421 " eet -i FILE.EET KEY IN-FILE COMPRESS [CRYPTO_KEY] insert data to KEY in FILE.EET from IN-FILE and if COMPRESS is 1, compress it\n" 448 " eet -i FILE.EET KEY IN-FILE COMPRESS [CRYPTO_KEY] insert data to KEY in FILE.EET from IN-FILE and if COMPRESS is 1, compress it\n"
@@ -431,8 +458,15 @@ help:
431 458
432 if ((!strncmp(argv[1], "-h", 2))) 459 if ((!strncmp(argv[1], "-h", 2)))
433 goto help; 460 goto help;
434 else if ((!strcmp(argv[1], "-l")) && (argc > 2)) 461 else if (((!strcmp(argv[1], "-l")) || (!strcmp(argv[1], "-v"))) && (argc > 2))
435 do_eet_list(argv[2]); 462 {
463 if (argc == 3)
464 do_eet_list(argv[2], EINA_FALSE);
465 else if ((!strcmp(argv[2], "-l")) || (!strcmp(argv[2], "-v")))
466 do_eet_list(argv[3], EINA_TRUE);
467 else
468 goto help;
469 }
436 else if ((!strcmp(argv[1], "-x")) && (argc > 3)) 470 else if ((!strcmp(argv[1], "-x")) && (argc > 3))
437 { 471 {
438 switch (argc) 472 switch (argc)