diff --git a/test/xorriso.c b/test/xorriso.c index c29641f1..e7bf8a9b 100644 --- a/test/xorriso.c +++ b/test/xorriso.c @@ -4062,6 +4062,8 @@ much_too_long:; 1|2|((flag&8)>>1)); if(ret<=0) return(ret); + if(norm_adr[0]==0) + strcpy(norm_adr, "/"); strcpy(adr, norm_adr); } return(1); @@ -5870,40 +5872,10 @@ int Xorriso_option_alter_date(struct XorrisO *xorriso, int optc= 0; char **optv= NULL; -#ifdef NIX - - if(strcmp(time_type, "a")==0) - t_type|= 1; - else if(strcmp(time_type, "m")==0) - t_type|= 4; - else if(strcmp(time_type, "b")==0) - t_type|= 5; - else { - sprintf(xorriso->info_text, "-alter_date: Unrecognized type '%s'", - time_type); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - ret= 0; goto ex; - } - ret= Decode_timestring(timestring, &t, 0); - if(ret<=0) { - sprintf(xorriso->info_text, "-alter_date: Cannot decode timestring '%s'", - timestring); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - ret= 0; goto ex; - } - sprintf(xorriso->info_text, "Understanding timestring '%s' as: %s", - timestring, ctime(&t)); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); - -#else /* NIX */ - ret= Xorriso_convert_datestring(xorriso, "-alter_date", time_type, timestring, &t_type, &t, 0); if(ret<=0) goto ex; - -#endif /* ! NIX */ - ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 0); if(ret<=0) goto ex; @@ -6151,6 +6123,8 @@ ex:; /* Option -chmod alias -chmodi */ +/* @param flag bit0=recursive +*/ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode, int argc, char **argv, int *idx, int flag) { @@ -6158,127 +6132,43 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode, mode_t mode_and= ~0, mode_or= 0; int optc= 0; char **optv= NULL; - -#ifdef NIX - - char sfe[5*SfileadrL], *mpt, *opt, *vpt; - unsigned int num; - int who_val= 0; - mode_t mode_val, mask; - - - if(mode[0]=='0') { - mode_and= 0; - sscanf(mode,"%o",&num); - mode_or= num; - } else if(strchr(mode,'+')!=NULL || strchr(mode,'-')!=NULL - || strchr(mode,'=')!=NULL) { - /* [ugoa][+-][rwxst] */; - for(mpt= mode; mpt!=NULL; mpt= strchr(mpt, ',')) { - if(*mpt==',') - mpt++; - if(strlen(mpt)<3) - goto unrecognizable; - who_val= 0; - for(vpt= mpt; *vpt!='+' && *vpt!='-' && *vpt!='='; vpt++) { - if(*vpt=='u') - who_val|= 4; - else if(*vpt=='g') - who_val|= 2; - else if(*vpt=='o') - who_val|= 1; - else if(*vpt=='a') - who_val|= 7; - else - goto unrecognizable; - } - opt= vpt; - mode_val= 0; - for(vpt= opt+1; *vpt!=0 && *vpt!=','; vpt++) { - if(*vpt=='r') { - if(who_val&4) - mode_val|= S_IRUSR; - if(who_val&2) - mode_val|= S_IRGRP; - if(who_val&1) - mode_val|= S_IROTH; - } else if(*vpt=='w') { - if(who_val&4) - mode_val|= S_IWUSR; - if(who_val&2) - mode_val|= S_IWGRP; - if(who_val&1) - mode_val|= S_IWOTH; - } else if(*vpt=='x') { - if(who_val&4) - mode_val|= S_IXUSR; - if(who_val&2) - mode_val|= S_IXGRP; - if(who_val&1) - mode_val|= S_IXOTH; - } else if(*vpt=='s') { - if(who_val&4) - mode_val|= S_ISUID; - if(who_val&2) - mode_val|= S_ISGID; - } else if(*vpt=='t') { - if(who_val&1) - mode_val|= S_ISVTX; - } else - goto unrecognizable; - } - if(*opt=='+') { - mode_or|= mode_val; - } else if(*opt=='=') { - mask= 0; - if(who_val&1) - mask|= S_IRWXO|S_ISVTX; - if(who_val&2) - mask|= S_IRWXG|S_ISGID; - if(who_val&4) - mask|= S_IRWXU|S_ISUID; - mode_and&= ~(mask); - mode_or= (mode_or & ~mask) | mode_val; - } else if(*opt=='-') { - mode_or&= ~mode_val; - mode_and&= ~mode_val; - } - } - } else { -unrecognizable:; - sprintf(xorriso->info_text, - "-chmodi: Unrecognizable or faulty permission mode %s\n", - Text_shellsafe(mode, sfe, 0)); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - ret= 0; goto ex; - } - -#else /* NIX */ + struct FindjoB *job= NULL; + struct stat dir_stbuf; ret= Xorriso_convert_modstring(xorriso, "-chmodi", mode, &mode_and, &mode_or, 0); if(ret<=0) goto ex; - -#endif /* ! NIX */ - ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 0); if(ret<=0) goto ex; for(i= 0; i>> Xorriso_no_findjob(xorriso, "-chmod_r", 0); */ + + goto ex; + } + Findjob_set_action_chmod(job, mode_and, mode_or, 0); + ret= Xorriso_findi(xorriso, job, NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else { + ret= Xorriso_set_st_mode(xorriso, optv[i], mode_and, mode_or, 0); + } if(ret>0 && !xorriso->request_to_abort) continue; /* regular bottom of loop */ was_failure= 1; fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); - if(fret>=0) - continue; - goto ex; + if(fret<0) + goto ex; } ret= 1; ex:; (*idx)= end_idx; - Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256); /* clean up */ + Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256); + Findjob_destroy(&job, 0); if(ret<=0) return(ret); return(!was_failure); @@ -6439,18 +6329,6 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag) return(0); } -#ifdef NIX - if((flag&3)==0 || xorriso->in_drive_handle == xorriso->out_drive_handle) - flag|= 3; - - if((flag&3)!=3) { - /* <<< for now only -dev */; - fprintf(stderr, ">>> XORRISO : would execute -%sdev %s\n", - ((flag&3)==1 ? "in" : ((flag&3)==2 ? "out" : "")), adr); - return(1); - } -#endif - if(xorriso->volset_change_pending && (flag&1)) { sprintf(xorriso->info_text, "%s: Image changes pending. -commit or -rollback first", diff --git a/test/xorriso_timestamp.h b/test/xorriso_timestamp.h index 9b8dc271..964a73a2 100644 --- a/test/xorriso_timestamp.h +++ b/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.12.30.203336" +#define Xorriso_timestamP "2007.12.31.095229" diff --git a/test/xorrisoburn.c b/test/xorrisoburn.c index cc561787..eb37a917 100644 --- a/test/xorrisoburn.c +++ b/test/xorrisoburn.c @@ -2857,7 +2857,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job, } else { sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0)); Xorriso_result(xorriso, 0); - ret= 0; + ret= 1; } return(ret); }