

                         Tadzio's File Compare
                         =====================

                               Version 2.21a

               (c) 1997-1999 Daniel Schroeder (tadzio@tadzio.com)


For a list of changes since the last version see "10. Version History"
at the end of this document!


0. Contents
-----------

 1. What is it?
 2. It's free!
 3. Legal stuff
 4. Command line options
 5. Interactive usage
 6. What does 'Tadzio' stand for?
 7. Known bugs and problems
 8. Future plans
 9. Getting the latest version
10. Version history
11. Contacting the author



1. What is it?
--------------

Tadzio's File Compare (or tfc) is a small and fast side-by-side file compare
utility for Windows 9x and NT. It takes two file names from the command line
(or one file name and one directory, or some wildcards - see below) and
displays them side-by-side in a console window, highlighting differing
lines. Tfc employs a sophisticated resync mechanism to find matching portions
of the two files. It will allow you two scroll through the two files, modify
comparison criteria like case sensitivity or ignoring empty lines, and jump
directly to the next or previous difference.

You may use it, for example, to compare your CONFIG.SYS to CONFIG.BAK to find
out what that install routine you just ran did to your CONFIG.SYS.

Tfc was modelled after "Jeff's file compare" which was included in later
versions of XTree, but has an improved resync mechanism and a better user
interface. It was designed to be used both as a stand-alone program and a
plug-in for Kim Henkel's great XTree clone ZTree Win (available at 
www.ztree.com; starting with version 1.30, ZTree Win distribution archives
include tfc).

Note: Tfc treats any single Carriage Return (CR), single Line Feed (LF), and
CR/LF combination as end-of-line character. It does not differentiate between
them which means that tfc treats files that differ only in their end-of-line
character as identical. 


2. It's free!
-------------

That's right - it will cost you nothing! If you like it and still feel
you want to give someone some money, I'd be very happy if you'd make a
donation to any AIDS charity organisation.

