summaryrefslogtreecommitdiff
path: root/src/examples/eio/eio_file_copy.c
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/eio_file_copy.c
parent43eb232d3801e0eae845615dafadb0a3ebf55cb9 (diff)
efl/eio: use eina_file_copy()
SVN revision: 81944
Diffstat (limited to '')
-rw-r--r--src/examples/eio/eio_file_copy.c52
1 files changed, 52 insertions, 0 deletions
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}