MCPcopy Create free account
hub / github.com/apache/nuttx / convert_path

Function convert_path

tools/zds/zdsar.c:352–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350
351#ifdef HOST_CYGWIN
352static 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
398static const char *convert_path_windows(const char *path)

Callers 2

convert_path_windowsFunction · 0.70
convert_path_posixFunction · 0.70

Calls 4

fprintfFunction · 0.85
exitFunction · 0.85
strerrorFunction · 0.85
dequote_pathFunction · 0.70

Tested by

no test coverage detected