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

Function path_parse

src/engine/pathsys.c:52–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 6

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