X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=examples%2Fcapturewim.c;h=ae99acb4d5651151965799ab4f7fbfcaeabc8d7e;hb=3a803d0087d51ea3caa80378bbae615fa45537c5;hp=ecc6b83cbc42aa41d27b4897a4a187aac2990ff0;hpb=629719b7d5cad7fc6f2eca7ca11cb99100ed8764;p=wimlib diff --git a/examples/capturewim.c b/examples/capturewim.c index ecc6b83c..ae99acb4 100644 --- a/examples/capturewim.c +++ b/examples/capturewim.c @@ -1,13 +1,41 @@ /* * capturewim.c - A program to capture a directory tree into a WIM file. * - * The author dedicates this file to the public domain. - * You can do whatever you want with this file. + * The following copying information applies to this specific source code file: + * + * Written in 2014-2016 by Eric Biggers + * + * To the extent possible under law, the author(s) have dedicated all copyright + * and related and neighboring rights to this software to the public domain + * worldwide via the Creative Commons Zero 1.0 Universal Public Domain + * Dedication (the "CC0"). + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the CC0 for more details. + * + * You should have received a copy of the CC0 along with this software; if not + * see . */ #include #include +/* + * Windows compatibility defines for string encoding. Applications using wimlib + * that need to run on both UNIX and Windows will need to do something similar + * to this, whereas applications that only need to run on one or the other can + * just use their platform's convention directly. + */ +#ifdef _WIN32 +# define main wmain + typedef wchar_t tchar; +# define TS "ls" +#else + typedef char tchar; +# define TS "s" +#endif + #define TO_PERCENT(numerator, denominator) \ ((float)(((denominator) == 0) ? 0 : ((numerator) * 100 / (float)(denominator)))) @@ -27,12 +55,12 @@ write_progress(enum wimlib_progress_msg msg, return WIMLIB_PROGRESS_STATUS_CONTINUE; } -int main(int argc, char **argv) +int main(int argc, tchar **argv) { int ret; WIMStruct *wim = NULL; - const char *srcdir; - const char *wimpath; + const tchar *srcdir; + const tchar *wimpath; /* Check for the correct number of arguments. */ if (argc != 3) { @@ -75,8 +103,8 @@ out: /* Check for error status. */ if (ret != 0) { - fprintf(stderr, "wimlib error %d: %s\n", - ret, wimlib_get_error_string(ret)); + fprintf(stderr, "wimlib error %d: %" TS"\n", + ret, wimlib_get_error_string((enum wimlib_error_code)ret)); } /* Free global memory (optional). */