New command -file_name_limit, -as mkisofs -file_name_limit
This commit is contained in:
@ -648,6 +648,25 @@ int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *iso_rr_path,
|
||||
}
|
||||
|
||||
|
||||
/* Command -file_name_limit */
|
||||
int Xorriso_option_file_name_limit(struct XorrisO *xorriso, char *value,
|
||||
int flag)
|
||||
{
|
||||
int ret;
|
||||
double num;
|
||||
|
||||
num= Scanf_io_size(value, 0);
|
||||
if(num < 64 || num > 255) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-file_name_limit: Value '%s' out of range [64..255]", value);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
ret= Xorriso_set_file_name_limit(xorriso, (int) num, 0);
|
||||
return(ret > 0);
|
||||
}
|
||||
|
||||
|
||||
/* Option -file_size_limit */
|
||||
int Xorriso_option_file_size_limit(struct XorrisO *xorriso,
|
||||
int argc, char **argv, int *idx, int flag)
|
||||
@ -702,6 +721,23 @@ static int Xorriso_determine_name_space(struct XorrisO *xorriso,
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int Xorriso_truncate_const_find_name(struct XorrisO *xorriso,
|
||||
char *expr, char *buffer,
|
||||
char **namept, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
*namept= expr;
|
||||
ret= Xorriso_truncate_path_comps(xorriso, expr, buffer, namept, 1);
|
||||
if(ret < 0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-find[ix]: cannot truncate constant -name to -file_name_limit: ");
|
||||
Text_shellsafe(expr, xorriso->info_text, 1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Option -find alias -findi, and -findx */
|
||||
/* @param flag bit0= -findx rather than -findi
|
||||
@ -720,7 +756,7 @@ int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
||||
struct FindjoB *job, *first_job= NULL, *new_job;
|
||||
char *start_path, *path= NULL, *cpt, *other_path_start= NULL, *cd_pt;
|
||||
char *access_acl_text= NULL, *default_acl_text= NULL, *list_extattr_mode;
|
||||
char *arg1_pt;
|
||||
char *arg1_pt, *namept;
|
||||
|
||||
struct stat dir_stbuf;
|
||||
uid_t user= 0;
|
||||
@ -756,7 +792,10 @@ not_enough_arguments:;
|
||||
goto sorry_ex;
|
||||
}
|
||||
i++;
|
||||
ret= Findjob_set_name_expr(job, argv[i], 0);
|
||||
ret= Xorriso_truncate_const_find_name(xorriso, argv[i], path, &namept, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
ret= Findjob_set_name_expr(job, namept, 0);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text, "-find[ix]: cannot set -name expression ");
|
||||
Text_shellsafe(argv[i], xorriso->info_text, 1);
|
||||
@ -766,7 +805,10 @@ not_enough_arguments:;
|
||||
if(i+1>=end_idx)
|
||||
goto not_enough_arguments;
|
||||
i++;
|
||||
ret= Findjob_set_name_expr(job, argv[i], 1);
|
||||
ret= Xorriso_truncate_const_find_name(xorriso, argv[i], path, &namept, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
ret= Findjob_set_name_expr(job, namept, 1);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-find[ix]: cannot set -wholename expression ");
|
||||
@ -1863,6 +1905,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
||||
" -pathspecs \"on\"|\"off\" Allow or disallow pathspecs of form ",
|
||||
" iso_rr_path=disk_path . Only \"off\" allows eventual",
|
||||
" -disk_pattern expansion.",
|
||||
" -file_name_limit number",
|
||||
" Set truncation size for file names [64 ... 255].",
|
||||
" -file_size_limit value [...]",
|
||||
" Set limit for file content size. One or more numbers to add.",
|
||||
" -add pathspec [...] | disk_path [***]",
|
||||
" Insert the given files or directory trees from",
|
||||
" filesystem into the ISO image. Much like mkisofs.",
|
||||
|
Reference in New Issue
Block a user