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 ) )
136 if( out_attrib ==
NULL )
137 out_attrib = &tmp_attrib;
151 if( strchr( filespec->
data,
'*' ) || strchr( filespec->
data,
'?' ) )
155 p = strrchr( filespec->
data,
'/' );
158 strncpy( ctx->filespec, p + 1,
MAX_PATH );
160 len = (p - filespec->
data) + 1;
163 memcpy( ctx->dirname, filespec->
data, len );
164 ctx->dirname[len] =
'\0';
170 strcpy( ctx->dirname,
"./");
174 if( (!strcmp( ctx->filespec,
"*.*" )) || (!strcmp( ctx->filespec,
"*." )) )
175 strcpy( ctx->filespec,
"*" );
177 if( (attrib & 0x10) == 0 )
180 ctx->dir = opendir( ctx->dirname );
191 if( !stat( filespec->
data, &info ) )
194 if( (tmp_attrib & ~attrib ) == 0 )
196 name = strrchr( filespec->
data,
'/' );
198 name = filespec->
data;
201 *out_attrib = tmp_attrib;
217 len = strlen( name );