#cache expansions of constant strings
cexpand={}
-def varexpand(mystring,mydict={}):
+def varexpand(mystring, mydict={}):
newstring = cexpand.get(" "+mystring, None)
if newstring is not None:
return newstring
"""
- new variable expansion code. Removes quotes, handles \n, etc.
+ new variable expansion code. Preserves quotes, handles \n, etc.
This code is used by the configfile code, as well as others (parser)
This would be a good bunch of code to port to C.
"""
if (indoub):
newstring=newstring+"'"
else:
+ newstring += "'" # Quote removal is handled by shlex.
insing=not insing
pos=pos+1
continue
if (insing):
newstring=newstring+'"'
else:
+ newstring += '"' # Quote removal is handled by shlex.
indoub=not indoub
pos=pos+1
continue