Changeset 45391 in vbox
- Timestamp:
- Apr 7, 2013 5:15:29 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
include/iprt/path.h (modified) (3 diffs)
-
src/VBox/Runtime/common/path/RTPathParse.cpp (modified) (1 diff)
-
src/VBox/Runtime/common/path/RTPathParse.cpp.h (modified) (6 diffs)
-
src/VBox/Runtime/common/path/rtpath-expand-template.cpp.h (modified) (5 diffs)
-
src/VBox/Runtime/testcase/tstRTPath.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/path.h
r45389 r45391 50 50 #endif 51 51 52 /** @def RTPATH_SLASH 53 * The preferred slash character. 54 * 55 * @remark IPRT will always accept unix slashes. So, normally you would 56 * never have to use this define. 57 */ 58 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 59 # define RTPATH_SLASH '\\' 60 #else 61 # define RTPATH_SLASH '/' 62 #endif 63 64 /** @deprecated Use '/'! */ 65 #define RTPATH_DELIMITER RTPATH_SLASH 66 67 68 /** @def RTPATH_SLASH_STR 69 * The preferred slash character as a string, handy for concatenations 70 * with other strings. 71 * 72 * @remark IPRT will always accept unix slashes. So, normally you would 73 * never have to use this define. 74 */ 75 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 76 # define RTPATH_SLASH_STR "\\" 77 #else 78 # define RTPATH_SLASH_STR "/" 79 #endif 80 81 82 /** @def RTPATH_IS_SLASH 83 * Checks if a character is a slash. 84 * 85 * @returns true if it's a slash and false if not. 86 * @returns @param ch Char to check. 87 */ 88 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 89 # define RTPATH_IS_SLASH(ch) ( (ch) == '\\' || (ch) == '/' ) 90 #else 91 # define RTPATH_IS_SLASH(ch) ( (ch) == '/' ) 92 #endif 93 94 95 /** @def RTPATH_IS_VOLSEP 96 * Checks if a character marks the end of the volume specification. 97 * 98 * @remark This is sufficient for the drive letter concept on PC. 99 * However it might be insufficient on other platforms 100 * and even on PC a UNC volume spec won't be detected this way. 101 * Use the RTPath@<too be created@>() instead. 102 * 103 * @returns true if it is and false if it isn't. 104 * @returns @param ch Char to check. 105 */ 106 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 107 # define RTPATH_IS_VOLSEP(ch) ( (ch) == ':' ) 108 #else 109 # define RTPATH_IS_VOLSEP(ch) (false) 110 #endif 111 112 113 /** @def RTPATH_IS_SEP 114 * Checks if a character is path component separator 115 * 116 * @returns true if it is and false if it isn't. 117 * @returns @param ch Char to check. 118 * @ 119 */ 120 #define RTPATH_IS_SEP(ch) ( RTPATH_IS_SLASH(ch) || RTPATH_IS_VOLSEP(ch) ) 121 122 123 /** @name Generic RTPath flags 52 53 /** @name RTPATH_F_XXX - Generic flags for APIs working on the file system. 124 54 * @{ */ 125 55 /** Last component: Work on the link. */ … … 132 62 /** @} */ 133 63 134 135 64 /** Validates a flags parameter containing RTPATH_F_*. 136 65 * @remarks The parameters will be referenced multiple times. */ 137 #define RTPATH_F_IS_VALID(fFlags, fIgnore) \ 138 ( ((fFlags) & ~(uint32_t)((fIgnore)|RTPATH_F_NO_SYMLINKS)) == RTPATH_F_ON_LINK \ 139 || ((fFlags) & ~(uint32_t)((fIgnore)|RTPATH_F_NO_SYMLINKS)) == RTPATH_F_FOLLOW_LINK ) 66 #define RTPATH_F_IS_VALID(a_fFlags, a_fIgnore) \ 67 ( ((a_fFlags) & ~(uint32_t)((a_fIgnore) | RTPATH_F_NO_SYMLINKS)) == RTPATH_F_ON_LINK \ 68 || ((a_fFlags) & ~(uint32_t)((a_fIgnore) | RTPATH_F_NO_SYMLINKS)) == RTPATH_F_FOLLOW_LINK ) 69 70 71 /** @name RTPATH_STR_F_XXX - Generic flags for APIs working with path strings. 72 * @{ 73 */ 74 /** Host OS path style (default 0 value). */ 75 #define RTPATH_STR_F_STYLE_HOST UINT32_C(0x00000000) 76 /** DOS, OS/2 and Windows path style. */ 77 #define RTPATH_STR_F_STYLE_DOS UINT32_C(0x00000001) 78 /** Unix path style. */ 79 #define RTPATH_STR_F_STYLE_UNIX UINT32_C(0x00000002) 80 /** Reserved path style. */ 81 #define RTPATH_STR_F_STYLE_RESERVED UINT32_C(0x00000003) 82 /** The path style mask. */ 83 #define RTPATH_STR_F_STYLE_MASK UINT32_C(0x00000003) 84 /** Partial path - no start. 85 * This causes the API to skip the root specification parsing. */ 86 #define RTPATH_STR_F_NO_START UINT32_C(0x00000010) 87 /** Partial path - no end. 88 * This causes the API to skip the filename and dir-slash parsing. */ 89 #define RTPATH_STR_F_NO_END UINT32_C(0x00000020) 90 /** Partial path - no start and no end. */ 91 #define RTPATH_STR_F_MIDDLE (RTPATH_STR_F_NO_START | RTPATH_STR_F_NO_END) 92 93 /** Reserved for future use. */ 94 #define RTPATH_STR_F_RESERVED_MASK UINT32_C(0x0000ffcc) 95 /** @} */ 96 97 /** Validates a flags parameter containing RTPATH_FSTR_. 98 * @remarks The parameters will be references multiple times. */ 99 #define RTPATH_STR_F_IS_VALID(a_fFlags, a_fIgnore) \ 100 ( ((a_fFlags) & ~((uint32_t)(a_fIgnore) | RTPATH_STR_F_STYLE_MASK | RTPATH_STR_F_MIDDLE)) == 0 \ 101 && ((a_fFlags) & RTPATH_STR_F_STYLE_MASK) != RTPATH_STR_F_STYLE_RESERVED \ 102 && ((a_fFlags) & RTPATH_STR_F_RESERVED_MASK) == 0 ) 103 104 105 /** @def RTPATH_STYLE 106 * The host path style. This is set to RTPATH_STR_F_STYLE_DOS, 107 * RTPATH_STR_F_STYLE_UNIX, or other future styles. */ 108 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 109 # define RTPATH_STYLE RTPATH_STR_F_STYLE_DOS 110 #else 111 # define RTPATH_STYLE RTPATH_STR_F_STYLE_UNIX 112 #endif 113 114 115 /** @def RTPATH_SLASH 116 * The preferred slash character. 117 * 118 * @remark IPRT will always accept unix slashes. So, normally you would 119 * never have to use this define. 120 */ 121 #if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 122 # define RTPATH_SLASH '\\' 123 #elif RTPATH_STYLE == RTPATH_STR_F_STYLE_UNIX 124 # define RTPATH_SLASH '/' 125 #else 126 # error "Unsupported RTPATH_STYLE value." 127 #endif 128 129 /** @deprecated Use '/'! */ 130 #define RTPATH_DELIMITER RTPATH_SLASH 131 132 133 /** @def RTPATH_SLASH_STR 134 * The preferred slash character as a string, handy for concatenations 135 * with other strings. 136 * 137 * @remark IPRT will always accept unix slashes. So, normally you would 138 * never have to use this define. 139 */ 140 #if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 141 # define RTPATH_SLASH_STR "\\" 142 #elif RTPATH_STYLE == RTPATH_STR_F_STYLE_UNIX 143 # define RTPATH_SLASH_STR "/" 144 #else 145 # error "Unsupported RTPATH_STYLE value." 146 #endif 147 148 149 /** @def RTPATH_IS_SLASH 150 * Checks if a character is a slash. 151 * 152 * @returns true if it's a slash and false if not. 153 * @returns @param a_ch Char to check. 154 */ 155 #if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 156 # define RTPATH_IS_SLASH(a_ch) ( (a_ch) == '\\' || (a_ch) == '/' ) 157 #elif RTPATH_STYLE == RTPATH_STR_F_STYLE_UNIX 158 # define RTPATH_IS_SLASH(a_ch) ( (a_ch) == '/' ) 159 #else 160 # error "Unsupported RTPATH_STYLE value." 161 #endif 162 163 164 /** @def RTPATH_IS_VOLSEP 165 * Checks if a character marks the end of the volume specification. 166 * 167 * @remark This is sufficient for the drive letter concept on PC. 168 * However it might be insufficient on other platforms 169 * and even on PC a UNC volume spec won't be detected this way. 170 * Use the RTPath@<too be created@>() instead. 171 * 172 * @returns true if it is and false if it isn't. 173 * @returns @param a_ch Char to check. 174 */ 175 #if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 176 # define RTPATH_IS_VOLSEP(a_ch) ( (a_ch) == ':' ) 177 #elif RTPATH_STYLE == RTPATH_STR_F_STYLE_UNIX 178 # define RTPATH_IS_VOLSEP(a_ch) (false) 179 #else 180 # error "Unsupported RTPATH_STYLE value." 181 #endif 182 183 184 /** @def RTPATH_IS_SEP 185 * Checks if a character is path component separator 186 * 187 * @returns true if it is and false if it isn't. 188 * @returns @param a_ch Char to check. 189 * @ 190 */ 191 #define RTPATH_IS_SEP(a_ch) ( RTPATH_IS_SLASH(a_ch) || RTPATH_IS_VOLSEP(a_ch) ) 140 192 141 193 … … 543 595 * @param cbParsed The size of the buffer. Must be at least the 544 596 * size of RTPATHPARSED. 545 * @param fFlags Combination of RTPATHPARSE_FLAGS_XXX that can be 546 * used to change how the start and end of the 547 * path is parsed. Most users will pass 0. 597 * @param fFlags Combination of RTPATH_STR_F_XXX flags. 598 * Most users will pass 0. 548 599 * @sa RTPathSplit, RTPathSplitA. 549 600 */ 550 601 RTDECL(int) RTPathParse(const char *pszPath, PRTPATHPARSED pParsed, size_t cbParsed, uint32_t fFlags); 551 552 /** @name RTPATHPARSE_FLAGS_XXX - RTPathParse flags.553 * @{ */554 /** Partial path - no start.555 * This causes RTPathParse to skip the root specification parsing. */556 #define RTPATHPARSE_FLAGS_NO_START RT_BIT_32(0)557 /** Partial path - no end.558 * This causes RTPathParse to skip the filename and dir-slash parsing. */559 #define RTPATHPARSE_FLAGS_NO_END RT_BIT_32(1)560 /** Partial path - no start and no end. */561 #define RTPATHPARSE_FLAGS_MIDDLE (RTPATHPARSE_FLAGS_NO_START | RTPATHPARSE_FLAGS_NO_END)562 563 /** Host OS path style. */564 #define RTPATHPARSE_FLAGS_STYLE_HOST UINT32_C(0x00000000)565 /** DOS, OS/2 and Windows path style. */566 #define RTPATHPARSE_FLAGS_STYLE_DOS UINT32_C(0x00000010)567 /** Unix path style. */568 #define RTPATHPARSE_FLAGS_STYLE_UNIX UINT32_C(0x00000020)569 /** Reserved path style. */570 #define RTPATHPARSE_FLAGS_STYLE_RESERVED UINT32_C(0x00000030)571 /** The path style mask. */572 #define RTPATHPARSE_FLAGS_STYLE_MASK UINT32_C(0x00000030)573 574 /** Mask containing the valid flags. */575 #define RTPATHPARSE_FLAGS_VALID_MASK UINT32_C(0x00000033)576 /** @} */577 602 578 603 /** -
trunk/src/VBox/Runtime/common/path/RTPathParse.cpp
r45390 r45391 50 50 AssertPtrReturn(pszPath, VERR_INVALID_POINTER); 51 51 AssertReturn(*pszPath, VERR_PATH_ZERO_LENGTH); 52 AssertReturn( !(fFlags & ~RTPATHPARSE_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);52 AssertReturn(RTPATH_STR_F_IS_VALID(fFlags, 0), VERR_INVALID_FLAGS); 53 53 54 54 /* 55 55 * Invoke the worker for the selected path style. 56 56 */ 57 switch (fFlags & RTPATH PARSE_FLAGS_STYLE_MASK)57 switch (fFlags & RTPATH_STR_F_STYLE_MASK) 58 58 { 59 59 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 60 case RTPATH PARSE_FLAGS_STYLE_HOST:60 case RTPATH_STR_F_STYLE_HOST: 61 61 #endif 62 case RTPATH PARSE_FLAGS_STYLE_DOS:62 case RTPATH_STR_F_STYLE_DOS: 63 63 return rtPathParseStyleDos(pszPath, pParsed, cbParsed, fFlags); 64 64 65 65 #if !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS) 66 case RTPATH PARSE_FLAGS_STYLE_HOST:66 case RTPATH_STR_F_STYLE_HOST: 67 67 #endif 68 case RTPATH PARSE_FLAGS_STYLE_UNIX:68 case RTPATH_STR_F_STYLE_UNIX: 69 69 return rtPathParseStyleUnix(pszPath, pParsed, cbParsed, fFlags); 70 70 71 71 default: 72 AssertFailedReturn(VERR_INVALID_FLAGS); 72 AssertFailedReturn(VERR_INVALID_FLAGS); /* impossible */ 73 73 } 74 74 } -
trunk/src/VBox/Runtime/common/path/RTPathParse.cpp.h
r45389 r45391 48 48 if (RTPATH_IS_SLASH(pszPath[0])) 49 49 { 50 if (fFlags & RTPATH PARSE_FLAGS_NO_START)50 if (fFlags & RTPATH_STR_F_NO_START) 51 51 { 52 52 offCur = 1; … … 58 58 cchPath = 0; 59 59 } 60 #if def RTPATH_STYLE_DOS60 #if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 61 61 else if ( RTPATH_IS_SLASH(pszPath[1]) 62 62 && !RTPATH_IS_SLASH(pszPath[2]) … … 84 84 else 85 85 { 86 #if def RTPATH_STYLE_DOS86 #if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 87 87 fProps = RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_RELATIVE; 88 88 #else … … 92 92 } 93 93 } 94 #if def RTPATH_STYLE_DOS94 #if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 95 95 else if (RT_C_IS_ALPHA(pszPath[0]) && pszPath[1] == ':') 96 96 { … … 115 115 116 116 /* Add it to the component array . */ 117 if (offCur && !(fFlags & RTPATH PARSE_FLAGS_NO_START))117 if (offCur && !(fFlags & RTPATH_STR_F_NO_START)) 118 118 { 119 119 cchPath = offCur; … … 192 192 if (ch) 193 193 { 194 if (!(fFlags & RTPATH PARSE_FLAGS_NO_END))194 if (!(fFlags & RTPATH_STR_F_NO_END)) 195 195 fProps |= RTPATH_PROP_DIR_SLASH; /* (not counted) */ 196 196 else 197 197 fProps |= RTPATH_PROP_EXTRA_SLASHES; 198 198 } 199 else if (!(fFlags & RTPATH PARSE_FLAGS_NO_END))199 else if (!(fFlags & RTPATH_STR_F_NO_END)) 200 200 { 201 201 fProps |= RTPATH_PROP_FILENAME; -
trunk/src/VBox/Runtime/common/path/rtpath-expand-template.cpp.h
r45389 r45391 26 26 */ 27 27 28 #undef RTPATH_DELIMITER 28 29 29 30 /* 30 * The following should move to a helper header!31 * DOS style 31 32 */ 32 #undef RTPATH_DELIMITER 33 34 /* DOS style */ 35 #undef RTPATH_STYLE_UNIX 36 #undef RTPATH_STYLE_DOS 33 #undef RTPATH_STYLE 34 #undef RTPATH_SLASH 37 35 #undef RTPATH_SLASH_STR 38 36 #undef RTPATH_IS_SLASH … … 40 38 #undef RTPATH_STYLE_FN 41 39 42 #define RTPATH_STYLE_DOS 40 #define RTPATH_STYLE RTPATH_STR_F_STYLE_DOS 41 #define RTPATH_SLASH '\\' 43 42 #define RTPATH_SLASH_STR "\\" 44 43 #define RTPATH_IS_SLASH(a_ch) ( (a_ch) == '\\' || (a_ch) == '/' ) … … 47 46 #include RTPATH_TEMPLATE_CPP_H 48 47 49 /* Unix style. */ 50 #undef RTPATH_STYLE_UNIX 51 #undef RTPATH_STYLE_DOS 48 /* 49 * Unix style. 50 */ 51 #undef RTPATH_STYLE 52 #undef RTPATH_SLASH 52 53 #undef RTPATH_SLASH_STR 53 54 #undef RTPATH_IS_SLASH … … 55 56 #undef RTPATH_STYLE_FN 56 57 57 #define RTPATH_STYLE_UNIX 58 #define RTPATH_STYLE RTPATH_STR_F_STYLE_UNIX 59 #define RTPATH_SLASH '/' 58 60 #define RTPATH_SLASH_STR "/" 59 61 #define RTPATH_IS_SLASH(a_ch) ( (a_ch) == '/' ) … … 62 64 #include RTPATH_TEMPLATE_CPP_H 63 65 64 /* Restore original style. */ 66 /* 67 * Clean up and restore the host style. 68 */ 65 69 #undef RTPATH_STYLE_FN 66 70 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 67 # undef RTPATH_STYLE_UNIX 68 # undef RTPATH_STYLE_DOS 71 # undef RTPATH_STYLE 69 72 # undef RTPATH_SLASH_STR 70 73 # undef RTPATH_IS_SLASH 71 74 # undef RTPATH_IS_VOLSEP 72 # define RTPATH_SLASH_STR "\\" 73 # define RTPATH_IS_SLASH(a_ch) ( (a_ch) == '\\' || (a_ch) == '/' ) 74 # define RTPATH_IS_VOLSEP(a_ch) ( (a_ch) == ':' ) 75 # define RTPATH_STYLE RTPATH_STR_F_STYLE_DOS 76 # define RTPATH_SLASH '\\' 77 # define RTPATH_SLASH_STR "\\" 78 # define RTPATH_IS_SLASH(a_ch) ( (a_ch) == '\\' || (a_ch) == '/' ) 79 # define RTPATH_IS_VOLSEP(a_ch) ( (a_ch) == ':' ) 75 80 #endif 76 81 -
trunk/src/VBox/Runtime/testcase/tstRTPath.cpp
r45389 r45391 53 53 } const s_aTests[] = 54 54 { 55 { 2, 13, 9, "C:/Config.sys", RTPATH_PROP_VOLUME | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH PARSE_FLAGS_STYLE_DOS },56 { 2, 13, 10, "C://Config.sys", RTPATH_PROP_VOLUME | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX | RTPATH_PROP_EXTRA_SLASHES, RTPATH PARSE_FLAGS_STYLE_DOS },57 { 2, 12, 8, "C:Config.sys", RTPATH_PROP_VOLUME | RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH PARSE_FLAGS_STYLE_DOS },58 { 1, 10, 6, "Config.sys", RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH PARSE_FLAGS_STYLE_DOS },59 { 1, 4, 4, "//./", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE, RTPATH PARSE_FLAGS_STYLE_DOS },60 { 2, 5, 5, "//./f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_DOS },61 { 2, 5, 6, "//.//f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_EXTRA_SLASHES, RTPATH PARSE_FLAGS_STYLE_DOS },62 { 3, 7, 7, "//././f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_DOT_REFS, RTPATH PARSE_FLAGS_STYLE_DOS },63 { 3, 8, 8, "//.././f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_DOT_REFS, RTPATH PARSE_FLAGS_STYLE_DOS },64 { 3, 9, 9, "//../../f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME | RTPATH_PROP_DOTDOT_REFS, RTPATH PARSE_FLAGS_STYLE_DOS },65 { 1, 1, 1, "/", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE, RTPATH PARSE_FLAGS_STYLE_UNIX },66 { 2, 4, 4, "/bin", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },67 { 2, 4, 5, "/bin/", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_DIR_SLASH, RTPATH PARSE_FLAGS_STYLE_UNIX },68 { 3, 7, 7, "/bin/ls", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },69 { 3, 12, 7, "/etc/rc.conf", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH PARSE_FLAGS_STYLE_UNIX },70 { 1, 1, 2, "//", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_EXTRA_SLASHES, RTPATH PARSE_FLAGS_STYLE_UNIX },71 { 1, 1, 3, "///", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_EXTRA_SLASHES, RTPATH PARSE_FLAGS_STYLE_UNIX },72 { 3, 6, 7, "/.//bin", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_EXTRA_SLASHES | RTPATH_PROP_DOT_REFS | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },73 { 1, 3, 3, "bin", RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },74 { 1, 3, 4, "bin/", RTPATH_PROP_RELATIVE | RTPATH_PROP_DIR_SLASH, RTPATH PARSE_FLAGS_STYLE_UNIX },75 { 1, 3, 7, "bin////", RTPATH_PROP_RELATIVE | RTPATH_PROP_DIR_SLASH | RTPATH_PROP_EXTRA_SLASHES, RTPATH PARSE_FLAGS_STYLE_UNIX },76 { 3, 10, 10, "bin/../usr", RTPATH_PROP_RELATIVE | RTPATH_PROP_DOTDOT_REFS | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },77 { 4, 11, 11, "/bin/../usr", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_RELATIVE | RTPATH_PROP_DOTDOT_REFS | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },78 { 4, 8, 8, "/a/.../u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },79 { 4, 8, 8, "/a/.b./u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },80 { 4, 8, 8, "/a/..c/u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },81 { 4, 8, 8, "/a/d../u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },82 { 4, 8, 8, "/a/.e/.u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },83 { 4, 8, 8, "/a/.f/.u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },84 { 4, 8, 8, "/a/.g/u.", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH PARSE_FLAGS_STYLE_UNIX },85 { 3, 9, 10, "/a/h/u.ext", RTPATH_PROP_EXTRA_SLASHES | RTPATH_PROP_RELATIVE, RTPATH PARSE_FLAGS_STYLE_UNIX | RTPATHPARSE_FLAGS_MIDDLE },86 { 3, 9, 9, "a/h/u.ext", RTPATH_PROP_RELATIVE, RTPATH PARSE_FLAGS_STYLE_UNIX | RTPATHPARSE_FLAGS_MIDDLE },87 { 3, 9, 10, "a/h/u.ext/", RTPATH_PROP_EXTRA_SLASHES | RTPATH_PROP_RELATIVE, RTPATH PARSE_FLAGS_STYLE_UNIX | RTPATHPARSE_FLAGS_MIDDLE },55 { 2, 13, 9, "C:/Config.sys", RTPATH_PROP_VOLUME | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH_STR_F_STYLE_DOS }, 56 { 2, 13, 10, "C://Config.sys", RTPATH_PROP_VOLUME | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX | RTPATH_PROP_EXTRA_SLASHES, RTPATH_STR_F_STYLE_DOS }, 57 { 2, 12, 8, "C:Config.sys", RTPATH_PROP_VOLUME | RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH_STR_F_STYLE_DOS }, 58 { 1, 10, 6, "Config.sys", RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH_STR_F_STYLE_DOS }, 59 { 1, 4, 4, "//./", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE, RTPATH_STR_F_STYLE_DOS }, 60 { 2, 5, 5, "//./f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_DOS }, 61 { 2, 5, 6, "//.//f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_EXTRA_SLASHES, RTPATH_STR_F_STYLE_DOS }, 62 { 3, 7, 7, "//././f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_DOT_REFS, RTPATH_STR_F_STYLE_DOS }, 63 { 3, 8, 8, "//.././f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_DOT_REFS, RTPATH_STR_F_STYLE_DOS }, 64 { 3, 9, 9, "//../../f", RTPATH_PROP_UNC | RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME | RTPATH_PROP_DOTDOT_REFS, RTPATH_STR_F_STYLE_DOS }, 65 { 1, 1, 1, "/", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE, RTPATH_STR_F_STYLE_UNIX }, 66 { 2, 4, 4, "/bin", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 67 { 2, 4, 5, "/bin/", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_DIR_SLASH, RTPATH_STR_F_STYLE_UNIX }, 68 { 3, 7, 7, "/bin/ls", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 69 { 3, 12, 7, "/etc/rc.conf", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME | RTPATH_PROP_SUFFIX, RTPATH_STR_F_STYLE_UNIX }, 70 { 1, 1, 2, "//", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_EXTRA_SLASHES, RTPATH_STR_F_STYLE_UNIX }, 71 { 1, 1, 3, "///", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_EXTRA_SLASHES, RTPATH_STR_F_STYLE_UNIX }, 72 { 3, 6, 7, "/.//bin", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_EXTRA_SLASHES | RTPATH_PROP_DOT_REFS | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 73 { 1, 3, 3, "bin", RTPATH_PROP_RELATIVE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 74 { 1, 3, 4, "bin/", RTPATH_PROP_RELATIVE | RTPATH_PROP_DIR_SLASH, RTPATH_STR_F_STYLE_UNIX }, 75 { 1, 3, 7, "bin////", RTPATH_PROP_RELATIVE | RTPATH_PROP_DIR_SLASH | RTPATH_PROP_EXTRA_SLASHES, RTPATH_STR_F_STYLE_UNIX }, 76 { 3, 10, 10, "bin/../usr", RTPATH_PROP_RELATIVE | RTPATH_PROP_DOTDOT_REFS | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 77 { 4, 11, 11, "/bin/../usr", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_RELATIVE | RTPATH_PROP_DOTDOT_REFS | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 78 { 4, 8, 8, "/a/.../u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 79 { 4, 8, 8, "/a/.b./u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 80 { 4, 8, 8, "/a/..c/u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 81 { 4, 8, 8, "/a/d../u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 82 { 4, 8, 8, "/a/.e/.u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 83 { 4, 8, 8, "/a/.f/.u", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 84 { 4, 8, 8, "/a/.g/u.", RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_ABSOLUTE | RTPATH_PROP_FILENAME, RTPATH_STR_F_STYLE_UNIX }, 85 { 3, 9, 10, "/a/h/u.ext", RTPATH_PROP_EXTRA_SLASHES | RTPATH_PROP_RELATIVE, RTPATH_STR_F_STYLE_UNIX | RTPATH_STR_F_MIDDLE }, 86 { 3, 9, 9, "a/h/u.ext", RTPATH_PROP_RELATIVE, RTPATH_STR_F_STYLE_UNIX | RTPATH_STR_F_MIDDLE }, 87 { 3, 9, 10, "a/h/u.ext/", RTPATH_PROP_EXTRA_SLASHES | RTPATH_PROP_RELATIVE, RTPATH_STR_F_STYLE_UNIX | RTPATH_STR_F_MIDDLE }, 88 88 }; 89 89 … … 131 131 return rc; 132 132 RTTestBanner(hTest); 133 134 RTTestSub(hTest, "Environment"); 135 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 136 RTTESTI_CHECK(RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS); 137 # if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS 138 # else 139 RTTestIFailed("#if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS"); 140 # endif 141 RTTESTI_CHECK(strcmp(RTPATH_SLASH_STR, "\\") == 0); 142 RTTESTI_CHECK(RTPATH_SLASH == '\\'); 143 RTTESTI_CHECK(RTPATH_IS_SEP('/')); 144 RTTESTI_CHECK(RTPATH_IS_SEP('\\')); 145 RTTESTI_CHECK(RTPATH_IS_SEP(':')); 146 147 #else 148 RTTESTI_CHECK(RTPATH_STYLE == RTPATH_STR_F_STYLE_UNIX); 149 # if RTPATH_STYLE == RTPATH_STR_F_STYLE_UNIX 150 # else 151 RTTestIFailed("#if RTPATH_STYLE == RTPATH_STR_F_STYLE_UNIX"); 152 # endif 153 RTTESTI_CHECK(strcmp(RTPATH_SLASH_STR, "/") == 0); 154 RTTESTI_CHECK(RTPATH_SLASH == '/'); 155 RTTESTI_CHECK(RTPATH_IS_SEP('/')); 156 RTTESTI_CHECK(!RTPATH_IS_SEP('\\')); 157 RTTESTI_CHECK(!RTPATH_IS_SEP(':')); 158 #endif 133 159 134 160 /*
Note:
See TracChangeset
for help on using the changeset viewer.

