Tofrodos Ver 1.7
Copyright (c) 1996-2003 by Christopher Heng. All rights reserved.
-----------------------------------------------------------------

$Id: readme.txt 1.12 2003/11/26 15:20:44 chris Exp $


Contents
--------

1. What Is Tofrodos?
2. What's New In Version 1.7
3. How To Install Tofrodos?
4. Compiling Tofrodos In Linux
5. Compiling Tofrodos In Msdos And Win32
6. Porting To Other Systems
7. History Of Changes
8. Copyright And Contacting The Author


1. What Is Tofrodos?
--------------------

DOS text files traditionally have CR/LF (carriage return/line feed) pairs
as their new line delimiters while Unix text files traditionally have
LFs (line feeds) to terminate each line.

Tofrodos comprises two programs, "fromdos" and "todos", which convert
text files to and from these formats. Use "fromdos" to convert DOS
text files to the Unix format, and "todos" to convert Unix text files
to the DOS format.


2. What's New In Version 1.7
----------------------------

- [Linux/Unix] Bug fix: now handles symbolic link arguments correctly.
This bug only affects Unix-type sytems (like Linux, FreeBSD, OpenBSD,
etc).
- [Linux] tofrodos now uses mkstemp() to create the temporary file to
avoid a race between file name creation and opening which may occur
when using mktemp(). If you use a non-Linux system, and have
mkstemp(), you can take advantage of this by defining HAVE_MKSTEMP
in config.h (defined by default for Linux only).
- [Linux/Unix] "make install" now installs to /usr/bin by default (you
can still change this easily) since Linux distributions using tofrodos
appear to use this value. (This makes it easier for maintainers of
those distributions.)
- [All systems] Made some error messages a bit more informative.
- [All systems] Verbose mode is slightly more informative.
- [Windows] Added support for compiling with the MinGW (GNU) C Compiler
on Win32 systems.
- [All systems] Added an HTML version of the manual page. Useful for
systems that don't have a built-in facility to read a man page (like
MSDOS and Windows).


3. How To Install Tofrodos?
---------------------------

a. Windows 9x/ME/NT/2k/XP

The Tofrodos package comes with sources as well as precompiled
executables (binaries) for the Win32 console mode. If you
want to install everything, just unpack the archive into
a directory of your choice.

Alternatively, if you only want to use the executables and
don't want to bother with the sources, just do the following
from a Win32 console (command prompt):

	copy todos.exe {destination directory}\todos.exe
	copy fromdos.exe {destination directory}\fromdos.exe
	copy tofrodos.html {destination directory}\tofrodos.html

To read the manual, open the tofrodos.html file with a web browser.

If you work on the command line often, you might want to
consider putting the directory where you placed the tofrodos
executables in your PATH.

b. MSDOS/FreeDOS and Clones

You will need to compile the sources. See the section
"Compiling Tofrodos in MSDOS and Win32", particularly
the section on using Watcom C/C++.

c. Linux

See the section "Compiling Tofrodos in Linux"

d. Other systems

See the section "Porting to Other Systems".


4. Compiling Tofrodos In Linux
--------------------------------

I've stopped distributing precompiled versions of Tofrodos for
Linux for two main reasons. There are just too many distributions
to compile for and it's a simple matter to do it yourself. The
process is painless and fast, since the source code compiles
out-of-the-box.

To compile everything, simply do the following:

	cd src
	make all

You can then install by typing

	make install

To install them somewhere other than /usr/bin, redefine
BINDIR and MANDIR for the binary and manual page destinations
respectively. For example, to install the binaries in /usr/local/bin
and the manual page in /usr/local/man/man1, do

	make BINDIR=/usr/local/bin MANDIR=/usr/local/man/man1 install

To read the manual page after installation, simply type

	man fromdos

There should be no errors or warnings in the compilation.


5. Compiling Tofrodos In MSDOS And Win32
------------------------------------------

Tofrodos comes with binaries (executables) for the Win32 console
mode. However, if you prefer to recompile tofrodos yourself,
there are a few makefiles you may use, depending on the compiler
you have on your system.

To compile Tofrodos under MSDOS or Windows 95/NT, simply use
the appropriate makefile for your compiler or roll your own.

Makefiles for use with the following compilers and their MAKE
utilities are as follows:

	makefile.wcc	Watcom C/C++ 10.x and WMAKE.EXE (DOS 16/32 bit
			and Win32 targets)
	makefile.vc	Visual C++ 6.0 and NMAKE.EXE (Win32 target)
			(uses tofrodos.mak and tofrodos.dep)
	makefile.bc	Borland C/C++ 4.5x/5.0x/5.5 and MAKE.EXE (DOS
			16 bit and Win32 targets)
	makefile.dj2	DJGPP 2.0x and GNU make.exe (DOS 32 bit target)
	makefile.dm	Digital Mars C/C++ 8.X+ and MAKE.EXE
			(Win32 target). See notes below for limitations.
	makefile.lcc	LCC-Win32 3.X+ (Win32 target). See notes below
			for limitations.
	makefile.min	MinGW 3.1.0 and mingw32-make.exe (Win32 target)

Note that the default Makefile is for use with the GNU C compiler and
GNU make on a Linux system. Do not use it under Windows or MSDOS.

You can probably adapt the makefiles for other compilers or other
versions of the above compilers.

i. Recompiling with Watcom C/C++

To recompile with Watcom C/C++, copy the file
	SRC\STARTUP\WILDARGV.C
from your WATCOM directory to the src\lib subdirectory. For example, if
you installed Watcom to C:\WATCOM, and you expanded the tofrodos
package into D:\TOFRODOS, do the following:
	copy C:\WATCOM\SRC\STARTUP\WILDARGV.C D:\TOFRODOS\src\lib

If you cannot find wildargv.c on your hard disk, copy it from your Watcom
CDROM. Don't ask me to distribute it. It's copyrighted material owned by
Watcom (or whatever).

To create the MSDOS executables, do the following:
	cd src
	wmake -f makefile.wcc TARGET=16bit all

To create a Win32 console executable, the following command line can be
used:
	cd src
	wmake -f makefile.wcc TARGET=Win32 all

Make sure you do a
	wmake -f makefile.wcc clean
before compiling again for a different target or the response files
and object files will be wrong for the new target.

Note that although I only tested the makefile with Watcom C/C++ 10.6,
it should work with any 10.X version and probably also with
OpenWatcom 1.1 and later.

ii. Recompiling with Visual C/C++

Visual C/C++ 6.0 can only create Win32 console executables. Use the
following procedure to create todos.exe and fromdos.exe.

	cd src
	nmake -f makefile.vc all

There should be no warnings or errors.

Note: the following files are part of the set of makefiles used by the
Visual C++ compiler:
	makefile.vc
	tofrodos.mak
	tofrodos.dep
	tofrodos.dsp
	tofrodos.dsw

iii. Recompiling with Borland C/C++

To compile with the free command line version of Borland C++ 5.5,
installed with the directory structure used by default by the
Borland installer (ie into C:\Borland\BCC55), change into the
Tofrodos source directory, ie,

	cd src

Then type in the following command line. The command line is to be
typed in as one line even though it appears as two lines below (the
command is too long to fit into one line for the purpose of this
Readme file).

make BCDIR=C:\Borland\BCC55 WILDOBJ=C:\Borland\BCC55\Lib\wildargs.obj
-f makefile.bc all

This will make the Win32 console version of todos and fromdos.

To compile with BC++ 4.5x or 5.0x, you need to define the macro BCDIR
to point to the root directory where you installed your compiler
files. For example, if you installed your Borland files in C:\BC45,
you might use the following command line
	cd src
	make BCDIR=C:\BC45 -f makefile.bc all

To compile for MSDOS, define the SYSTEM macro to dos, for eg,
	cd src
	make SYSTEM=dos -f makefile.bc all

To compile for Win32, define the SYSTEM macro to win32, as follows:
	cd src
	make SYSTEM=win32 -f makefile.bc all

Don't forget to define the BCDIR macro when you do the above. Also,
make sure you do a
	make -f makefile.bc clean
before you compile again for a different target or the configuration
files and object files will be wrong for the new target.

The default is to compile for Win32. There should be no warnings or
errors.

iv. Recompiling with DJGPP 2.0x

To compile with DJGPP 2.0x, use makefile.dj2 provided in the package
and run it as follows:

	cd src
	make -f makefile.dj2 all

v. Recompiling with Digital Mars C/C++

To compile with the Digital Mars compiler, use the makefile.dm
provided in the package and run it with the Digital Mars MAKE.EXE
utility as follows:

	cd src
	make -fmakefile.dm all

