summaryrefslogtreecommitdiff
path: root/src/examples/eio
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-31 23:45:24 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-31 23:45:24 +0000
commit014cd8065decd6d6245c273b869e007fb38709f2 (patch)
tree2610ecce3367be96b22a321ffd2d2679d94227d8 /src/examples/eio
parent43eb232d3801e0eae845615dafadb0a3ebf55cb9 (diff)
efl/eio: use eina_file_copy()
SVN revision: 81944
Diffstat (limited to 'src/examples/eio')
-rw-r--r--src/examples/eio/Makefile.am16
-rw-r--r--src/examples/eio/eio_file_copy.c52
2 files changed, 66 insertions, 2 deletions
diff --git a/src/examples/eio/Makefile.am b/src/examples/eio/Makefile.am
index ad4f901625..950f1eca90 100644
--- a/src/examples/eio/Makefile.am
+++ b/src/examples/eio/Makefile.am
@@ -12,7 +12,9 @@ AM_CPPFLAGS = \
12-I$(top_builddir)/src/lib/ecore \ 12-I$(top_builddir)/src/lib/ecore \
13-I$(top_builddir)/src/lib/eio 13-I$(top_builddir)/src/lib/eio
14 14
15EXTRA_PROGRAMS = eio_file_ls 15EXTRA_PROGRAMS = \
16eio_file_ls \
17eio_file_copy
16 18
17eio_file_ls_SOURCES = eio_file_ls.c 19eio_file_ls_SOURCES = eio_file_ls.c
18eio_file_ls_LDADD = \ 20eio_file_ls_LDADD = \
@@ -23,8 +25,18 @@ $(top_builddir)/src/lib/eet/libeet.la \
23$(top_builddir)/src/lib/eina/libeina.la \ 25$(top_builddir)/src/lib/eina/libeina.la \
24@EIO_LDFLAGS@ 26@EIO_LDFLAGS@
25 27
28eio_file_copy_SOURCES = eio_file_copy.c
29eio_file_copy_LDADD = \
30$(top_builddir)/src/lib/eio/libeio.la \
31$(top_builddir)/src/lib/eo/libeo.la \
32$(top_builddir)/src/lib/ecore/libecore.la \
33$(top_builddir)/src/lib/eet/libeet.la \
34$(top_builddir)/src/lib/eina/libeina.la \
35@EIO_LDFLAGS@
36
26SRCS = \ 37SRCS = \
27eio_file_ls 38eio_file_ls.c \
39eio_file_copy.c
28 40
29examples: $(EXTRA_PROGRAMS) 41examples: $(EXTRA_PROGRAMS)
30 42
diff --git a/src/examples/eio/eio_file_copy.c b/src/examples/eio/eio_file_copy.c
new file mode 100644
index 0000000000..7704cfcac7
--- /dev/null
+++ b/src/examples/eio/eio_file_copy.c
@@ -0,0 +1,52 @@
1/**
2 * Compile with gcc -o eio_file_copy eio_file_copy.c `pkg-config --cflags --libs ecore eio`
3 */
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8#include <Eio.h>
9#include <Ecore.h>
10
11static void
12_progress_cb(void *data EINA_UNUSED, Eio_File *handle EINA_UNUSED, const Eio_Progress *info)
13{
14 printf("progress: %5lld/%lld (%3.0f%%)\n", info->current, info->max,
15 info->percent);
16}
17
18static void
19_done_cb(void *data EINA_UNUSED, Eio_File *handle EINA_UNUSED)
20{
21 puts("Successfully finished copy");
22 ecore_main_loop_quit();
23}
24
25static void
26_error_cb(void *data EINA_UNUSED, Eio_File *handle EINA_UNUSED, int error)
27{
28 fprintf(stderr, "Something wrong has happend:%s\n", strerror(error));
29 ecore_main_loop_quit();
30}
31
32int
33main(int argc, char **argv)
34{
35 if (argc != 3)
36 {
37 fprintf(stderr, "Usage: %s <src> <dst>\n", argv[0]);
38 return EXIT_FAILURE;
39 }
40
41 ecore_init();
42 eio_init();
43
44 eio_file_copy(argv[1], argv[2], _progress_cb, _done_cb, _error_cb, NULL);
45
46 ecore_main_loop_begin();
47
48 eio_shutdown();
49 ecore_shutdown();
50
51 return 0;
52}