1
0
Fork 0

Merging upstream version 1.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 20:05:47 +01:00
parent 14c6cd47d9
commit ef2fe9ecc0
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
18 changed files with 733 additions and 665 deletions

View file

@ -1,5 +1,6 @@
/* Arg_parser - POSIX/GNU command line argument parser. (C version)
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Antonio Diaz Diaz.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
Antonio Diaz Diaz.
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -31,7 +32,7 @@
#include "carg_parser.h"
/* assure at least a minimum size for buffer `buf' */
/* assure at least a minimum size for buffer 'buf' */
static void * ap_resize_buffer( void * buf, const int min_size )
{
if( buf ) buf = realloc( buf, min_size );
@ -108,31 +109,31 @@ static char parse_long_option( struct Arg_parser * const ap,
if( ambig && !exact )
{
add_error( ap, "option `" ); add_error( ap, opt );
add_error( ap, "option '" ); add_error( ap, opt );
add_error( ap, "' is ambiguous" );
return 1;
}
if( index < 0 ) /* nothing found */
{
add_error( ap, "unrecognized option `" ); add_error( ap, opt );
add_error( ap, "unrecognized option '" ); add_error( ap, opt );
add_error( ap, "'" );
return 1;
}
++*argindp;
if( opt[len+2] ) /* `--<long_option>=<argument>' syntax */
if( opt[len+2] ) /* '--<long_option>=<argument>' syntax */
{
if( options[index].has_arg == ap_no )
{
add_error( ap, "option `--" ); add_error( ap, options[index].name );
add_error( ap, "option '--" ); add_error( ap, options[index].name );
add_error( ap, "' doesn't allow an argument" );
return 1;
}
if( options[index].has_arg == ap_yes && !opt[len+3] )
{
add_error( ap, "option `--" ); add_error( ap, options[index].name );
add_error( ap, "option '--" ); add_error( ap, options[index].name );
add_error( ap, "' requires an argument" );
return 1;
}
@ -143,7 +144,7 @@ static char parse_long_option( struct Arg_parser * const ap,
{
if( !arg || !arg[0] )
{
add_error( ap, "option `--" ); add_error( ap, options[index].name );
add_error( ap, "option '--" ); add_error( ap, options[index].name );
add_error( ap, "' requires an argument" );
return 1;
}