MCPcopy Create free account
hub / github.com/boostorg/build / path_parse

Function path_parse

v2/engine/pathsys.c:51–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 */
50
51void path_parse( char const * file, PATHNAME * f )
52{
53 char const * p;
54 char const * q;
55 char const * end;
56
57 memset( (char *)f, 0, sizeof( *f ) );
58
59 /* Look for '<grist>'. */
60
61 if ( ( file[ 0 ] == '<' ) && ( p = strchr( file, '>' ) ) )
62 {
63 f->f_grist.ptr = file;
64 f->f_grist.len = p - file;
65 file = p + 1;
66 }
67
68 /* Look for 'dir/'. */
69
70 p = strrchr( file, '/' );
71
72#if PATH_DELIM == '\\'
73 /* On NT, look for dir\ as well */
74 {
75 char * const p1 = strrchr( p ? p + 1 : file, '\\' );
76 if ( p1 ) p = p1;
77 }
78#endif
79
80 if ( p )
81 {
82 f->f_dir.ptr = file;
83 f->f_dir.len = p - file;
84
85 /* Special case for / - dirname is /, not "" */
86 if ( !f->f_dir.len )
87 ++f->f_dir.len;
88
89#if PATH_DELIM == '\\'
90 /* Special case for D:/ - dirname is D:/, not "D:" */
91 if ( f->f_dir.len == 2 && file[ 1 ] == ':' )
92 ++f->f_dir.len;
93#endif
94
95 file = p + 1;
96 }
97
98 end = file + strlen( file );
99
100 /* Look for '(member)'. */
101 if ( ( p = strchr( file, '(' ) ) && ( end[ -1 ] == ')' ) )
102 {
103 f->f_member.ptr = p + 1;
104 f->f_member.len = end - p - 2;
105 end = p;
106 }
107
108 /* Look for '.suffix'. This would be memrchr(). */

Callers 5

builtin_glob_backFunction · 0.85
glob_recursiveFunction · 0.85
set_explicit_bindingFunction · 0.85
searchFunction · 0.85
var_edit_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected