1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-10 23:49:50 +02:00

* argparse.c (optfile_parse): Remove quotes only if they totally enclose

the string, and do not occur within the string.  This makes specifying a
program under Win32 easier when you need quotes around part of a string,
but not around the whole string.
This commit is contained in:
David Shaw 2002-05-03 13:20:00 +00:00
parent cc0074dc5a
commit 8b7d2475bb
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2002-05-03 David Shaw <dshaw@jabberwocky.com>
* argparse.c (optfile_parse): Remove quotes only if they totally
enclose the string, and do not occur within the string. This
makes specifying a program under Win32 easier when you need quotes
around part of a string, but not around the whole string.
2002-05-02 Werner Koch <wk@gnupg.org>
* memory.c (alloc): Malloc at least 1 byte. Noted by Winona Brown.

View File

@ -327,10 +327,19 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
trim_spaces( buffer );
p = buffer;
if( *p == '"' ) { /* remove quotes */
p++;
if( *p && p[strlen(p)-1] == '"' )
p[strlen(p)-1] = 0;
/* remove quotes if they totally enclose the
string, and do not occur within the string */
if( *p == '"' && p[strlen(p)-1]=='"') {
char *i=p;
while(*(++i))
if(*i=='"')
break;
if(*i=='"' && *(i+1)=='\0') {
p[strlen(p)-1] = 0;
p++;
}
}
if( !set_opt_arg(arg, opts[idx].flags, p) )
m_free(buffer);