forked from AravisProject/aravis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharvziptest.c
56 lines (44 loc) · 1.24 KB
/
arvziptest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <arv.h>
#include <stdlib.h>
static char **arv_option_filenames = NULL;
static char *arv_option_debug_domains;
static const GOptionEntry arv_option_entries[] =
{
{ G_OPTION_REMAINING, ' ', 0, G_OPTION_ARG_FILENAME_ARRAY,
&arv_option_filenames, NULL, NULL},
{ "debug", 'd', 0, G_OPTION_ARG_STRING,
&arv_option_debug_domains, "Debug mode", NULL },
{ NULL }
};
int
main (int argc, char **argv)
{
ArvZip *zip;
char *buffer;
size_t size;
GOptionContext *context;
GError *error = NULL;
int i;
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, arv_option_entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error)) {
g_option_context_free (context);
g_print ("Option parsing failed: %s\n", error->message);
g_error_free (error);
return EXIT_FAILURE;
}
g_option_context_free (context);
arv_debug_enable (arv_option_debug_domains);
if (arv_option_filenames == NULL) {
g_print ("Missing input filename.\n");
return EXIT_FAILURE;
}
for (i = 0; arv_option_filenames[i] != NULL; i++) {
g_file_get_contents (arv_option_filenames[i], &buffer, &size, NULL);
if (buffer != NULL) {
zip = arv_zip_new (buffer, size);
arv_zip_free (zip);
}
}
return EXIT_SUCCESS;
}