static void TestProgramName(void) { const char* programName = le_arg_GetProgramName(); LE_ASSERT(NULL != programName); LE_DEBUG("Our program name is: %s", programName); LE_ASSERT(strcmp(programName, PROGRAMNAME) == 0); }
//-------------------------------------------------------------------------------------------------- static void PrintHelp ( void ) { fprintf(stderr, "Printing help...\n"); const char* programName = le_arg_GetProgramName(); printf( "NAME\n" " %s - Starts the Legato framework.\n" "\n" "SYNOPSIS\n" " %s [OPTION]\n" "\n" "DESCRIPTION\n" " Start up the Legato application framework daemon processes.\n" "\n" " Options:\n" "\n" " -a, --start-apps=MODE\n" " If MODE is 'auto', start all apps marked for auto start\n" " (this is the default). If MODE is 'none', don't start\n" " any apps until told to do so through the App Control API.\n" "\n" " -n, --no-daemonize\n" " The Supervisor does not daemonize itself.\n" "\n" " -h --help\n" " Print this help text to standard output stream and exit.\n", programName, programName); }
//-------------------------------------------------------------------------------------------------- static void ExitWithErrorMsg ( const char* errorMsg ) //-------------------------------------------------------------------------------------------------- { const char* programNamePtr = le_arg_GetProgramName(); fprintf(stderr, "* %s: %s\n", programNamePtr, errorMsg); fprintf(stderr, "Try '%s --help'.\n", programNamePtr); exit(EXIT_FAILURE); }
// ------------------------------------------------------------------------------------------------- static void PrintHelp ( void ) // ------------------------------------------------------------------------------------------------- { const char* programName = le_arg_GetProgramName(); printf("Load/Unload a Legato bundled kernel module.\n" "\n" " Usage:\n" "\n" " To load a module:\n" "\n" " %1$s load <moduleName>\n" "\n" " To unload a module:\n" "\n" " %1$s unload <moduleName>\n" "\n", programName); }