Changeset 3214
- Timestamp:
- Apr 25, 2007, 2:02:22 AM (18 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/src/lib/sys/fs.c
r2543 r3214 194 194 * The special /@unixroot rewrite rule. 195 195 */ 196 static __LIBC_PATHREWRITE g aRewriteRule =197 { 198 __LIBC_PRWF_CASE_SENSITIVE | __LIBC_PRWF_TYPE_DIR, 196 static __LIBC_PATHREWRITE gUnixRootRewriteRule = 197 { 198 __LIBC_PRWF_CASE_SENSITIVE | __LIBC_PRWF_TYPE_DIR, "/@unixroot", 10, __libc_gszUnixRoot, 0 199 199 }; 200 200 201 /** The full path to the executable directory. */ 202 char __libc_gszExecPath[CCHMAXPATH]; 203 204 /** 205 * The special /@executable_path rewrite rule. 206 */ 207 static __LIBC_PATHREWRITE gExecRewriteRule = 208 { 209 __LIBC_PRWF_CASE_SENSITIVE | __LIBC_PRWF_TYPE_DIR, "/@executable_path", 17, __libc_gszExecPath, 0 210 }; 201 211 202 212 /** Array of pointers to fs info objects for all … … 278 288 279 289 /* Register rewrite rule. */ 280 g aRewriteRule.pszTo = "/";281 g aRewriteRule.cchTo = 1;282 if (__libc_PathRewriteAdd(&g aRewriteRule, 1))290 gUnixRootRewriteRule.pszTo = "/"; 291 gUnixRootRewriteRule.cchTo = 1; 292 if (__libc_PathRewriteAdd(&gUnixRootRewriteRule, 1)) 283 293 LIBCLOG_RETURN_INT(-1); 284 294 } … … 308 318 309 319 /* Register the rewrite rule. */ 310 g aRewriteRule.cchTo = cch;311 if (__libc_PathRewriteAdd(&g aRewriteRule, 1))320 gUnixRootRewriteRule.cchTo = cch; 321 if (__libc_PathRewriteAdd(&gUnixRootRewriteRule, 1)) 312 322 LIBCLOG_RETURN_INT(-1); 313 323 } … … 315 325 } 316 326 327 328 /* 329 * Setup the the executable path rewrite rule. 330 */ 331 PTIB pTib; 332 PPIB pPib; 333 DosGetInfoBlocks(&pTib, &pPib); 334 rc = DosQueryModuleName(pPib->pib_hmte, sizeof(__libc_gszExecPath), &__libc_gszExecPath[0]); 335 if (!rc) 336 { 337 char *psz = strchr(&__libc_gszExecPath[0], '\0'); 338 while ( psz > &__libc_gszExecPath[0] 339 && *psz != '\\' 340 && *psz != '/' 341 && *psz != ':') 342 psz--; 343 *psz = '\0'; 344 gExecRewriteRule.cchTo = psz - &__libc_gszExecPath[0]; 345 } 346 else 347 { 348 LIBC_ASSERTM_FAILED("DosQueryModuleName(exe) failed: hmte=%lx rc=%d\n", pPib->pib_hmte, rc); 349 gExecRewriteRule.cchTo = 1; 350 gExecRewriteRule.pszTo = "/"; 351 } 352 if (__libc_PathRewriteAdd(&gExecRewriteRule, 1)) 353 LIBCLOG_RETURN_INT(-1); 317 354 318 355 /* … … 573 610 void __libc_back_fsUpdateUnixRoot(const char *pszUnixRoot) 574 611 { 575 g aRewriteRule.pszTo = "/";576 g aRewriteRule.cchTo = 1;612 gUnixRootRewriteRule.pszTo = "/"; 613 gUnixRootRewriteRule.cchTo = 1; 577 614 578 615 int cch = strlen(pszUnixRoot); -
trunk/libc/src/kNIX/os2/fs-os2.c
r2935 r3214 162 162 * The special /@unixroot rewrite rule. 163 163 */ 164 static __LIBC_PATHREWRITE gaRewriteRule = 165 { 166 __LIBC_PRWF_CASE_SENSITIVE | __LIBC_PRWF_TYPE_DIR, "/@unixroot", 10, __libc_gszUnixRoot, 0 164 static __LIBC_PATHREWRITE gUnixRootRewriteRule = 165 { 166 __LIBC_PRWF_CASE_SENSITIVE | __LIBC_PRWF_TYPE_DIR, "/@unixroot", 10, __libc_gszUnixRoot, 0 167 }; 168 169 /** The full path to the executable directory. */ 170 char __libc_gszExecPath[CCHMAXPATH]; 171 172 /** 173 * The special /@executable_path rewrite rule. 174 */ 175 static __LIBC_PATHREWRITE gExecRewriteRule = 176 { 177 __LIBC_PRWF_CASE_SENSITIVE | __LIBC_PRWF_TYPE_DIR, "/@executable_path", 17, __libc_gszExecPath, 0 167 178 }; 168 179 … … 223 234 224 235 /* Register rewrite rule. */ 225 g aRewriteRule.pszTo = "/";226 g aRewriteRule.cchTo = 1;227 if (__libc_PathRewriteAdd(&g aRewriteRule, 1))236 gUnixRootRewriteRule.pszTo = "/"; 237 gUnixRootRewriteRule.cchTo = 1; 238 if (__libc_PathRewriteAdd(&gUnixRootRewriteRule, 1)) 228 239 LIBCLOG_RETURN_INT(-1); 229 240 } … … 251 262 252 263 /* Register the rewrite rule. */ 253 g aRewriteRule.cchTo = cch;254 if (__libc_PathRewriteAdd(&g aRewriteRule, 1))264 gUnixRootRewriteRule.cchTo = cch; 265 if (__libc_PathRewriteAdd(&gUnixRootRewriteRule, 1)) 255 266 LIBCLOG_RETURN_INT(-1); 256 267 } 257 268 } 258 269 270 271 /* 272 * Setup the the executable path rewrite rule. 273 */ 274 PTIB pTib; 275 PPIB pPib; 276 DosGetInfoBlocks(&pTib, &pPib); 277 rc = DosQueryModuleName(pPib->pib_hmte, sizeof(__libc_gszExecPath), &__libc_gszExecPath[0]); 278 if (!rc) 279 { 280 char *psz = strchr(&__libc_gszExecPath[0], '\0'); 281 while ( psz > &__libc_gszExecPath[0] 282 && *psz != '\\' 283 && *psz != '/' 284 && *psz != ':') 285 psz--; 286 *psz = '\0'; 287 gExecRewriteRule.cchTo = psz - &__libc_gszExecPath[0]; 288 } 289 else 290 { 291 LIBC_ASSERTM_FAILED("DosQueryModuleName(exe) failed: hmte=%lx rc=%d\n", pPib->pib_hmte, rc); 292 gExecRewriteRule.cchTo = 1; 293 gExecRewriteRule.pszTo = "/"; 294 } 295 if (__libc_PathRewriteAdd(&gExecRewriteRule, 1)) 296 LIBCLOG_RETURN_INT(-1); 259 297 260 298 /*
Note:
See TracChangeset
for help on using the changeset viewer.