blob: cdd84254399a66e3b68ed9b0190ae475c7486877 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// { dg-do compile }
static bool st_IsPathDelimiter( char c ) { return c == '/'; }
bool IsValidPath( char const * filename )
{
if ( !filename || filename[0] == 0 )
return false;
char const * run = filename;
while ( run && *run )
{
if ( run[0] == '.' )
if ( run[1] != '.' || ( !st_IsPathDelimiter( run[2] ) && run[2] != 0 ) )
return false;
while ( *run && !st_IsPathDelimiter( *run ) )
++run;
if ( *run )
++run;
}
}
|