There should be no warnings or errors. Note that if you compile
with this compiler, the resulting executable will not be able
to process wildcard arguments. If you want tofrodos to handle
arguments like *.html or *.c, use the precompiled executable that
came with the package.

v. Recompiling with LCC-Win32

To compile with LCC-Win32, use the makefile.lcc provided in the
package and run it with the LCC-Win32 MAKE.EXE utility as follows:

	cd src
	make -f makefile.lcc all

There should be no warnings or errors. Note that if you compile
with this compiler, the resulting executable will not be able
to process wildcard arguments. If you want tofrodos to handle
arguments like *.html or *.c, use the precompiled executable that
came with the package.

vi. Recompiling with MinGW

To compile with MinGW, use the GNU Make utility (mingw32-make.exe)
with makefile.min as follows:

	cd src
	mingw32-make -f makefile.min all


6. Porting To Other Systems
---------------------------

If you want to compile Tofrodos for a system other than Linux, MSDOS
or Win32 you may or may not have some work in store for you. The
program is actually VERY trivial, so the work you need to do is
probably (hopefully) minimal.

The first place to look into is probably the config.h file, where I
tried to place as much system and compiler macros as I could bother.

If you are compiling on other Unix systems, tweaking the config.h file
macros may well be all that you need to do. I have reports of success
with people using it on HP-UX and others.


7. History Of Changes
---------------------

Dates given are the dates where the code base was finalised and do not
necessarily refer to the date of public release.

Version 1.7	26 November 2003
- [Linux/Unix] Bug fix: now handles symbolic link arguments correctly.
This bug only affects Unix-type sytems (like Linux, FreeBSD, OpenBSD,
etc).
- [Linux] tofrodos now uses mkstemp() to create the temporary file to
avoid a race between file name creation and opening which may occur
when using mktemp(). If you use a non-Linux system, and have
mkstemp(), you can take advantage of this by defining HAVE_MKSTEMP
in config.h (defined by default for Linux only).
- [Linux/Unix] "make install" now installs to /usr/bin by default (you
can still change this easily) since Linux distributions using tofrodos
appear to use this value. (Makes it easier for maintainers of those
distributions.)
- [All systems] Made some error messages a bit more informative.
- [All systems] Verbose mode is slightly more informative.
- [Windows] Added support for compiling with the MinGW (GNU) C Compiler
on Win32 systems.
- [All systems] Added an HTML version of the manual page. Useful for
systems that don't have a built-in facility to read a man page (like
MSDOS and Windows).

Version 1.6	1 July 2002
Added support for LCC-Win32 and BCC 5.5

Version 1.5	19 June 2002
Minor fixes to documentation.
Added support for the Digital Mars C/C++ compiler (Win32 console mode)

Version 1.4	16 March 1999
Fixed bug when using -b on a file not in the current directory.
Added RPM support.

Version 1.3	8 October 1997
Added new option (-p) to preserve file ownership and time.
Added support for Win32 compilation and some compilers under DOS and
Windows.

Version 1.2	5 April 1997
(Internal version - not publicly released.)

Version 1.1	16 December 1996
Fixed bug in creation of temporary filename on Linux.
Fixed bug in creation of backup filename on Linux.

Version 1.0	22 June 1996		Initial version.


8. Copyright And Contacting The Author
--------------------------------------

The program and its accompanying files and documentation are
Copyright (c) 1996-2003 by Christopher Heng. All rights reserved.
They are distributed under the terms of the GNU General Public License
Version 2, a copy of which is enclosed in this package in the file COPYING.

You can retrieve the latest version of tofrodos from the following
website:
	http://www.thefreecountry.com/tofrodos/

If you need to contact me, you can use the feedback form at the
following URL:
	http://www.thefreecountry.com/feedback.php

While I generally like to hear from you if you are using this program,
especially if you find any bugs in it, I make no promises about fixing
anything or even replying. If you do contact me, please also let me have
the following information:

	1. The version of tofrodos that you are using;
	2. The operating system (and its version) on which you are
	running the program (eg, Debian Linux [Woody], or MSDOS 6.22,
	Windows 95/98/ME/NT/2k/XP, OS/2 or all of the above).
	If the bug only surfaces in one of the operating systems and not
	the other, please also note this.
	3. Any other information which you think might be relevant.

This will help me give you a more relevant reply (and also to trace
whatever bugs that may be present).
