[UPDATE] =
T(
IMAGEX_PROGNAME" update WIMFILE IMAGE [--check] [--rebuild]\n"
-" [--threads=NUM_THREADS] [DEFAULT_ADD_OPTIONS]\n"
-" [DEFAULT_DELETE_OPTIONS] [< CMDFILE]\n"
-" ... where each CMD is:\n"
-" add [--unix-data] [--no-acls] [--strict-acls] [--dereference]\n"
-" [--verbose] FILE_OR_DIRECTORY DEST_WIM_PATH\n"
-" delete [--force] [--recursive] WIM_PATH\n"
-" rename SRC_PATH_IN_WIM DEST_PATH_IN_WIM\n"
+" [--threads=NUM_THREADS] [DEFAULT_ADD_OPTIONS]\n"
+" [DEFAULT_DELETE_OPTIONS] < CMDFILE\n"
),
};
recommend_man_page(const tchar *cmd_name)
{
#ifdef __WIN32__
- tprintf(T("\nSee "IMAGEX_PROGNAME"-%"TS".pdf in the "
+ tprintf(T("See "IMAGEX_PROGNAME"-%"TS".pdf in the "
"doc directory for more details.\n"),
cmd_name);
#else
- tprintf(T("\nTry `man "IMAGEX_PROGNAME"-%"TS"' "
+ tprintf(T("Try `man "IMAGEX_PROGNAME"-%"TS"' "
"for more details.\n"), cmd_name);
#endif
}
}
static struct wimlib_extract_command *
-prepare_extract_commands(tchar **argv, int argc, int extract_flags,
- tchar *dest_dir, size_t *num_cmds_ret)
+prepare_extract_commands(tchar **paths, unsigned num_paths,
+ int extract_flags, tchar *dest_dir,
+ size_t *num_cmds_ret)
{
struct wimlib_extract_command *cmds;
size_t num_cmds;
tchar *emptystr = T("");
- if (argc == 0) {
- argc = 1;
- argv = &emptystr;
+ if (num_paths == 0) {
+ num_paths = 1;
+ paths = &emptystr;
}
- num_cmds = argc;
+ num_cmds = num_paths;
cmds = calloc(num_cmds, sizeof(cmds[0]));
if (!cmds) {
imagex_error(T("Out of memory!"));
for (size_t i = 0; i < num_cmds; i++) {
cmds[i].extract_flags = extract_flags;
- cmds[i].wim_source_path = argv[i];
- if (is_root_wim_path(argv[i])) {
+ cmds[i].wim_source_path = paths[i];
+ if (is_root_wim_path(paths[i])) {
cmds[i].fs_dest_path = dest_dir;
} else {
- size_t len = tstrlen(dest_dir) + 1 + tstrlen(argv[i]);
+ size_t len = tstrlen(dest_dir) + 1 + tstrlen(paths[i]);
cmds[i].fs_dest_path = malloc((len + 1) * sizeof(tchar));
if (!cmds[i].fs_dest_path) {
free_extract_commands(cmds, num_cmds, dest_dir);
return NULL;
}
tsprintf(cmds[i].fs_dest_path, T("%"TS"/%"TS), dest_dir,
- tbasename(argv[i]));
+ tbasename(paths[i]));
}
}
*num_cmds_ret = num_cmds;
imagex_be_quiet = true;
break;
default:
- usage(EXTRACT);
- ret = -1;
- goto out;
+ goto out_usage;
}
}
argc -= optind;
argv += optind;
- if (argc < 2) {
- usage(EXTRACT);
- ret = -1;
- goto out;
- }
+ if (argc < 2)
+ goto out_usage;
+
wimfile = argv[0];
image_num_or_name = argv[1];
free_extract_commands(cmds, num_cmds, dest_dir);
out:
return ret;
+out_usage:
+ usage(EXTRACT);
+ ret = -1;
+ goto out;
}
/* Prints information about a WIM file; also can mark an image as bootable,
/* Read update commands from standard input */
if (isatty(STDIN_FILENO)) {
tputs(T("Reading update commands from standard input..."));
+ recommend_man_page(T("update"));
}
cmd_file_contents = stdin_get_text_contents(&cmd_file_nchars);
if (!cmd_file_contents) {
tprintf(T("Usage:\n%"TS), usage_strings[cmd_type]);
for_imagex_command(cmd) {
if (cmd->cmd == cmd_type) {
+ tputc(T('\n'), stdout);
recommend_man_page(cmd->name);
}
}