diff --git a/twander.py b/twander.py index 1871ca6..1201b1f 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.123 2003/03/03 23:39:34 tundra Exp $" +RCSID = "$Id: twander.py,v 3.124 2003/03/04 00:13:31 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -1063,8 +1063,11 @@ if idx > -1: line = line[:idx] + # Strip off leading/trailing spaces + cleanline = line.strip() + # Split what's left into separate fields again - fields = line.split() + fields = cleanline.split() # Make a copy of the fields which is guaranteed to have at # least two fields for use in the variable declaration tests. @@ -1112,9 +1115,9 @@ if fields[0] == CONDIF: # Process string equality checks - if line.count(CONDEQUAL): + if cleanline.count(CONDEQUAL): - x = line[len(CONDIF):].split(CONDEQUAL) + x = cleanline[len(CONDIF):].split(CONDEQUAL) if len(x) != 2: WrnMsg(wBADIF % (num, line)) return @@ -1136,9 +1139,9 @@ # Process string inequality checks - elif line.count(CONDNOTEQUAL): + elif cleanline.count(CONDNOTEQUAL): - x = line[len(CONDIF):].split(CONDNOTEQUAL) + x = cleanline[len(CONDIF):].split(CONDNOTEQUAL) if len(x) != 2: WrnMsg(wBADIF % (num, line)) return @@ -1249,9 +1252,9 @@ elif ((dummy[0].count(ASSIGN) + dummy[1].count(ASSIGN)) > 0) and (fields[0][0] != ASSIGN): - assign = line.find(ASSIGN) - name = line[:assign].strip() - val=line[assign+1:].strip() + assign = cleanline.find(ASSIGN) + name = cleanline[:assign].strip() + val=cleanline[assign+1:].strip() # Error out on variable redefinitions of either # existing user-defined variables or built-ins @@ -1360,7 +1363,7 @@ cmd = " ".join(fields[2:]) # Process any User-Defined variables - cmd = ProcessVariables(cmd, num, line) + cmd = ProcessVariables(cmd, num, cleanline) # A null return means there was a problem - abort if not cmd: