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

Function open_stub

tools/mksyscall.c:368–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368static FILE *open_stub(void)
369{
370 if (g_inline)
371 {
372 if (!g_stubstream)
373 {
374 g_stubstream = fopen("STUB.h", "w");
375 if (g_stubstream == NULL)
376 {
377 fprintf(stderr, "Failed to open STUB.h: %s\n",
378 strerror(errno));
379 exit(9);
380 }
381
382 fprintf(g_stubstream, "/* Autogenerated STUB header file */\n\n");
383 fprintf(g_stubstream, "#ifndef __STUB_H\n");
384 fprintf(g_stubstream, "#define __STUB_H\n\n");
385 }
386
387 return g_stubstream;
388 }
389 else
390 {
391 char filename[MAX_PARMSIZE + 8];
392 FILE *stream;
393
394 snprintf(filename, MAX_PARMSIZE + 7, "STUB_%s.c", g_parm[NAME_INDEX]);
395 filename[MAX_PARMSIZE + 7] = '\0';
396
397 stream = fopen(filename, "w");
398
399 if (stream == NULL)
400 {
401 fprintf(stderr, "Failed to open %s: %s\n", filename,
402 strerror(errno));
403 exit(9);
404 }
405
406 return stream;
407 }
408}
409
410static void stub_close(FILE *stream)
411{

Callers 1

generate_stubFunction · 0.85

Calls 5

fopenFunction · 0.85
fprintfFunction · 0.85
strerrorFunction · 0.85
exitFunction · 0.85
snprintfFunction · 0.50

Tested by

no test coverage detected