Comment ========================================================== Computer Tyme IniDif * Copyright 1993-99 by Marc Perkel All Rights Reserved Computer Tyme * 309 North Jefferson, Suite 220 * Springfield Mo. 65806 (800) 548-5353 Sales * (417) 866-1222 Voice * (417) 866-1665 Fax/Data IniDif is a Windows *.INI file comparer. It is designed to assist the network administrator who has to maintain INI files for many users. USAGE: INIDIF OrigFile OldFile ChangeFile Example: INIDIF SYSTEM.INI SYSTEM.OLD SYSTEM.CTL ========================================================== EndComment ;#Define McAfee ;#Define Shareware ;------ Create Variables var NewFileName NewIni NewSec NewSecFlags NewIniFlags OrigFileName OrigIni OrigSec ChangeFileName Changes DupList SectionName SectionNum LastSection Main ;======================= P R O C E D U R E S =========================== Procedure Help Writeln 'Computer Tyme INIDIF * Copyright 1993-99 by Marc Perkel' Writeln 'All Rights Reserved * Version 2.3 * Release Date: 10-21-99' #If McAfee Writeln Writeln 'Licensed to Network Associates Inc. from Marc Perkel' Writeln 'This software will expire on 07-01-2000' Writeln 'Contact Computer Tyme for License Extension Information' #Endif Include 'ADDRESS.INC' Writeln 'INIDIF compares two INI files and produces a third file that contains' Writeln 'the differences between the two INI files. This allows you to install' Writeln 'a Orig windows program and compare the changed INI file to the Newinal' Write 'INI file. The change file can then be used with ' #If McAfee Write 'INITOOL' #Else Write 'INITYME' #Endif Writeln ' to apply the same' Writeln 'changes to other INI files of other users on a network.' Writeln Writeln 'USAGE: INIDIF OrigFile OldFile ChangeFile' Writeln Writeln 'Example:' Writeln ' INIDIF SYSTEM.INI SYSTEM.OLD SYSTEM.CTL' Writeln Writeln 'Price: $95/25 Users * $500/250 Users * $2500/2500 Users' ExitMenu EndProc #If Shareware Procedure Beg BoxHeader ' * Shameless Beg Screen * ' DrawBox 10 8 61 6 Writeln WriteCenter '* IniDif Evaluation Copy *' Writeln WriteCenter 'Please remember to register this software.' Wait 600 EraseTopWindow ClearKbdBuffer EndProc #Endif Procedure AddIniExtension (Name) if pos('.',Name) > 0 then Return Name Return ForceExtension(Name,'INI') EndProc Procedure RemoveExtraBlankLines var Tmp Trim(Changes) Tmp = Changes dispose Changes Loop Tmp if (LoopVal > '') or (Tmp[LoopIndex + 1] > '') AppendArray(Changes,LoopVal) endif EndLoop EndProc Procedure Setup #If Shareware BlankTime = 0 BoxBorderColor Green Blue BoxInsideColor White Blue BoxHeaderColor Yellow Mag Beg #Endif StandardIO UpperCaseCompare On Writeln ExitCode = 0 NewFileName = AddIniExtension(ParamStr(2)) OrigFileName = AddIniExtension(ParamStr(3)) ChangeFileName = AddIniExtension(ParamStr(4)) #If McAfee if (Now >= TimeOf '07-01-2000') Help endif #Endif if (ChangeFileName = '') or not ExistFile(OrigFileName) or not ExistFile(NewFileName) Help endif AppendArray(DupList,'[386ENH]DEVICE=') EndProc Procedure ProcessFile Write 'Reading File ' OrigFileName ' ... ' ReadIniFile(OrigFileName,OrigIni,OrigSec) Writeln Write 'Reading File ' NewFileName ' ... ' ReadIniFile(NewFileName,NewIni,NewSec) Writeln Log('; Changes to turn ' + OrigFileName + ' into ' + NewFileName) Log('; File created: ' + DateString + ' ' + TimeString) Log '' Write 'Building Indexes ... ' IndexIniFile(NewIni,NewSec,DupList) Writeln Write 'Comparing Files ... ' CompareFiles Writeln Write 'Removing Extra Blank Lines ... ' RemoveExtraBlankLines Writeln Write 'Writing Changes to ' ChangeFileName ' ... ' WriteTextFile(ChangeFileName,Changes) Writeln Writeln 'Done!' EndProc Procedure Log ($St) AppendArray(Changes,St) EndProc Procedure LogChange ($St) if SectionName <> LastSection Log '' Log SectionName LastSection = SectionName endif if St > '' then Log St EndProc Procedure CompareFiles var Key P S X DupSt Loop OrigSec SectionName = LoopVal SectionNum = LoopIndex S = Hash(SectionName) if S = 0 Log '' Log 'Del ' SectionName else NewSecFlags[S] = True P = PosInListLeft(SectionName,DupList) if P > 0 DupSt = DupList[P] else DupSt = '' endif Loop OrigIni[SectionNum] if LoopVal > '' Key = IniKeyString(SectionName,LoopVal,DupSt) if Key > '' P = Hash(Key) if P[1] = 0 LogChange 'Del ' LoopVal else if NewIni[P[1],P[2]] = LoopVal NewIniFlags[P[2]] = True endif endif endif endif EndLoop Loop NewIni[S] if not NewIniFlags[LoopIndex] if pos('=',LoopVal) > 0 LogChange LoopVal endif endif EndLoop dispose(NewIniFlags) endif EndLoop Loop NewSec if not NewSecFlags[LoopIndex] Log '' Log LoopVal Loop NewIni[LoopIndex] Log LoopVal EndLoop endif EndLoop EndProc Procedure Main Setup ProcessFile EndProc