diff options
author | Werner Koch <wk@gnupg.org> | 1999-07-12 14:57:54 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1999-07-12 14:57:54 +0200 |
commit | 8be0d60594153ee058acbfae91efc0d4d1b17e12 (patch) | |
tree | 07e7e5f3b397c351bca6931578cc19498be60e73 /util/argparse.c | |
parent | See ChangeLog: Thu Jul 8 16:21:27 CEST 1999 Werner Koch (diff) | |
download | gnupg2-8be0d60594153ee058acbfae91efc0d4d1b17e12.tar.xz gnupg2-8be0d60594153ee058acbfae91efc0d4d1b17e12.zip |
See ChangeLog: Mon Jul 12 14:55:34 CEST 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r-- | util/argparse.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/util/argparse.c b/util/argparse.c index 707d75ecf..b6934148b 100644 --- a/util/argparse.c +++ b/util/argparse.c @@ -155,6 +155,7 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno ) log_bug("Invalid argument for ArgParse\n"); } + if( arg->err ) { /* last option was erroneous */ const char *s; @@ -194,6 +195,10 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno ) exit(2); arg->err = 0; } + + /* clearout the return value union */ + arg->r.ret_str = NULL; + arg->r.ret_long= 0; } @@ -309,6 +314,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno, else if( !(opts[idx].flags & 7) ) /* does not take an arg */ arg->r_opt = -6; /* error */ else { + char *p; if( !buffer ) { keyword[i] = 0; buffer = m_strdup(keyword); @@ -317,7 +323,13 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno, buffer[i] = 0; trim_spaces( buffer ); - if( !set_opt_arg(arg, opts[idx].flags, buffer) ) + p = buffer; + if( *p == '"' ) { /* remove quotes */ + p++; + if( *p && p[strlen(p)-1] == '"' ) + p[strlen(p)-1] = 0; + } + if( !set_opt_arg(arg, opts[idx].flags, p) ) m_free(buffer); } break; |