aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/ChangeLog7
-rw-r--r--util/argparse.c17
2 files changed, 20 insertions, 4 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index aad8eb107..f70bf0a1e 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,10 @@
+2002-05-03 David Shaw <[email protected]>
+
+ * 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 <[email protected]>
* memory.c (alloc): Malloc at least 1 byte. Noted by Winona Brown.
diff --git a/util/argparse.c b/util/argparse.c
index 8d54de9da..c3cc3d709 100644
--- a/util/argparse.c
+++ b/util/argparse.c
@@ -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);