A simple program that lists collections in files, can take multiple files as

arguments and an optional -o <outfile>.


SVN revision: 7616
This commit is contained in:
rbdpngn 2003-10-16 07:02:31 +00:00 committed by rbdpngn
parent d2010dac48
commit dae9b3b757
4 changed files with 119 additions and 1 deletions

View File

@ -1,4 +1,5 @@
usr/bin/edje_cc
usr/bin/edje_ls
usr/share/edje/data/src/*.edc
usr/share/edje/data/images/*.png
usr/share/edje/data/*.sh

View File

@ -70,6 +70,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{prefix}/lib/libedje.la
%attr(755,root,root) %{prefix}/bin/edje
%attr(755,root,root) %{prefix}/bin/edje_cc
%attr(755,root,root) %{prefix}/bin/edje_ls
%attr(755,root,root) %{prefix}/share/edje
%files devel

View File

@ -12,7 +12,7 @@ INCLUDES = \
@my_includes@ \
@imlib2_includes@
bin_PROGRAMS = edje edje_cc
bin_PROGRAMS = edje edje_cc edje_ls
edje_SOURCES = \
edje_main.c \
@ -43,3 +43,13 @@ edje_cc_LDFLAGS =
edje_cc_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
edje_ls_SOURCES = \
edje_ls.c
edje_ls_LDADD = \
$(top_builddir)/src/lib/libedje.la
edje_ls_LDFLAGS =
edje_ls_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la

View File

@ -0,0 +1,106 @@
#include "Edje.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *file_out = NULL;
char *progname = NULL;
Evas_List *collections = NULL;
static void
main_help(void)
{
printf("Usage: "
"%s [OPTIONS] input_file.eet ...\n"
"\t-o outfile.txt Output the listing of the collections to a file\n"
, progname);
}
void
test_list(char *file)
{
Evas_List *entries;
entries = edje_file_collection_list(file);
if (entries)
{
Evas_List *l;
for (l = entries; l; l = l->next)
{
char *name;
Evas_Object *o;
char buf[1024];
name = l->data;
snprintf(buf, 1024, "%s: %s", file, name);
collections = evas_list_append(collections, strdup(buf));
}
edje_file_collection_list_free(entries);
}
}
int main(int argc, char **argv)
{
int i;
Evas_List *l;
FILE *output;
progname = argv[0];
if (argc < 2)
{
main_help();
exit(0);
}
edje_init();
for (i = 1; i < argc; i++)
{
if (!strcmp(argv[i], "-h"))
{
main_help();
exit(0);
}
else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
{
i++;
file_out = argv[i];
}
else
{
test_list(argv[i]);
}
}
if (!collections)
{
main_help();
exit(0);
}
if (file_out)
{
output = fopen(file_out, "w");
if (!output)
{
perror("fopen");
main_help();
exit(1);
}
}
else
output = stdout;
while (collections)
{
char *name;
name = collections->data;
collections = evas_list_remove(collections, name);
fprintf(output, "%s\n", name);
free(name);
}
return 0;
}