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

Function main

tools/mkversion.c:60–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 ****************************************************************************/
59
60int main(int argc, char **argv, char **envp)
61{
62 char *filepath;
63 FILE *stream;
64
65 if (argc != 2)
66 {
67 fprintf(stderr, "Unexpected number of arguments\n");
68 show_usage(argv[0]);
69 }
70
71 filepath = getfilepath(argv[1]);
72 if (!filepath)
73 {
74 fprintf(stderr, "getfilepath failed\n");
75 exit(2);
76 }
77
78 stream = fopen(filepath, "r");
79 if (!stream)
80 {
81 fprintf(stderr, "open %s failed: %s\n", filepath, strerror(errno));
82 exit(3);
83 }
84
85 printf("/* version.h -- Autogenerated! Do not edit. */\n\n");
86 printf("#ifndef __INCLUDE_NUTTX_VERSION_H\n");
87 printf("#define __INCLUDE_NUTTX_VERSION_H\n\n");
88 generate_definitions(stream);
89 printf("\n#define CONFIG_VERSION ((CONFIG_VERSION_MAJOR << 16) |\\\n"
90 " (CONFIG_VERSION_MINOR << 8) |\\\n"
91 " (CONFIG_VERSION_PATCH))\n\n");
92 printf("#endif /* __INCLUDE_NUTTX_VERSION_H */\n");
93 fclose(stream);
94
95 /* Exit (without bothering to clean up allocations) */
96
97 free(filepath);
98 return 0;
99}

Callers

nothing calls this directly

Calls 10

fprintfFunction · 0.85
exitFunction · 0.85
fopenFunction · 0.85
strerrorFunction · 0.85
printfFunction · 0.85
generate_definitionsFunction · 0.85
fcloseFunction · 0.85
show_usageFunction · 0.70
getfilepathFunction · 0.70
freeFunction · 0.50

Tested by

no test coverage detected