summaryrefslogtreecommitdiffstats
path: root/pdarg_parser.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pdarg_parser.c (renamed from carg_parser.c)23
1 files changed, 12 insertions, 11 deletions
diff --git a/carg_parser.c b/pdarg_parser.c
index f797b75..71dc5d0 100644
--- a/carg_parser.c
+++ b/pdarg_parser.c
@@ -1,5 +1,5 @@
-/* Pdlzip - A data compressor based on the LZMA algorithm
- Copyright (C) 2010 Antonio Diaz Diaz.
+/* Pdlzip - Data compressor based on the LZMA algorithm
+ Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
This program is free software: you have unlimited permission
to copy, distribute and modify it.
@@ -12,10 +12,10 @@
#include <stdlib.h>
#include <string.h>
-#include "carg_parser.h"
+#include "pdarg_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 );
@@ -29,7 +29,8 @@ static char push_back_record( struct Arg_parser * const ap,
{
const int len = strlen( argument );
struct ap_Record *p;
- void * tmp = ap_resize_buffer( ap->data, ( ap->data_size + 1 ) * sizeof (struct ap_Record) );
+ void * tmp = ap_resize_buffer( ap->data,
+ ( ap->data_size + 1 ) * sizeof (struct ap_Record) );
if( !tmp ) return 0;
ap->data = (struct ap_Record *)tmp;
p = &(ap->data[ap->data_size]);
@@ -91,31 +92,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;
}
@@ -126,7 +127,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;
}