Bug fix: Missing or empty parameter with -dus was interpreted as "*" rather than "."

This commit is contained in:
Thomas Schmitt 2013-07-05 16:40:46 +00:00
parent b8b7bca113
commit cf24917670
3 changed files with 25 additions and 14 deletions

View File

@ -315,19 +315,27 @@ logfile_wrong_form:;
/* Options -ls alias -lsi and -lsl alias -lsli /* Options -ls alias -lsi and -lsl alias -lsli
and -lsd alias -lsdi and -lsdl alias -lsdli and -lsd alias -lsdi and -lsdl alias -lsdli
and -du alias -dui and -dus alias -dusi and -du alias -dui and -dus alias -dusi
@param flag bit0= long format (-lsl , -du) @param flag bit0= long format (-lsl , -du, not -dus, not -ls)
bit1= do not expand patterns but use literally bit1= do not expand patterns but use literally
bit2= du rather than ls bit2= -du rather than -ls
bit3= list directories as themselves (ls -d) bit3= list directories as themselves (-lsd)
*/ */
int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv, int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag) int *idx, int flag)
{ {
int ret, end_idx, filec= 0, nump, i; int ret, end_idx, filec= 0, nump, i, star= 1;
char **filev= NULL, **patterns= NULL; char **filev= NULL, **patterns= NULL;
off_t mem= 0; off_t mem= 0;
struct stat stbuf; struct stat stbuf;
if(flag & 4) {
if(!(flag & 1))
star= 0;
} else {
if(flag & 8)
star= 0;
}
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
if(xorriso->do_iso_rr_pattern==0) if(xorriso->do_iso_rr_pattern==0)
flag|= 2; flag|= 2;
@ -357,19 +365,22 @@ no_memory:;
{ret= -1; goto ex;} {ret= -1; goto ex;}
} }
nump= 1; nump= 1;
if(flag&8) if(star)
patterns[0]= ".";
else
patterns[0]= "*"; patterns[0]= "*";
else
patterns[0]= ".";
flag&= ~2; flag&= ~2;
} else { } else {
patterns= calloc(nump, sizeof(char *)); patterns= calloc(nump, sizeof(char *));
if(patterns==NULL) if(patterns==NULL)
goto no_memory; goto no_memory;
for(i= 0; i<nump; i++) { for(i= 0; i<nump; i++) {
if(argv[i + *idx][0]==0) if(argv[i + *idx][0]==0) {
patterns[i]= "*"; if(star)
else patterns[i]= "*";
else
patterns[i]= ".";
} else
patterns[i]= argv[i + *idx]; patterns[i]= argv[i + *idx];
} }
} }

View File

@ -1597,10 +1597,10 @@ int Xorriso_option_logfile(struct XorrisO *xorriso, char *channel,
/* Command -ls alias -lsi and -lsl alias -lsli /* Command -ls alias -lsi and -lsl alias -lsli
and -lsd alias -lsdi and -lsdl alias -lsdli and -lsd alias -lsdi and -lsdl alias -lsdli
and -du alias -dui and -dus alias -dusi and -du alias -dui and -dus alias -dusi
@param flag bit0= long format (-lsl , -du) @param flag bit0= long format (-lsl , -du, not -dus, not -ls)
bit1= do not expand patterns but use literally bit1= do not expand patterns but use literally
bit2= du rather than ls bit2= -du rather than -ls
bit3= list directories as themselves (ls -d) bit3= list directories as themselves (-lsd)
*/ */
int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv, int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag); int *idx, int flag);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.07.05.072400" #define Xorriso_timestamP "2013.07.05.164001"