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

Function convert_path

tools/mkdeps.c:664–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662#endif
663
664static const char *convert_path(const char *path)
665{
666#ifdef HOST_CYGWIN
667 if (g_winpath)
668 {
669 const char *retptr;
670 ssize_t size;
671 ssize_t ret;
672 bool quoted;
673
674 quoted = dequote_path(path);
675 if (quoted)
676 {
677 retptr = g_posixpath;
678 }
679 else
680 {
681 retptr = &g_posixpath[1];
682 }
683
684 size = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, g_dequoted,
685 NULL, 0);
686 if (size > (MAX_PATH - 3))
687 {
688 fprintf(stderr, "# ERROR: POSIX path too long: %zd\n", size);
689 exit(EXIT_FAILURE);
690 }
691
692 ret = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, g_dequoted,
693 &g_posixpath[1], MAX_PATH - 3);
694 if (ret < 0)
695 {
696 fprintf(stderr, "# ERROR: cygwin_conv_path '%s' failed: %s\n",
697 g_dequoted, strerror(errno));
698 exit(EXIT_FAILURE);
699 }
700
701 if (quoted)
702 {
703 size++;
704 g_posixpath[0] = '"';
705 g_posixpath[size] = '"';
706 }
707
708 g_posixpath[size + 1] = '\0';
709 return retptr;
710 }
711 else
712#endif
713 {
714 return path;
715 }
716}
717
718static void do_dependency(const char *file)
719{

Callers 1

do_dependencyFunction · 0.70

Calls 4

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

Tested by

no test coverage detected