Oh, and as I'm the curious type, I'd appreciate you sending an e-mail to
tadzio@tadzio.com (that's me :-)) if you use it regularly. Thanks!




3. Legal stuff
--------------

Copyright:

Tfc is copyrighted material. That means you must not do things to tfc I didn't
allow you. Especially, don't sell it (give it away for free instead), don't
alter or disassemble it.

In former versions, I didn't allow tfc to be used in miltary environment.
After an intense e-mail discussion, I now dropped this restriction. 
Instead, please read the HOWTO.TXT file in this archive.


Warranty:

Basically, "you get what you pay for." So there's no warranty at all. I will
not be liable for any damage, loss of profit or other consequences arising out
of the use of Tadzio's File Compare utility.
That said, I can assure you I did my best as a professional programmer to make
tfc as safe as I could. Both files to be compared are opened in read-only mode
and closed again as soon as they are read into memory. Tfc never attempts to
write to your hard disk (except for its configuration file, tfc.ini, and maybe
triggering Windows' memory swapping mechanism if you compare very large files),
so it's highly unlikely that anything on your hard disk gets corrupted.
Also, tfc knows nothing about MAPI or TCP/IP, so it will never send any
information to anyone over a network.




4. Command line options
-----------------------

                 tfc [-options] file1 [file2]

[] denote optional parts.

file1: Any valid file name, with or without path. Long file names are
  supported. If it contains blanks, surround it with double quotes.
  You can not use wildcards ('*' and '?') here.

file2: Either a file name or a directory or nothing. If you do not specify
  file2, tfc assumes the same name as file1, with the extension changed
  to '.bak'.
  If you specify a directory, tfc will append the name and extension portion
  (omitting the drive and directory parts, if any) of file1 to it. You may
  specify the directory with or without a trailing backslash.
  You may replace the name and/or extension portion of file2 with an asterisk.
  In that case, the corresponding part of file1 is used in place of that
  wild card. The question mark wild card '?' is not supported.

Examples: this command line      |  compares file     |     to file
-----------------------------------------------------------------------------
 tfc c:\config.sys               |  c:\config.sys     | c:\config.bak
 tfc c:\config.sys  c:\backup    |  c:\config.sys     | c:\backup  (see Note)
                                 |                    | c:\backup\config.sys
 tfc c:\config.sys  *.old        |  c:\config.sys     | c:\config.old
 tfc c:\config.sys  d:\aaa\*.old |  c:\config.sys     | d:\aaa\config.old
 tfc autoexec.bat   4start.*     |  autoexec.bat      | 4start.bat
 tfc "Letter to Diane"           |  "Letter to Diane" | "Letter to Rosie"
             "Letter to Rosie"   |                    |

Note: If c:\backup exists; if not, tfc tries c:\backup\config.sys instead.
------------------------------------------------------------------------------


Options:

-aXX: Set window height to XX lines. XX must be at least 12. The upper limit
  depends on the operating system. This actually sets the "Window Buffer Size".
  If this is lower than your DOS box's "Window Height", Windows will reduce
  the "Window Height" accordingly. However, if you set XX to a higer value
  than "Window Height", Windows will merely add a vertical scroll bar, but not
  enlarge the DOS box itself. ("Window Height" and "Window Buffer Size" can
  be changed in the "Layout" tab of a DOS box's properties.)
  By the way: in case you wondered why I chose "-a" for this option: I just ran
  out of more meaningful letters...

-b: Batch mode. The two files are compared, a one-line-info is printed ("The
  file are identical" or "The files are not identical"), and tfc exits with
  one of the following error levels:
  0: files are identical
  1: files are not identical
  2: one of the files could not be found or opened
  3: out of memory (though I'm not sure if this will ever happen under Win32)
  This option is meant for using tfc in batch files, e.g. for synchronising
  directories or automatically checking if a file has changed before backing it
  up.

-c: Case insensitive compare. By default, tfc treats upper case and lower case
  characters as different. This option treats German umlauts correctly!

-d: Toggles highlighting of differing characters within a line on or off.
  Turning this on may slow down tfc a bit, and may make for a confusing display
  if lines are totally different, so that characters will only randomly match.

-e: Suppress empty lines. All lines that contain only whitespace
  characters (blanks, tabs) are ignored during compare and display.

-h: Toggles between hex and ASCII mode. The toggle affects the compare
  routines as well as the display routines. In hex mode, every line contains
  as many characters as can be displayed at this moment.
  Note that as of version 2.20, tfc will *not* try to resync files in hex
  mode, as most users seem to use it for files where some bytes were *changed*,
  but not inserted or deleted. This is experimental - if you don't like it,
  let me know, and I'll make it configurable!

-l: No line numbers are displayed.

-n: Same as -l, for compatibility with JFC

-o: Toggles between OEM and ANSI character sets. OEM (or ASCII) is used by
  DOS-based programs, whereas Windows-based programs use ANSI.

-s: Sync scan +500 lines. If tfc finds two lines to be different, it assumes
  some lines were inserted in one of the files, and the matching line is some-
  where further down in the file. So by default it scans the next 100 lines
  to find it ("resync"). If you compare files of which you know that more than
  100 lines were inserted somewhere, you may want to use this option. However,
  this may slow down tfc considerably.

-v: Start with a vertically split display. The default is a horizontally split
  display (new for 2.1)

-w: Compress white space. All sequences of one or more whitespace characters
  are treated as one single blank character during compare and display. This
  makes it possible to compare two versions of a file where one version has
  tabs, and some editor changed those tabs to a series of blanks in the second
  version.




5. Interactive usage
--------------------

By default, tfc displays the two file on a horizontally split
screen. The colors are taken from tfc.ini, if it can be found in the
directory where tfc.exe lives; otherwise, tfc tries to read the colors
from ZTW.INI. If that also fails, default colors are used. There is a
color setup utility built into tfc (try pressing Alt-F10) that creates
tfc.ini.

If the files to compare are identical, tfc tells you so, waits for a key 
stroke (not in batch mode) and exits.

The usual cursor keys can be used to navigate through the two files. They work
like in any other program, with one additional feature: If you scrolled the
display to the right, Pos1 (Home) does not jump to the beginning of the files,
but rather to the beginning of the line. If you press it again, tfc then 
will jump to the beginning of the files.

'+' and '-' jump to the next and previous block of different lines,
respectively. If there is no such block, they jump to the end resp. beginning
of the files. The space bar functions identically to '+'.

's' toggles between horizontal and vertical splitting of the screen.

'h' toggles between hex and ASCII mode. The toggle affects the compare
routines as well as the display routines. In hex mode, every line contains
either eight (vertical-split) or 16 (horizontal-split) characters.
The line number display changes to a file-offset display, using hexadecimal
numbers.

'l' (thats an ell) toggles line numbers on and off - for those of you who want
to see more of the files and are not interested in line numbers. For
compatibility with jfc, 'n' is also accepted. In hex mode, the line number
display changes to a file offset hex display that cannot be switched off.

't' toggles between 25 lines and x lines display, where x is either 50 (if tfc
was started in 25-lines-mode) or the number of lines of the active mode when
tfc was started (otherwise). Regardless of the state of this toggle, when
exiting tfc always switches back to the mode that was active when tfc was
started.

'1'...'9' sets the display width of tab characters. Note that this does NOT
have any impact on the compare operation, only on the display!

'c' toggles between case sensitive compare (the default) and case-insensitive
compare. The case-insensitive setting handles German umlauts correctly!

'o' toggles between OEM and ANSI character sets. OEM (or ASCII) is used by
DOS-based programs, whereas Windows-based programs use ANSI.

'w' toggles white space compression on and off. If on, all sequences of
whitespace characters (blanks, tabs) in the two files are replaced by one
single blank. This affects the compare operation as well as the display.

'e' toggles empty line suppression on and off. If on, all lines that contain
nothing but blanks and/or tabs are ignored.

F1 gives you access to the online help, although I feel tfc is so easy and
intuitive to use that the online help shouldn't be really necessary.

Alt-F10 invokes the color setup facility, see below.

ESC and ENTER both exit tfc.




5a. Color Setup
---------------

There is a built-in color setup facility that can be invoked by
pressing Alt-F10.

The color setup facility allows you to customize tfc's color scheme.
The colors are stored in a file named tfc.ini in the same directory as
tfc.exe (which may be different from the current directory!)

The color setup screen shows two sample files which contain elements of all
possible colors. Note that during 'real' usage you need to toggle 'Diff chars'
on to see the 'Differing chars in differing line' color.

To change a foreground color, use uppercase letters, e.g. Shift-f or Shift-i.
To change background colors, just use the indicated letters, e.g. 'f' or 'i'.
The meaning of 'f', 'i', and 'l' should be rather self-explanatory.
'm' and 'd' are for characters in lines that differ between the two files.
'r' restores a built-in default color scheme - in case you got totally
lost. 'k' deletes the file 'tfc.ini' from disk. If you called tfc from
within ZTree, tfc reverts back to ZTree's color scheme. Otherwise, tfc uses
its default scheme. By pressing ESC, all changes (except deleting tfc.ini)
will be discarded. ENTER on the other hand writes the current color scheme to
tfc.ini, regardless of how the color scheme was created (inherited by ZTree,
'R'estored, etc).
Note that if you want tfc to inherit ZTree's color scheme each time you use
it, you'll have to first 'k'ill tfc.ini, then press ESC - do NOT press ENTER,
as this would write a new tfc.ini, overriding ZTree's settings.




6. What does 'Tadzio' stand for?
--------------------------------

Tadzio is a nick name for 'Tadaeusz', a common Eastern European name. I used
it as a handle/nick ever since I bought my first modem. I even ran a BBS named
'Tadzio BBS' for several years.

Tadzio is one of the two main characters in Thomas Mann's novel "Tod in
Venedig" ("Death in Venice"). It's about a German doctor named 
"Aschenbach" who visits Venice in the early decades of this century. He sees
Tadzio, the 16-year-old son of a polish baroness, and is absolutely fascinated
of him. But society on the one hand and his moral education on the other make
it impossible for him to even talk to Tadzio, although the boy noticed him.
Aschenbach dies, superficially from the plague, but metaphorically from
the conflict between his feelings and his education, and the unability to live
by his feelings. That same conflict and the same feelings are also present in
Thomas Mann's life.

There also is an excellent film by Luchino Visconti. And now back to the
profanities of computer programs... :-)




7. Know bugs and problems
-------------------------

If a tab character is scrolled out of the left side of an window, the
remainder of that line jumps left to the window border. Fixing this would make
tfc much slower, so I hope you can live with it...
The performance for very large files allows you to feed your cat while waiting
for tfc to display the files...



8. Future plans
---------------

That depends largely on the feedback I get from you. So, if you like it, or
if you have ideas for additional features, email me! I can be reached under
tadzio@tadzio.com.



9. Getting the latest version
-----------------------------

The latest version will always be available at http://www.tadzio.com (this 
site is in German, but you don't have to speak German. Just click on 'Home of
tfc', then on 'Download', and there you go!).
Alternatively, you can get it bundled with Kim Henkel's ZTreeWin from his site
at http://www.ztree.com.




10. Version history
------------------
2.21a 1999-12-13 - Change: When window height is specified using -aXX,
                   the previous state is *not* restored on exit. This
                   should help ZTree users.
                 - Change: back to old window height (more correctly:
                   screen buffer height) detection method
                 - Change: better error handling if a WinAPI call to
                   change the screen buffer height fails.
2.21  1999-12-03 - Bugfix: When used stand-alone, tfc hides the cursor
                   and would not re-enable it when exiting - fixed.
2.20  1999-11-28 - Bugfix: file names that included non-ASCII characters
                   were inproperly parsed.
                 - Change: In hex mode, tfc no longer tries to re-sync.
                 - Change: In hex mode, the number of characters on one line
                   is now set to 8 (vertical-split) or 16 (horizontal-split)
                 - Change: In hex mode, a file offset is displayed instead of
                   the line number.
                 - Change: Changed the logic that determines the initial 
                   window height.
                 - Change: tfc is now compiled with MS Visual C++ 6.0, 
                   resulting in a smaller executable file.
                 - Change: Version history now uses standardized date 
                   format ;-)

2.13  6/6/1999   - New: Command line switch -aXX to set window height to XX
                   lines.

2.12  4/27/1999  - Bugfix: Command line switch -n was not documented
                   at all, -v was missing in internal documentation.

2.11  4/26/1999  - Bugfix: tfc incorrectly stated that two files were
                   identical when the first n characters were identical,
                   where n is the length of the first file, and the
                   second file was longer than the first. 

2.10  4/23/1999  - Bugfix: Cursor keys didn't work in Windows 9x when a
                   keyboard driver was loaded in CONFIG.SYS. This is the
                   case for all non-english versions of Windows. NT was
                   not affected.
                 - Change: The display is now split horizontally by default.
                 - Added: New command line switch '/s' to start with a
                   vertically split display, as pre-2.1 versions did.
                 - Added: The color setup is now better documented.
                 - Change: The restriction for usage in a military 
                   environment was removed.

2.02  2/21/1999  - Bugfix: Command line parameters ending in \" caused a
                   "can't open file" error.
                 - Documentation updates: New email address, own home page,
                   changed tfc.doc to tfc.txt
                 This version was never really released, because literally
                 minutes before I wanted to upload it, someone discovered a
                 serious bug. That's life!

2.01  8/9/1997   - Bugfix: file names that contained special characters (um-
                   lauts etc) weren't treated correctly
                 - New: ANSI/OEM toggle

2.0   8/2/1997   First Windows 95/NT version, based on the old OS/2 code,
                 but many new features.

1.0   9/2/1996   First public OS/2 version.



11. Contacting the author
------------------------

If you have any comments, wishes, or encounter problems, please e-mail me.
My e-mail address is

       tadzio@tadzio.com

Home Of TFC is http://www.tadzio.com. Here you can always get the latest
version.

---
