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

Function enum_boards

tools/initialconfig.c:688–749  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686 ****************************************************************************/
687
688static int enum_boards(const char *dirpath, struct dirent *entry, void *arg)
689{
690 int ret = 0;
691 char *boardpath;
692 char *testpath;
693
694 /* All board directories should contain a Kconfig file, an include/
695 * directory, and a src/ directory.
696 */
697
698 ret = asprintf(&boardpath, "%s%c%s", dirpath, g_delim, entry->d_name);
699 if (ret < 0)
700 {
701 fprintf(stderr,
702 "ERROR: asprintf() failed to boardpath\n");
703 return ret;
704 }
705
706 ret = asprintf(&testpath, "%s%cKconfig", boardpath, g_delim);
707 if (ret < 0)
708 {
709 fprintf(stderr,
710 "ERROR: asprintf() failed to testpath\n");
711 return ret;
712 }
713
714 if (test_filepath(testpath))
715 {
716 free(testpath);
717 ret = asprintf(&testpath, "%s%cinclude", boardpath, g_delim);
718 if (ret < 0)
719 {
720 fprintf(stderr,
721 "ERROR: asprintf() failed to testpath\n");
722 return ret;
723 }
724
725 if (test_dirpath(testpath))
726 {
727 free(testpath);
728 ret = asprintf(&testpath, "%s%csrc", boardpath, g_delim);
729 if (ret < 0)
730 {
731 fprintf(stderr,
732 "ERROR: asprintf() failed to archpath\n");
733 return ret;
734 }
735
736 if (test_dirpath(testpath))
737 {
738 /* Enumerate the board configurations */
739
740 foreach_dirent(boardpath, enum_board_configurations,
741 entry->d_name);
742 }
743 }
744 }
745

Callers

nothing calls this directly

Calls 6

asprintfFunction · 0.85
fprintfFunction · 0.85
test_filepathFunction · 0.85
test_dirpathFunction · 0.85
foreach_direntFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected