/*
- File autogenerated by gengetopt version 2.22.4
+ File autogenerated by gengetopt version 2.22.5
generated with the following command:
- gengetopt --file-name=imagetag_cmdline --file-name=imagetag_cmdline
+ gengetopt -i imagetag.ggo -f imagetag_cmdline --file-name=imagetag_cmdline
The developers of gengetopt consider the fixed text that goes in all
gengetopt output files to be in the public domain:
" --reserved2=STRING String for second reserved section.",
" --kernel-file-has-header Indicates that the kernel file includes the \n kernel header with correct load address and \n entry point, so no changes are needed \n (default=off)",
" -p, --pad=size (in MiB) Pad the image to this size if smaller (in MiB)",
+ " --align-rootfs Align the rootfs start to erase block size \n (default=off)",
0
};
, ARG_FLAG
, ARG_STRING
, ARG_INT
-} cmdline_parser_arg_type;
+} imagetag_cmdline_arg_type;
static
void clear_given (struct gengetopt_args_info *args_info);
void clear_args (struct gengetopt_args_info *args_info);
static int
-cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params, const char *additional_error);
+imagetag_cmdline_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
+ struct imagetag_cmdline_params *params, const char *additional_error);
static int
-cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
+imagetag_cmdline_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
-const char *cmdline_parser_second_image_flag_values[] = {"0", "1", "2", 0}; /*< Possible values for second-image-flag. */
-const char *cmdline_parser_inactive_values[] = {"0", "1", "2", 0}; /*< Possible values for inactive. */
+const char *imagetag_cmdline_second_image_flag_values[] = {"0", "1", "2", 0}; /*< Possible values for second-image-flag. */
+const char *imagetag_cmdline_inactive_values[] = {"0", "1", "2", 0}; /*< Possible values for inactive. */
static char *
gengetopt_strdup (const char *s);
args_info->reserved2_given = 0 ;
args_info->kernel_file_has_header_given = 0 ;
args_info->pad_given = 0 ;
+ args_info->align_rootfs_given = 0 ;
}
static
args_info->reserved2_orig = NULL;
args_info->kernel_file_has_header_flag = 0;
args_info->pad_orig = NULL;
+ args_info->align_rootfs_flag = 0;
}
args_info->reserved2_help = gengetopt_args_info_help[24] ;
args_info->kernel_file_has_header_help = gengetopt_args_info_help[25] ;
args_info->pad_help = gengetopt_args_info_help[26] ;
+ args_info->align_rootfs_help = gengetopt_args_info_help[27] ;
}
void
-cmdline_parser_print_version (void)
+imagetag_cmdline_print_version (void)
{
printf ("%s %s\n",
- (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
- CMDLINE_PARSER_VERSION);
+ (strlen(IMAGETAG_CMDLINE_PACKAGE_NAME) ? IMAGETAG_CMDLINE_PACKAGE_NAME : IMAGETAG_CMDLINE_PACKAGE),
+ IMAGETAG_CMDLINE_VERSION);
}
static void print_help_common(void) {
- cmdline_parser_print_version ();
+ imagetag_cmdline_print_version ();
if (strlen(gengetopt_args_info_purpose) > 0)
printf("\n%s\n", gengetopt_args_info_purpose);
}
void
-cmdline_parser_print_help (void)
+imagetag_cmdline_print_help (void)
{
int i = 0;
print_help_common();
}
void
-cmdline_parser_init (struct gengetopt_args_info *args_info)
+imagetag_cmdline_init (struct gengetopt_args_info *args_info)
{
clear_given (args_info);
clear_args (args_info);
}
void
-cmdline_parser_params_init(struct cmdline_parser_params *params)
+imagetag_cmdline_params_init(struct imagetag_cmdline_params *params)
{
if (params)
{
}
}
-struct cmdline_parser_params *
-cmdline_parser_params_create(void)
+struct imagetag_cmdline_params *
+imagetag_cmdline_params_create(void)
{
- struct cmdline_parser_params *params =
- (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
- cmdline_parser_params_init(params);
+ struct imagetag_cmdline_params *params =
+ (struct imagetag_cmdline_params *)malloc(sizeof(struct imagetag_cmdline_params));
+ imagetag_cmdline_params_init(params);
return params;
}
static void
-cmdline_parser_release (struct gengetopt_args_info *args_info)
+imagetag_cmdline_release (struct gengetopt_args_info *args_info)
{
free_string_field (&(args_info->kernel_arg));
int
-cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
+imagetag_cmdline_dump(FILE *outfile, struct gengetopt_args_info *args_info)
{
int i = 0;
if (!outfile)
{
- fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
+ fprintf (stderr, "%s: cannot dump options to stream\n", IMAGETAG_CMDLINE_PACKAGE);
return EXIT_FAILURE;
}
if (args_info->rsa_signature_given)
write_into_file(outfile, "rsa-signature", args_info->rsa_signature_orig, 0);
if (args_info->second_image_flag_given)
- write_into_file(outfile, "second-image-flag", args_info->second_image_flag_orig, cmdline_parser_second_image_flag_values);
+ write_into_file(outfile, "second-image-flag", args_info->second_image_flag_orig, imagetag_cmdline_second_image_flag_values);
if (args_info->inactive_given)
- write_into_file(outfile, "inactive", args_info->inactive_orig, cmdline_parser_inactive_values);
+ write_into_file(outfile, "inactive", args_info->inactive_orig, imagetag_cmdline_inactive_values);
if (args_info->reserved2_given)
write_into_file(outfile, "reserved2", args_info->reserved2_orig, 0);
if (args_info->kernel_file_has_header_given)
write_into_file(outfile, "kernel-file-has-header", 0, 0 );
if (args_info->pad_given)
write_into_file(outfile, "pad", args_info->pad_orig, 0);
+ if (args_info->align_rootfs_given)
+ write_into_file(outfile, "align-rootfs", 0, 0 );
i = EXIT_SUCCESS;
}
int
-cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
+imagetag_cmdline_file_save(const char *filename, struct gengetopt_args_info *args_info)
{
FILE *outfile;
int i = 0;
if (!outfile)
{
- fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
+ fprintf (stderr, "%s: cannot open file for writing: %s\n", IMAGETAG_CMDLINE_PACKAGE, filename);
return EXIT_FAILURE;
}
- i = cmdline_parser_dump(outfile, args_info);
+ i = imagetag_cmdline_dump(outfile, args_info);
fclose (outfile);
return i;
}
void
-cmdline_parser_free (struct gengetopt_args_info *args_info)
+imagetag_cmdline_free (struct gengetopt_args_info *args_info)
{
- cmdline_parser_release (args_info);
+ imagetag_cmdline_release (args_info);
}
/** @brief replacement of strdup, which is not standard */
}
int
-cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
+imagetag_cmdline (int argc, char **argv, struct gengetopt_args_info *args_info)
{
- return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
+ return imagetag_cmdline2 (argc, argv, args_info, 0, 1, 1);
}
int
-cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params)
+imagetag_cmdline_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
+ struct imagetag_cmdline_params *params)
{
int result;
- result = cmdline_parser_internal (argc, argv, args_info, params, 0);
+ result = imagetag_cmdline_internal (argc, argv, args_info, params, 0);
if (result == EXIT_FAILURE)
{
- cmdline_parser_free (args_info);
+ imagetag_cmdline_free (args_info);
exit (EXIT_FAILURE);
}
}
int
-cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
+imagetag_cmdline2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
{
int result;
- struct cmdline_parser_params params;
+ struct imagetag_cmdline_params params;
params.override = override;
params.initialize = initialize;
params.check_ambiguity = 0;
params.print_errors = 1;
- result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0);
+ result = imagetag_cmdline_internal (argc, argv, args_info, ¶ms, 0);
if (result == EXIT_FAILURE)
{
- cmdline_parser_free (args_info);
+ imagetag_cmdline_free (args_info);
exit (EXIT_FAILURE);
}
}
int
-cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
+imagetag_cmdline_required (struct gengetopt_args_info *args_info, const char *prog_name)
{
int result = EXIT_SUCCESS;
- if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
+ if (imagetag_cmdline_required2(args_info, prog_name, 0) > 0)
result = EXIT_FAILURE;
if (result == EXIT_FAILURE)
{
- cmdline_parser_free (args_info);
+ imagetag_cmdline_free (args_info);
exit (EXIT_FAILURE);
}
}
int
-cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
+imagetag_cmdline_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
{
int error = 0;
FIX_UNUSED (additional_error);
* @param possible_values the possible values for this option (if specified)
* @param default_value the default value (in case the option only accepts fixed values)
* @param arg_type the type of this option
- * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
- * @param override @see cmdline_parser_params.override
+ * @param check_ambiguity @see imagetag_cmdline_params.check_ambiguity
+ * @param override @see imagetag_cmdline_params.override
* @param no_free whether to free a possible previous value
* @param multiple_option whether this is a multiple option
* @param long_opt the corresponding long option
unsigned int *field_given, unsigned int *prev_given,
char *value, const char *possible_values[],
const char *default_value,
- cmdline_parser_arg_type arg_type,
+ imagetag_cmdline_arg_type arg_type,
int check_ambiguity, int override,
int no_free, int multiple_option,
const char *long_opt, char short_opt,
int
-cmdline_parser_internal (
+imagetag_cmdline_internal (
int argc, char **argv, struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params, const char *additional_error)
+ struct imagetag_cmdline_params *params, const char *additional_error)
{
int c; /* Character of the parsed option. */
check_ambiguity = params->check_ambiguity;
if (initialize)
- cmdline_parser_init (args_info);
+ imagetag_cmdline_init (args_info);
- cmdline_parser_init (&local_args_info);
+ imagetag_cmdline_init (&local_args_info);
optarg = 0;
optind = 0;
{ "reserved2", 1, NULL, 0 },
{ "kernel-file-has-header", 0, NULL, 0 },
{ "pad", 1, NULL, 'p' },
+ { "align-rootfs", 0, NULL, 0 },
{ 0, 0, 0, 0 }
};
switch (c)
{
case 'h': /* Print help and exit. */
- cmdline_parser_print_help ();
- cmdline_parser_free (&local_args_info);
+ imagetag_cmdline_print_help ();
+ imagetag_cmdline_free (&local_args_info);
exit (EXIT_SUCCESS);
case 'V': /* Print version and exit. */
- cmdline_parser_print_version ();
- cmdline_parser_free (&local_args_info);
+ imagetag_cmdline_print_version ();
+ imagetag_cmdline_free (&local_args_info);
exit (EXIT_SUCCESS);
case 'i': /* File with LZMA compressed kernel to include in the image.. */
if (update_arg( (void *)&(args_info->second_image_flag_arg),
&(args_info->second_image_flag_orig), &(args_info->second_image_flag_given),
- &(local_args_info.second_image_flag_given), optarg, cmdline_parser_second_image_flag_values, "2", ARG_STRING,
+ &(local_args_info.second_image_flag_given), optarg, imagetag_cmdline_second_image_flag_values, "2", ARG_STRING,
check_ambiguity, override, 0, 0,
"second-image-flag", '-',
additional_error))
if (update_arg( (void *)&(args_info->inactive_arg),
&(args_info->inactive_orig), &(args_info->inactive_given),
- &(local_args_info.inactive_given), optarg, cmdline_parser_inactive_values, "2", ARG_STRING,
+ &(local_args_info.inactive_given), optarg, imagetag_cmdline_inactive_values, "2", ARG_STRING,
check_ambiguity, override, 0, 0,
"inactive", '-',
additional_error))
additional_error))
goto failure;
+ }
+ /* Align the rootfs start to erase block size. */
+ else if (strcmp (long_options[option_index].name, "align-rootfs") == 0)
+ {
+
+
+ if (update_arg((void *)&(args_info->align_rootfs_flag), 0, &(args_info->align_rootfs_given),
+ &(local_args_info.align_rootfs_given), optarg, 0, 0, ARG_FLAG,
+ check_ambiguity, override, 1, 0, "align-rootfs", '-',
+ additional_error))
+ goto failure;
+
}
break;
goto failure;
default: /* bug: option not considered. */
- fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
+ fprintf (stderr, "%s: option unknown: %c%s\n", IMAGETAG_CMDLINE_PACKAGE, c, (additional_error ? additional_error : ""));
abort ();
} /* switch */
} /* while */
if (check_required)
{
- error += cmdline_parser_required2 (args_info, argv[0], additional_error);
+ error += imagetag_cmdline_required2 (args_info, argv[0], additional_error);
}
- cmdline_parser_release (&local_args_info);
+ imagetag_cmdline_release (&local_args_info);
if ( error )
return (EXIT_FAILURE);
failure:
- cmdline_parser_release (&local_args_info);
+ imagetag_cmdline_release (&local_args_info);
return (EXIT_FAILURE);
}
/** @file imagetag_cmdline.h
* @brief The header file for the command line option parser
- * generated by GNU Gengetopt version 2.22.4
+ * generated by GNU Gengetopt version 2.22.5
* http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */
extern "C" {
#endif /* __cplusplus */
-#ifndef CMDLINE_PARSER_PACKAGE
+#ifndef IMAGETAG_CMDLINE_PACKAGE
/** @brief the program name (used for printing errors) */
-#define CMDLINE_PARSER_PACKAGE "imagetag"
+#define IMAGETAG_CMDLINE_PACKAGE "imagetag"
#endif
-#ifndef CMDLINE_PARSER_PACKAGE_NAME
+#ifndef IMAGETAG_CMDLINE_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
-#define CMDLINE_PARSER_PACKAGE_NAME "imagetag"
+#define IMAGETAG_CMDLINE_PACKAGE_NAME "imagetag"
#endif
-#ifndef CMDLINE_PARSER_VERSION
+#ifndef IMAGETAG_CMDLINE_VERSION
/** @brief the program version */
-#define CMDLINE_PARSER_VERSION "2.0.0"
+#define IMAGETAG_CMDLINE_VERSION "2.0.0"
#endif
/** @brief Where the command line options are stored */
int pad_arg; /**< @brief Pad the image to this size if smaller (in MiB). */
char * pad_orig; /**< @brief Pad the image to this size if smaller (in MiB) original value given at command line. */
const char *pad_help; /**< @brief Pad the image to this size if smaller (in MiB) help description. */
+ int align_rootfs_flag; /**< @brief Align the rootfs start to erase block size (default=off). */
+ const char *align_rootfs_help; /**< @brief Align the rootfs start to erase block size help description. */
unsigned int help_given ; /**< @brief Whether help was given. */
unsigned int version_given ; /**< @brief Whether version was given. */
unsigned int reserved2_given ; /**< @brief Whether reserved2 was given. */
unsigned int kernel_file_has_header_given ; /**< @brief Whether kernel-file-has-header was given. */
unsigned int pad_given ; /**< @brief Whether pad was given. */
+ unsigned int align_rootfs_given ; /**< @brief Whether align-rootfs was given. */
} ;
/** @brief The additional parameters to pass to parser functions */
-struct cmdline_parser_params
+struct imagetag_cmdline_params
{
int override; /**< @brief whether to override possibly already present options (default 0) */
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
* @param args_info the structure where option information will be stored
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser (int argc, char **argv,
+int imagetag_cmdline (int argc, char **argv,
struct gengetopt_args_info *args_info);
/**
* @param initialize whether to initialize the option structure my_args_info
* @param check_required whether to check that all required options were provided
* @return 0 if everything went fine, NON 0 if an error took place
- * @deprecated use cmdline_parser_ext() instead
+ * @deprecated use imagetag_cmdline_ext() instead
*/
-int cmdline_parser2 (int argc, char **argv,
+int imagetag_cmdline2 (int argc, char **argv,
struct gengetopt_args_info *args_info,
int override, int initialize, int check_required);
* @param params additional parameters for the parser
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser_ext (int argc, char **argv,
+int imagetag_cmdline_ext (int argc, char **argv,
struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params);
+ struct imagetag_cmdline_params *params);
/**
* Save the contents of the option struct into an already open FILE stream.
* @param args_info the option struct to dump
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser_dump(FILE *outfile,
+int imagetag_cmdline_dump(FILE *outfile,
struct gengetopt_args_info *args_info);
/**
* @param args_info the option struct to save
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser_file_save(const char *filename,
+int imagetag_cmdline_file_save(const char *filename,
struct gengetopt_args_info *args_info);
/**
* Print the help
*/
-void cmdline_parser_print_help(void);
+void imagetag_cmdline_print_help(void);
/**
* Print the version
*/
-void cmdline_parser_print_version(void);
+void imagetag_cmdline_print_version(void);
/**
- * Initializes all the fields a cmdline_parser_params structure
+ * Initializes all the fields a imagetag_cmdline_params structure
* to their default values
* @param params the structure to initialize
*/
-void cmdline_parser_params_init(struct cmdline_parser_params *params);
+void imagetag_cmdline_params_init(struct imagetag_cmdline_params *params);
/**
- * Allocates dynamically a cmdline_parser_params structure and initializes
+ * Allocates dynamically a imagetag_cmdline_params structure and initializes
* all its fields to their default values
- * @return the created and initialized cmdline_parser_params structure
+ * @return the created and initialized imagetag_cmdline_params structure
*/
-struct cmdline_parser_params *cmdline_parser_params_create(void);
+struct imagetag_cmdline_params *imagetag_cmdline_params_create(void);
/**
* Initializes the passed gengetopt_args_info structure's fields
* (also set default values for options that have a default)
* @param args_info the structure to initialize
*/
-void cmdline_parser_init (struct gengetopt_args_info *args_info);
+void imagetag_cmdline_init (struct gengetopt_args_info *args_info);
/**
* Deallocates the string fields of the gengetopt_args_info structure
* (but does not deallocate the structure itself)
* @param args_info the structure to deallocate
*/
-void cmdline_parser_free (struct gengetopt_args_info *args_info);
+void imagetag_cmdline_free (struct gengetopt_args_info *args_info);
/**
* Checks that all the required options were specified
* possible errors
* @return
*/
-int cmdline_parser_required (struct gengetopt_args_info *args_info,
+int imagetag_cmdline_required (struct gengetopt_args_info *args_info,
const char *prog_name);
-extern const char *cmdline_parser_second_image_flag_values[]; /**< @brief Possible values for second-image-flag. */
-extern const char *cmdline_parser_inactive_values[]; /**< @brief Possible values for inactive. */
+extern const char *imagetag_cmdline_second_image_flag_values[]; /**< @brief Possible values for second-image-flag. */
+extern const char *imagetag_cmdline_inactive_values[]; /**< @brief Possible values for inactive. */
#ifdef __cplusplus