1
0

Added a weak callback for command line parsing

Consumer code can access the command line via
an additional callback of the virtual hardware.
This makes it possible to access the name of
the executable that is currently executed.

Signed-off-by: Florian Fleissner <florian.fleissner@inpartik.de>
This commit is contained in:
Florian Fleissner 2019-06-11 17:21:27 +02:00 committed by Jesse Vincent
parent 72b0f91c6c
commit bfe2fc9d3e

View File

@ -29,6 +29,9 @@ void initVariant() { }
void setupUSB() __attribute__((weak)); void setupUSB() __attribute__((weak));
void setupUSB() { } void setupUSB() { }
void parseCommandLine(int argc, char* argv[]) __attribute__((weak));
void parseCommandLine(int argc, char* argv[]) { }
// This function can be overridden in other libraries // This function can be overridden in other libraries
// e.g. to run a testing framework. // e.g. to run a testing framework.
// //
@ -41,6 +44,11 @@ void init(void) {
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
// Enable consumer code to read command line args.
//
parseCommandLine(argc, argv);
if (!initVirtualInput(argc, argv)) return 1; if (!initVirtualInput(argc, argv)) return 1;
if(testFunctionExecutionRequested()) { if(testFunctionExecutionRequested()) {