| 350 | |
| 351 | #ifdef HOST_CYGWIN |
| 352 | static const char *convert_path(const char *path, cygwin_conv_path_t what) |
| 353 | { |
| 354 | const char *retptr; |
| 355 | ssize_t size; |
| 356 | ssize_t ret; |
| 357 | bool quoted; |
| 358 | |
| 359 | quoted = dequote_path(path); |
| 360 | if (quoted) |
| 361 | { |
| 362 | retptr = g_hostpath; |
| 363 | } |
| 364 | else |
| 365 | { |
| 366 | retptr = &g_hostpath[1]; |
| 367 | } |
| 368 | |
| 369 | size = cygwin_conv_path(what | CCP_RELATIVE, g_dequoted, NULL, 0); |
| 370 | if (size > (MAX_PATH - 3)) |
| 371 | { |
| 372 | fprintf(stderr, "# ERROR: POSIX path too long: %lu\n", |
| 373 | (unsigned long)size); |
| 374 | exit(EXIT_FAILURE); |
| 375 | } |
| 376 | |
| 377 | ret = cygwin_conv_path(what | CCP_RELATIVE, g_dequoted, |
| 378 | &g_hostpath[1], MAX_PATH - 3); |
| 379 | if (ret < 0) |
| 380 | { |
| 381 | fprintf(stderr, "# ERROR: cygwin_conv_path '%s' failed: %s\n", |
| 382 | g_dequoted, strerror(errno)); |
| 383 | exit(EXIT_FAILURE); |
| 384 | } |
| 385 | |
| 386 | if (quoted) |
| 387 | { |
| 388 | size++; |
| 389 | g_hostpath[0] = '"'; |
| 390 | g_hostpath[size] = '"'; |
| 391 | } |
| 392 | |
| 393 | g_hostpath[size + 1] = '\0'; |
| 394 | return retptr; |
| 395 | } |
| 396 | #endif |
| 397 | |
| 398 | static const char *convert_path_windows(const char *path) |
no test coverage detected