]> wimlib.net Git - wimlib/blob - examples/applywim.c
write_integrity_table(): Fix use of uninitialized variable
[wimlib] / examples / applywim.c
1 /*
2  * applywim.c - A simple program to extract all images from a WIM file to a
3  * directory.
4  */
5
6 #include <wimlib.h>
7 #include <stdio.h>
8
9 int main(int argc, char **argv)
10 {
11         int ret;
12         WIMStruct *wim;
13
14         if (argc != 3) {
15                 fprintf(stderr, "Usage: applywim WIM DIR\n");
16                 ret = 2;
17                 goto out;
18         }
19
20         /* Initialize the library. */
21         ret = wimlib_global_init(0);
22         if (ret)
23                 goto out;
24
25         /* Open the WIM file. */
26         ret = wimlib_open_wim(argv[1], 0, &wim, NULL);
27         if (ret)
28                 goto out_wimlib_global_cleanup;
29
30         /* Extract all the images. */
31         ret = wimlib_extract_image(wim, WIMLIB_ALL_IMAGES, argv[2], 0, NULL);
32
33         /* Free the WIM file */
34         wimlib_free(wim);
35
36 out_wimlib_global_cleanup:
37         /* Finalize the library */
38         wimlib_global_cleanup();
39 out:
40         return ret;
41 }