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

@ -526,7 +526,8 @@ int Xorriso_write_to_channel(struct XorrisO *xorriso,
bit0= eventually backslash encode linefeeds
bit1= text is the name of the log file for the given channel
bit2= text is the name of the consolidated packet log file for all channels
bit15= with bit1 or bit2: close depicted log file
bit3= text is the name of the stderr redirection file
bit15= with bit1 to bit3: close depicted log file
*/
{
char *rpt, *npt, *text= NULL;
@ -559,6 +560,10 @@ bit15= with bit1 or bit2: close depicted log file
fclose(pktlog_fp);
xorriso->pktlog_fp= pktlog_fp= NULL;
}
if((flag & 8) && xorriso->stderr_fp != NULL) {
fclose(xorriso->stderr_fp);
xorriso->stderr_fp= NULL;
}
if(flag&(1<<15))
{ret= 1; goto ex;}
if((flag&2)) {
@ -579,7 +584,13 @@ bit15= with bit1 or bit2: close depicted log file
Sfile_datestr(time(0),1|2|256));
fflush(pktlog_fp);
}
if(flag&(2|4))
if(flag & 8) {
truncate(text, (off_t) 0);
xorriso->stderr_fp= fopen(text, "a");
if(xorriso->stderr_fp == NULL)
{ret= 0; goto ex;}
}
if(flag & (2| 4 | 8))
{ret= 1; goto ex;}
/* Eventually perform backslash encoding of non-printable characters */
@ -628,8 +639,13 @@ bit15= with bit1 or bit2: close depicted log file
printf("%s",text);
fflush(stdout);
}
if(channel_no==2 || channel_no==3)
fprintf(stderr,"%s",text);
if(channel_no==2 || channel_no==3) {
if(xorriso->stderr_fp != NULL) {
fprintf(xorriso->stderr_fp, "%s", text);
fflush(xorriso->stderr_fp);
} else
fprintf(stderr, "%s", text);
}
if(logfile_fp!=NULL) {
fprintf(logfile_fp,"%s",text);
fflush(logfile_fp);