28 if( info->st_uid == geteuid() )
30 else if( info->st_gid == getegid() )
35 if( (info->st_mode & mask) == 0 )
41 if( S_ISCHR( info->st_mode ) || S_ISBLK( info->st_mode ) || S_ISFIFO( info->st_mode ) || S_ISSOCK( info->st_mode ) )
44 if( S_ISDIR( info->st_mode ) )
60 while( ( *spec ) || ( *name ) )
67 while( ( *name != *spec ) && ( *name ) )
80 if( ( any ) && ( *name ) )
102 struct dirent *entry;
107 entry = readdir( ctx->dir );
113 name = entry->d_name;
114 strcpy( buffer, ctx->dirname );
115 strncat( buffer, name,
MAX_PATH - strlen( buffer ) - 1 );
118 if( stat( buffer, &info ) )
137 if( out_attrib ==
NULL )
138 out_attrib = &tmp_attrib;
152 if( strchr( filespec->
data,
'*' ) || strchr( filespec->
data,
'?' ) )
156 p = strrchr( filespec->
data,
'/' );
159 strncpy( ctx->filespec, p + 1,
MAX_PATH );
161 len = (p - filespec->
data) + 1;
164 memcpy( ctx->dirname, filespec->
data, len );
165 ctx->dirname[len] =
'\0';
171 strcpy( ctx->dirname,
"./");
175 if( (!strcmp( ctx->filespec,
"*.*" )) || (!strcmp( ctx->filespec,
"*." )) )
176 strcpy( ctx->filespec,
"*" );
178 if( (attrib & 0x10) == 0 )
181 ctx->dir = opendir( ctx->dirname );
192 if( !stat( filespec->
data, &info ) )
195 if( (tmp_attrib & ~attrib ) == 0 )
197 name = strrchr( filespec->
data,
'/' );
199 name = filespec->
data;
202 *out_attrib = tmp_attrib;
218 len = strlen( name );