New -as mkisofs option -log-file

This commit is contained in:
2012-04-11 16:32:21 +00:00
parent 44b653d79b
commit 1d184f9276
8 changed files with 100 additions and 26 deletions

View File

@ -831,6 +831,7 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
" --old-root-no-md5 Do not record and use MD5 with -old-root",
" --old-root-no-ino Do not use disk inode numbers with -old-root",
" --old-root-devno Use disk device numbers with -old-root",
" -log-file LOG_FILE Re-direct messages to LOG_FILE",
" --no_rc Do not execute startup files",
" -v, -verbose Verbose",
" -version Print the current version",
@ -985,6 +986,35 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
Xorriso_alloc_meM(indev, char, SfileadrL+8);
Xorriso_alloc_meM(old_root, char, SfileadrL);
for(i= 0; i<argc; i++) {
if(strcmp(argv[i], "-log-file") == 0 ||
strcmp(argv[i], "--log-file") == 0 ) {
if(i + 1 >= argc)
goto not_enough_args;
i+= 1;
if(argv[i][0]) {
sprintf(xorriso->info_text, "re-directing all messages to %s\n",
argv[i]);
Xorriso_info(xorriso, 0);
}
ret= Xorriso_write_to_channel(xorriso, argv[i], 2,
8 | ((argv[i][0] == 0) << 15));
if(ret <= 0) {
sprintf(xorriso->info_text, "Cannot open logfile: %s", argv[i]);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno * (ret == 0),
"SORRY", 0);
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret < 0)
{ret= 0; goto ex;}
}
if(argv[i][0] == 0) {
sprintf(xorriso->info_text, "Revoked stderr message redirection");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
}
}
strcpy(ra_text, xorriso->report_about_text);
weight_list= TSOB_FELD(int, (argc / 3) + 1);
@ -1181,6 +1211,8 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
} else if(strcmp(argpt, "--no-emul-toc")==0) {
with_emul_toc= 0;
xorriso->no_emul_toc|= 1;
} else if(strcmp(argpt, "-log-file") == 0) {
/* already handled before this loop */;
} else {
was_other_option= 1;
hargv[0]= argpt;
@ -1669,6 +1701,9 @@ rr_reloc_dir:;
goto problem_handler_2;
Xorriso_relax_compliance(xorriso, "deep_paths_off:long_paths_off", 0);
} else if(strcmp(argpt, "-log-file") == 0) {
/* was already handled before this loop */;
} else if(argpt[0]=='-' && argpt[1]!=0) {
hargv[0]= argpt;
ret= Xorriso_genisofs_count_args(xorriso, argc - i, hargv, &count, 1);