diff options
Diffstat (limited to 'src/args.c')
-rw-r--r-- | src/args.c | 71 |
1 files changed, 35 insertions, 36 deletions
@@ -26,60 +26,59 @@ #include "config.h" extern gboolean seed_interpreter_arg_print_version; -extern gchar *seed_interpreter_arg_exec_string; +extern gchar* seed_interpreter_arg_exec_string; static GOptionEntry seed_args[] = { - {"version", 0, 0, G_OPTION_ARG_NONE, &seed_interpreter_arg_print_version, - "Print interpreter version", 0}, - {"execute", 'e', 0, G_OPTION_ARG_STRING, &seed_interpreter_arg_exec_string, - "Pass program in as string", "expression"}, - {NULL,}, + { "version", 0, 0, G_OPTION_ARG_NONE, &seed_interpreter_arg_print_version, + "Print interpreter version", 0 }, + { "execute", 'e', 0, G_OPTION_ARG_STRING, &seed_interpreter_arg_exec_string, + "Pass program in as string", "expression" }, + { + NULL, + }, }; - -static GOptionGroup * -seed_interpreter_get_option_group (void) +static GOptionGroup* +seed_interpreter_get_option_group(void) { - GOptionGroup *group; + GOptionGroup* group; - group = g_option_group_new ("seed-interpreter", "Interpreter Options", - "Show Interpreter Options", NULL, NULL); - g_option_group_add_entries (group, seed_args); + group = g_option_group_new("seed-interpreter", "Interpreter Options", + "Show Interpreter Options", NULL, NULL); + g_option_group_add_entries(group, seed_args); - return group; + return group; } gboolean -seed_interpreter_parse_args (int *argc, char ***argv) +seed_interpreter_parse_args(int* argc, char*** argv) { - GOptionContext *option_context; - GOptionGroup *interpreter_group; + GOptionContext* option_context; + GOptionGroup* interpreter_group; - GError *error = NULL; - gboolean ret = TRUE; + GError* error = NULL; + gboolean ret = TRUE; - option_context = g_option_context_new (NULL); - g_option_context_set_ignore_unknown_options (option_context, TRUE); - g_option_context_set_help_enabled (option_context, TRUE); + option_context = g_option_context_new(NULL); + g_option_context_set_ignore_unknown_options(option_context, TRUE); + g_option_context_set_help_enabled(option_context, TRUE); - /* Initiate any command line options from the backend */ + /* Initiate any command line options from the backend */ - interpreter_group = seed_interpreter_get_option_group (); - g_option_context_set_main_group (option_context, interpreter_group); - g_option_context_add_group (option_context, seed_get_option_group ()); + interpreter_group = seed_interpreter_get_option_group(); + g_option_context_set_main_group(option_context, interpreter_group); + g_option_context_add_group(option_context, seed_get_option_group()); - if (!g_option_context_parse (option_context, argc, argv, &error)) - { - if (error) - { - g_warning ("%s", error->message); - g_error_free (error); - } + if (!g_option_context_parse(option_context, argc, argv, &error)) { + if (error) { + g_warning("%s", error->message); + g_error_free(error); + } - ret = FALSE; + ret = FALSE; } - g_option_context_free (option_context); + g_option_context_free(option_context); - return ret; + return ret; } |