Add print_help function to nuttx-stm32f4 target (#1584)

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka 2017-02-16 12:49:49 +01:00 committed by GitHub
parent 75d8226af3
commit fdd31f20b5

View File

@ -32,6 +32,23 @@
#define JERRY_STANDALONE_EXIT_CODE_OK (0)
#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)
/**
* Print usage and available options
*/
static void
print_help (char *name)
{
jerry_port_console ("Usage: %s [OPTION]... [FILE]...\n"
"\n"
"Options:\n"
" --mem-stats\n"
" --mem-stats-separate\n"
" --show-opcodes\n"
" --log-level [0-3]\n"
"\n",
name);
} /* print_help */
/**
* Read source files.
*
@ -187,7 +204,12 @@ int jerry_main (int argc, char *argv[])
for (i = 1; i < argc; i++)
{
if (!strcmp ("--mem-stats", argv[i]))
if (!strcmp ("-h", argv[i]) || !strcmp ("--help", argv[i]))
{
print_help (argv[0]);
return JERRY_STANDALONE_EXIT_CODE_OK;
}
else if (!strcmp ("--mem-stats", argv[i]))
{
flags |= JERRY_INIT_MEM_STATS;
}