@ -1,7 +1,7 @@
/*
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 :
@ -59,6 +59,7 @@ const char *gengetopt_args_info_help[] = {
" --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
} ;
@ -66,7 +67,7 @@ typedef enum {ARG_NO
, ARG_FLAG
, ARG_STRING
, ARG_INT
} cmdline_parser _arg_type ;
} imagetag_ cmdline_arg_type;
static
void clear_given ( struct gengetopt_args_info * args_info ) ;
@ -74,14 +75,14 @@ static
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 ) ;
@ -116,6 +117,7 @@ void clear_given (struct gengetopt_args_info *args_info)
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
@ -169,6 +171,7 @@ void clear_args (struct gengetopt_args_info *args_info)
args_info - > reserved2_orig = NULL ;
args_info - > kernel_file_has_header_flag = 0 ;
args_info - > pad_orig = NULL ;
args_info - > align_rootfs_flag = 0 ;
}
@ -204,19 +207,20 @@ void init_args_info(struct gengetopt_args_info *args_info)
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 ) ;
@ -231,7 +235,7 @@ static void print_help_common(void) {
}
void
cmdline_parser _print_help ( void )
imagetag_ cmdline_print_help ( void )
{
int i = 0 ;
print_help_common ( ) ;
@ -240,7 +244,7 @@ cmdline_parser_print_help (void)
}
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 ) ;
@ -248,7 +252,7 @@ cmdline_parser_init (struct gengetopt_args_info *args_info)
}
void
cmdline_parser _params_init ( struct cmdline_parser _params * params )
imagetag_ cmdline_params_init( struct imagetag_ cmdline_params * params )
{
if ( params )
{
@ -260,12 +264,12 @@ cmdline_parser_params_init(struct cmdline_parser_params *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 ;
}
@ -281,7 +285,7 @@ free_string_field (char **s)
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 ) ) ;
@ -390,13 +394,13 @@ write_into_file(FILE *outfile, const char *opt, const char *arg, const char *val
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 ;
}
@ -445,15 +449,17 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
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 ;
@ -461,7 +467,7 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
}
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 ;
@ -470,20 +476,20 @@ cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_
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 */
@ -502,21 +508,21 @@ gengetopt_strdup (const char *s)
}
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_parser 2 ( 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 ) ;
}
@ -524,10 +530,10 @@ cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info
}
int
cmdline_parser 2 ( 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 ;
@ -535,11 +541,11 @@ cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, i
params . check_ambiguity = 0 ;
params . print_errors = 1 ;
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 ) ;
}
@ -547,16 +553,16 @@ cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, i
}
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 ) ;
}
@ -564,7 +570,7 @@ cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog
}
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 ) ;
@ -631,8 +637,8 @@ static char *package_name = 0;
* @ 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
@ -644,7 +650,7 @@ int update_arg(void *field, char **orig_field,
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 ,
@ -747,9 +753,9 @@ int update_arg(void *field, char **orig_field,
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. */
@ -769,9 +775,9 @@ cmdline_parser_internal (
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 ;
@ -810,6 +816,7 @@ cmdline_parser_internal (
{ " reserved2 " , 1 , NULL , 0 } ,
{ " kernel-file-has-header " , 0 , NULL , 0 } ,
{ " pad " , 1 , NULL , ' p ' } ,
{ " align-rootfs " , 0 , NULL , 0 } ,
{ 0 , 0 , 0 , 0 }
} ;
@ -820,13 +827,13 @@ cmdline_parser_internal (
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.. */
@ -1094,7 +1101,7 @@ cmdline_parser_internal (
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 ) )
@ -1108,7 +1115,7 @@ cmdline_parser_internal (
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 ) )
@ -1140,6 +1147,18 @@ cmdline_parser_internal (
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 ;
@ -1148,7 +1167,7 @@ cmdline_parser_internal (
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 */
@ -1157,10 +1176,10 @@ cmdline_parser_internal (
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 ) ;
@ -1169,6 +1188,6 @@ cmdline_parser_internal (
failure :
cmdline_parser _release ( & local_args_info ) ;
imagetag_ cmdline_release ( & local_args_info ) ;
return ( EXIT_FAILURE ) ;
}