Implemented option -path-list

This commit is contained in:
Thomas Schmitt 2007-10-24 10:54:43 +00:00
parent d275669f03
commit dbd99babd9
3 changed files with 45 additions and 7 deletions

View File

@ -3099,6 +3099,7 @@ int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag)
/* Option -add */
/* @param flag bit0=do not report the added item */
int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
@ -3143,6 +3144,7 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
goto ex;
sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
(ret>1 ? "directory" : "file"), target, source);
if(!(flag&1))
Xorriso_info(xorriso, 0);
}
ret= 1;
@ -4219,11 +4221,46 @@ int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag)
/* Option -path-list */
int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
{
int ret,linecount= 0, insertcount= 0, null= 0;
FILE *fp= NULL;
char *argpt, sfe[4*SfileadrL],line[SfileadrL];
fprintf(stderr, ">>> XORRISO : read pathspecs from %s\n", adr);
fprintf(stderr, ">>> LIBISOFS : insert pathspecs into ISO tree\n");
return(1);
if(adr[0]==0) {
sprintf(xorriso->info_text,"Empty file name given with -path-list");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
fp= Afile_fopen(adr,"rb",((!!xorriso->packet_output)<<6));
if(fp==NULL)
return(0);
while(1) {
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
ret= 1;
if(ferror(fp))
ret= 0;
break;
}
linecount++;
if(line[0]==0)
continue;
argpt= line;
null= 0;
ret= Xorriso_option_add(xorriso, 1, &argpt, &null, 1);
if(ret<=0)
goto ex;
insertcount++;
}
ret= 1;
ex:;
if(ret<=0) {
sprintf(xorriso->info_text, "Aborted reading of file %s in line number %d",
Text_shellsafe(adr, sfe, 0), linecount);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
}
sprintf(xorriso->info_text, "Added %d items from file %s\n",
insertcount, Text_shellsafe(adr, sfe, 0));
Xorriso_info(xorriso,0);
return(ret);
}

View File

@ -122,6 +122,7 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag);
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag);
/* Option -add */
/* @param flag bit0=do not report the added item */
int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.24.100156"
#define Xorriso_timestamP "2007.10.24.105424"