diff --git a/tconfpy.py b/tconfpy.py index 3ada51b..fe27a59 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -1,12 +1,12 @@ #!/usr/bin/env python # tconfpy.py -# Copyright (c) 2003 TundraWare Inc. All Rights Reserved. +# Copyright (c) 2003-2004 TundraWare Inc. All Rights Reserved. # For Updates See: http://www.tundraware.com/Software/tconfpy # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.104 2004/03/12 00:38:47 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.105 2004/03/12 00:58:52 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -62,7 +62,7 @@ # General Constants MSGPOS = 10 # Where to start message output -PARSEOK = True # Indicates successful parsing + # Reserved Symbols @@ -252,28 +252,16 @@ SymTable = Options TotalLines = 0 - # Begin parsing + # Parse the file - try: - ParseFile(cfgfile) + ParseFile(cfgfile) - # Return the parsing results + # Return the parsing results - if DEBUG: - DebugMsg(dNUMLINES %(cfgfile, TotalLines)) + if DEBUG: + DebugMsg(dNUMLINES %(cfgfile, TotalLines)) - return (SymTable, ErrMsgs, WarnMsgs, DebugMsgs, PARSEOK) - - # Something went wrong - - except: - - if DEBUG: - DebugMsg(dNUMLINES %(cfgfile, TotalLines)) - - ErrorMsg(eCONFOPEN % cfgfile) - return (SymTable, ErrMsgs, WarnMsgs, DebugMsgs, not PARSEOK) - + return (SymTable, ErrMsgs, WarnMsgs, DebugMsgs) # End of 'ParseConfig()' @@ -303,21 +291,29 @@ global IgnoreCase, MsgList, SymTable, TotalLines - cf = open(cfgfile) - # Successful open of config file - Begin processing it - - linenum=0 - - # Process and massage the configuration file - for line in cf.read().splitlines(): - linenum += 1 - TotalLines += 1 + try: - # Parse this line - ParseLine(line, cfgfile, linenum) + cf = open(cfgfile) + # Successful open of config file - Begin processing it - # Close the config file - cf.close() + linenum=0 + + # Process and massage the configuration file + for line in cf.read().splitlines(): + linenum += 1 + TotalLines += 1 + + # Parse this line + ParseLine(line, cfgfile, linenum) + + # Close the config file + cf.close() + + + # File open failed for some reason + except: + + ErrorMsg(eCONFOPEN % cfgfile) # Record the error # End of 'ParseFile()'