Enabled osirrox of more file types, curbed with device files

This commit is contained in:
2008-05-24 09:25:26 +00:00
parent 69fd5ff008
commit 6ba4b25045
5 changed files with 205 additions and 50 deletions

View File

@ -3823,8 +3823,10 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
is_default= !(xorriso->allow_restore);
sprintf(line,"-osirrox %s\n", xorriso->allow_restore ? "on" : "off");
is_default= (xorriso->allow_restore==0);
sprintf(line,"-osirrox %s\n",
xorriso->allow_restore ? xorriso->allow_restore==2 ? "device_files" : "on"
: "off");
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -5996,7 +5998,8 @@ int Xorriso__mode_to_perms(mode_t st_mode, char perms[10], int flag)
int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag)
{
char *rpt, perms[10];
int show_major_minor= 0;
char *rpt, perms[10], mm_text[80];
mode_t st_mode;
rpt= xorriso->result_line;
@ -6009,11 +6012,13 @@ int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag)
strcat(rpt, "-");
else if(S_ISLNK(st_mode))
strcat(rpt, "l");
else if(S_ISBLK(st_mode))
else if(S_ISBLK(st_mode)) {
strcat(rpt, "b");
else if(S_ISCHR(st_mode))
show_major_minor= 1;
} else if(S_ISCHR(st_mode)) {
strcat(rpt, "c");
else if(S_ISFIFO(st_mode))
show_major_minor= 1;
} else if(S_ISFIFO(st_mode))
strcat(rpt, "p");
else if(S_ISSOCK(st_mode))
strcat(rpt, "s");
@ -6027,7 +6032,12 @@ int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag)
sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_uid);
sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_gid);
sprintf(rpt+strlen(rpt), "%8.f ", (double) stbuf->st_size);
if(show_major_minor) {
sprintf(mm_text, "%d,%d", (int) ((stbuf->st_rdev>>8)&0xfff),
(int) (((stbuf->st_rdev&~0xfffff)>>12) | (stbuf->st_rdev&0xff)));
sprintf(rpt+strlen(rpt), "%8s ", mm_text);
} else
sprintf(rpt+strlen(rpt), "%8.f ", (double) stbuf->st_size);
Ftimetxt(stbuf->st_mtime, rpt+strlen(rpt), 0);
strcat(rpt, " ");
@ -7975,7 +7985,7 @@ int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag)
if(ret<=0)
return(2);
if(strcmp(mode, "as_needed")==0)
if(strcmp(mode, "as_needed")==0 || mode[0]==0)
as_needed= 1;
else if(strcmp(mode, "all")==0 || strcmp(mode, "full")==0)
mode_flag= 0;
@ -8008,9 +8018,7 @@ unusable_index:;
if(idx<0 || idx>255)
goto unusable_index;
mode_flag|= (idx<<8);
} else if(mode[0]==0)
mode_flag= !(flag&1);
else {
} else {
sprintf(xorriso->info_text,
"%s: Unknown %s mode '%s'",
cmd, ((flag&1) ? "-format" : "-blank"), mode);
@ -8658,7 +8666,7 @@ int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv,
if(ret==3 || (flag&1))
continue;
sprintf(xorriso->info_text,
"Copied from ISO image to disk: %s '%s'='%s'\n",
"Copied from ISO image to disk: %s '%s' = '%s'\n",
(ret>1 ? "directory" : "file"), eff_origin, eff_dest);
Xorriso_info(xorriso, 0);
continue; /* regular bottom of loop */
@ -8669,8 +8677,9 @@ problem_handler:;
continue;
goto ex;
}
Xorriso_pacifier_callback(xorriso, "files copied", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
if(xorriso->pacifier_count>0)
Xorriso_pacifier_callback(xorriso, "files copied", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
ret= !was_failure;
ex:;
Xorriso_opt_args(xorriso, "-cpx",
@ -9589,12 +9598,12 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Like -compare but affecting all files below directories.",
"",
"Restore options (copying file objects from ISO image to disk filesystem):",
" -osirrox \"on\"|\"off\"",
" -osirrox \"on\"|\"device_files\"|\"off\"",
" By default \"off\" the inverse operation of xorriso from ISO",
" image to disk filesystem is disabled. \"on\" allows xorriso",
" to create, overwrite, delete files in the disk filesystem.",
" -cpx iso_rr_path [***] disk_path",
" Copy regular files from ISO image to disk filesystem.",
" Copy leaf file objects from ISO image to disk filesystem.",
"",
"Compatibility emulation (argument list may be ended by --):",
" -as mkisofs [-help|-o|-R|-J|-V|-P|-f|-graft-points|-path-list|pathspecs]",
@ -10473,6 +10482,8 @@ int Xorriso_option_osirrox(struct XorrisO *xorriso, char *mode, int flag)
{
if(strcmp(mode, "off")==0)
xorriso->allow_restore= 0;
else if(strcmp(mode, "device_files")==0)
xorriso->allow_restore= 2;
else if(strcmp(mode, "on")==0 || mode[0]==0)
xorriso->allow_restore= 1;
else {