globfree(&FIter->Glob);
FIter->NextGlob=0;
}
- /*
- * Try every pattern until the list is exhausted or a real error
- * occurs or a file is matched.
- */
- while ((Path=FileListIter_NextWithMask(FIter))!=NULL)
+ Path=FileListIter_NextWithMask(FIter);
+ if (Path!=NULL && (Path[0]!='-' || Path[1]!='\0'))
{
int ErrCode=glob(Path,GLOB_ERR | GLOB_NOSORT,NULL,&FIter->Glob);
- if (ErrCode==0)//success
- {
- Path=FIter->Glob.gl_pathv[0];
- FIter->NextGlob=1;
- break;
- }
- if (ErrCode!=GLOB_NOMATCH)
+ if (ErrCode!=0)
{
switch (ErrCode)
{
case GLOB_ABORTED:
debuga(__FILE__,__LINE__,_("Read error while listing the files matching \"%s\"\n"),Path);
break;
+ case GLOB_NOMATCH:
+ debuga(__FILE__,__LINE__,_("No files matching \"%s\"\n"),Path);
+ break;
+ default:
+ debuga(__FILE__,__LINE__,_("Failed to glob file pattern \"%s\" with unspecified error code %d"),Path,ErrCode);
+ break;
}
exit(EXIT_FAILURE);
}
+ Path=FIter->Glob.gl_pathv[0];
+ FIter->NextGlob=1;
}
#else
/*