*
* Copyright (C) 2011 Hugo Villeneuve <hugo@hugovil.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This file is released under the GPLv2
*/
#if HAVE_CONFIG_H
const char *argp_program_version = PACKAGE_VERSION;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
-#define PACKAGE_DOC_LENGTH 128
-
-/* Program documentation. */
-static char str_doc[PACKAGE_DOC_LENGTH];
+/*
+ * Program documentation.
+ * Adjacent string constants are concatenated as one string constant.
+ */
+static const char str_doc[] = PACKAGE_NAME " -- " PACKAGE_DESCRIPTION;
-/* How many arguments we accept. */
+/* How many non-option arguments we accept. */
#define ARGS_COUNT 1
-/* A description of the arguments we accept. */
+/* A description of the non-option arguments we accept. */
static const char args_doc[] = "[FILENAME]";
/* The options we understand. */
static struct argp_option argp_options[] = {
- {"debug", 'd', "level", 0, "Produce debugging output" },
- {"pram", 'p', "size", 0, "Set program memory size" },
- {"xram", 'x', "size", 0, "Set external ram size (default is 1024)" },
- {"stop", 's', "addr", 0, "Automatically run program and stop at address" },
- { 0 }
+ {"debug", 'd', "level", 0, "Produce debugging output", 0},
+ {"pram", 'p', "size", 0, "Set program memory size", 0},
+ {"xram", 'x', "size", 0,
+ "Set external ram size (default is 1024)", 0},
+ {"stop", 's', "addr", 0,
+ "Automatically run program and stop at address", 0},
+ {NULL, 0, NULL, 0, NULL, 0}
};
struct options_t options;
-const char *
-get_package_description(void)
-{
- return "Emulator for 8051 family microcontrollers";
-}
-
static void
decode_debug_option(char *arg, struct argp_state *state)
{
}
/* Our argp parser. */
-static struct argp argp = { argp_options, parse_opt, args_doc, str_doc };
+static struct argp argp = {argp_options, parse_opt, args_doc, str_doc,
+ NULL, NULL, NULL};
/* Initializes the different options passed as arguments on the command line. */
void
parse_command_line_options(int argc, char *argv[])
{
- snprintf(str_doc, PACKAGE_DOC_LENGTH, "%s -- %s", PACKAGE_NAME,
- get_package_description());
-
/* Setting default values. */
options.filename = NULL;
options.pram_size = PGM_MEM_DEFAULT_SIZE;