MCPcopy Create free account
hub / github.com/Singular/Singular / feGetExpandedExecutable

Function feGetExpandedExecutable

resources/feResource.cc:376–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376static char* feGetExpandedExecutable()
377{
378 if (feArgv0 == NULL || *feArgv0 == '\0')
379 {
380 if (feArgv0 == NULL)
381 printf("Bug >>feArgv0 == NULL<< at %s:%d\n",__FILE__,__LINE__);
382 else
383 printf("Bug >>feArgv0 == ''<< at %s:%d\n",__FILE__,__LINE__);
384 return NULL;
385 }
386#ifdef __CYGWIN__ // stupid WINNT sometimes gives you argv[0] within ""
387 if (*feArgv0 == '"')
388 {
389 int l = strlen(feArgv0);
390 if (feArgv0[l-1] == '"')
391 {
392 feArgv0[l-1] = '\0';
393 feArgv0++;
394 }
395 }
396#endif
397#ifdef RESOURCE_DEBUG
398 printf("feGetExpandedExecutable: calling find_exec with \"%s\"\n", feArgv0);
399#endif
400 char executable[MAXRESOURCELEN];
401 char* value = omFindExec(feArgv0, executable);
402#ifdef RESOURCE_DEBUG
403 printf("feGetExpandedExecutable: find_exec exited with \"%s\": %d\n", executable, access(executable, X_OK));
404#endif
405 if (value == NULL)
406 {
407 printf("Bug >>Could not get expanded executable from \"%s\"<< at %s:%d\n",feArgv0,__FILE__,__LINE__);
408 return NULL;
409 }
410 return strdup(value);
411}
412
413
414static int feVerifyResourceValue(feResourceType type, char* value)

Callers 1

feInitResourceFunction · 0.85

Calls 1

omFindExecFunction · 0.85

Tested by

no test coverage detected