                                                         
                  Long Filename Library (c) Paul Burgin 1998
                  ==========================================
                                                  
                                                  
This library contains replacement file handling functions which support long
filenames in DOS boxes under Windows 95/98. It is primarilly intended for use
with MS-DOS based programs, but can also be used transparently with other
environments. For example, I have used the library to develop software which
is portable between MS-DOS and HP-UX.

The availability of long filenames for programs which use this library can
depend on both the target environment and the runtime environment. The table
below shows which environments will support long filenames:

    Target Environment | Runtime Environment             | Long Filenames
   --------------------+---------------------------------+-----------------
    MS-DOS             | MS-DOS, Windows 3.1, Windows NT | No
                       | Windows 95/98                   | Yes
   --------------------+---------------------------------+-----------------
    WIN16*             | Windows 3.1, Windows NT         | No
                       | Windows 95/98                   | Yes
   --------------------+---------------------------------+-----------------
    WIN32*             | Windows 3.1 with WIN32S         | No
                       | Windows 95/98, Windows NT       | Yes
   --------------------+---------------------------------+-----------------
    UNIX or other      | UNIX or other                   | Yes (if native)
   --------------------+---------------------------------+-----------------

*not tested

The library provides functions prefixed with "lfn_" which replace the
standard runtime library functions for creating, opening, deleting, renaming
and obtaining information about files and directories. Operations such as
fread(), fwrite() and fclose() are unaffected by the use of long filenames.

In the simplest case an existing program can be modified to support long
filenames simply by adding a #include for header file "lfn.h", substituting
any standard library calls for those provided by the long filename library,
and linking your program lfn.c (or one of the LIB files).

The functions which are provided are listed below:

          Replace Runtime Function      |      With New Function
      ----------------------------------+-----------------------------
                 fopen()                |         lfn_fopen()
                 freopen()              |         lfn_freopen()
                 _fsopen()              |         _lfn_fsopen()
                 access()               |         lfn_access()
                 chdir()                |         lfn_chdir()
                 stat()                 |         lfn_stat()
                 remove()               |         lfn_remove()
                 unlink()               |         lfn_unlink()
                 mkdir()                |         lfn_mkdir()
                 rmdir()                |         lfn_rmdir()
                 chmod()                |         lfn_chmod()
                 rename()               |         lfn_rename()

The long filename library defines LFN_MAXPATH, which may be used to size
memory allocated to store filenames. If you use this constant but receive the
compiler error "LFN_DEFMAXPATH undefined" then you will need to #include the
directory definitions file for your environment (alternatively #define
LFN_DEFMAXPATH to be a suitable size for your environment).

For some variants of UNIX you may need to change the names of the header files
included by lfn.c, since not all systems use <unistd.h>.

If your target environment is not MS-DOS then you should link your program
with the library source code lfn.c. For MS-DOS you can either link to the
source code or use one of the precompiled LIB files (slightly quicker). Make
sure that you use the correct library for your chosen memory model, as shown
in the table below:

                     Library File      |      Memory Model
               ------------------------+------------------------
                      lfn_t.lib        |         tiny
                      lfn_s.lib        |         small
                      lfn_c.lib        |         compact
                      lfn_m.lib        |         medium
                      lfn_l.lib        |         large
                      lfn_h.lib        |         huge

I've only tested the long filename library with Borland compilers. If using
any other compiler then you should probably link to the source code rather
than LIB files. If using a language other than C then you may be able to use
the LIB files (or convert both lfn.h and lfn.c to your chosen language).

The long filename library provides the following additional facilities:

            Item           |                     Purpose
  -------------------------+------------------------------------------------
   LFN_MAJOR and LFN_MINOR | Define the version number of library.
         LFN_VERSION       | 16-bit combination of LFN_MAJOR and LFN_MINOR.
         lfn_is95()        | At runtime returns 1 if Windows 95/98, else 0.

This library is provided as freeware. You are welcome to distribute the long
filename library without charge and to use and modify it for your own
purposes. All I ask is that you give credit where it's due and do not modify
the ZIP archive if you pass it on to others.

If you make any improvements to the library then I would be interested to
hear about them. Also, if anyone converts lfn.h to Turbo Pascal then please
pass a copy back to me - thanks. Check out my website for the latest updates
to the library (http://public.logica.com/~burginp/x86.html).

Copyright 1998 by Paul Burgin (m6809@usa.net).

