Sort And Pack Directories - sorts directories
in any of three orders and writes out the
sorted directory. Also, CSAP provides the
optional ability to truncate directories,
i.e., return disk space not used by a
directory to the free disk space. FREE!
CSAP - Sort And Pack Directories [C source]
Author: Don A. Williams
Version: 4.2.1 Date: February 25, 1994
Fixed a bug that appeared when the TRUNCATE option was specified and there
where just enough active entries in a directory to require an integral number
of clusters - in this case, CSAP attempted to write out one too many
clusters. Some minor, cosmetic changes were also made. There have been no
reports of CSAP use with any of the disk compression facilities such as
DoubleSpace, Stacker, or SuperStore yet and I don't use any of them. Be VERY
careful if you use CSAP with one of these facilities.
Version: 4.2.0 Date: February 5, 1994
Finally, the problem with large partitions appears to be fixed! I finally
got a system with a single 200 meg partition and tracked down the bugs! The
special modifications to the absread/abswrite functions made in Version 4.1.0
by Edgar Swank are no longer necessary. Borland fixed their version of
absread/abswrite to handle partitions > 32 meg. The major problems were a
number of calculations that should have been "long" and actually were
"unsigned". This version, again, has NOT been tested on a large variety of
configurations - I only have the one system with a large partition - and must
be used with care!
Version: 4.1.0 Date: January 3, 1994
This version is another attempt to fix the problem with large partitions. I
had some external help with this one from Edgar W. Swank. I have no system
on which I can test the large partitions - the largest partition on my main
system is 60meg. Mr. Swank located and fixed a couple of the problems for
Version: 4.0.0 Date: September 9, 1993
This version attempts to fix the long standing problem with large partitions,
i.e. FATs larger than 64k. It MUST be considered as a "Beta" test version!
Version: 3.2.1 Date: September 25, 1992
This version reinstates the "truncate" option that was destroyed by version
3.2.0. It also fixes a long standing error it writing the second copy of the
FAT when a directory has been truncated. The version/date printout are
corrected in this version too!
Version: 3.2.0 Date: February 20, 1992
A total reimplementation of the handling of erased entries that eliminates
the "cross linked files" problem. Evidently, some of the disk organizers pay
no attention to the "end of directory" sentinel unless it occurs at the
physical end of the directory. CSAP now zero-sets all entries at the end of
the directory. The truncate directory option is, temporarily, crippled in
Version: 3.1.2 Date: February 19, 1992
Minor change in the handling of erased entries in an attempt, only partially
successful, to eliminate the "cross linked files" problem that occurs when
CSAP is used in conjunction with some of the "disk organizer" programs,
notably Central Point Software's COMPRESS and the Shareware DOG.
Version: 3.1.1 Date: February 14, 1991
Made a very minor change to allow CSAP to run under MS-DOS 5.0. The
change amounted to nothing more than allowing "5" as a DOS version number.
Version: 3.1.0 Date: July 11, 1990
Repaired a rather major problem with the '-t', Truncate
Directories, option and empty directories. If there was a directory
consisting of nothing but erased files and CSAP was executed WITHOUT the
'-t' option and, later, CSAP was executed WITH the '-t' option, many bad
things including corruption of the disk could occur! Also corrected the count
of freed clusters which was one too high and added a count of the freed bytes
to the message.
Version: 3.0.2 Date: June 20, 1990
Since the absread() and abswrite() functions provided with version 1.0
of Borland International's Turbo C++ support the long sector addresses
required by partitions larger than 32 meg, the special routines used by CSAP
are no longer needed and have been removed. The GetDPB() function was
recoded to eliminate assembly language at the same time. Added a message
showing the number of clusters freed by the "Truncate Directories" option,
'-t', and fixed a small bug in the truncation routine.
Version: 3.0.1 Date: June 18, 1990
Version 3.0.1 of CSAP is nothing more than a recompilation of CSAP using
Turbo C++ 1.0. It is slightly smaller and slightly faster than CSAP 3.0.0.
Version: 3.0.0 Date: May 11, 1990
Version 3.0.0 of CSAP can handle MS-DOS 4.xx and DR DOS 3.xx large
partitions. It also introduces the optional ability to truncate
directories, i.e. release unused directory disk space back to the free
space pool. CSAP now uses Chris Blum's Absolute Disk I/O modifications
but only the OBJ file for the Compact model in included in the CSAP
ZIP. The entire package is available on CompuServ in IBMPRO Library
#3 as ABRD40.ARC. Version 3.0.0 of CSAP MUST be regarded as a "beta test"
version -there are now many different possible configurations and I have
not been able to test them all. It has been tested with MS-DOS 3.3 on the
small partitions that 3.3 can handle and with MS-DOS 4.01 and DR DOS 3.41
on small partitions and on large partitions up to 70 meg. I would highly
recommend that you take a full save of your hard disk before using CSAP 3.0.0
until you are sure that it works with your particular setup.
Version 2.1.1 of CSAP corrects the incorrect sorting on Date/Time that was
reintroduced in CSAP 2.0.9 and later versions. Thanks to David Klatzco for
Version 2.1.0 of CSAP corrects the handling of the '.' and '..' directory
specifiers and adds the documentation of the '-V' option to CSAP.DOC
(the '-V' has been operative in the program for some time but was left out
of the documentation.)
CSAP is composed of 5 modules; CSAP.C, SORTDIR.C, ISDEV.C.C, GETDPB.C,
and ABSREAD.OBJ. The current version of CSAP, CSAP 3.0.0, has been
designed for compilation with Borland International's Turbo C 2.0.
The module ISDEV.C could be replaced by Turbo C's supplied function
isatty(), however, I plan to extend ISDEV.C to distinguish among files, CON,
AUX, and the printer. The function isatty() just distinguishes between
files and the others.
GETDPB.C cannot be compiled in Turbo C's interactive environment (TC). It
is primarily inline ASM code and requires the more conventional
environment provided by Turbo C's TCC command. As a result, CSAP was
designed to be compiled through the use of a MAKEFILE and the MAKE
facility of Turbo C.
CSAP currently compiles and executes correctly in any of Turbo C's
supported memory models except HUGE. The memory model is defined as a
macro in the MAKEFILE and is supplied on the MAKE command line, i.e.:
to make a SMALL memory model version of CSAP (the "s" must be lower case
since it is a parameter to TCC and TCC is case sensitive on its
parameters). The resultant EXE file will be named CSAPx.EXE where 'x'
is C, S, M, or L depending upon the memory model selected. The default
memory model (if -DMDL is not specified on the MAKE command) is the COMPACT
model. The current MAKEFILE will NOT work properly for the TINY memory
model, the library specifications in the MAKEFILE would have to be modified
to use the SMALL libraries for the TINY model and the effort is probably
not worth it. The command:
TCC -mt -G csap sortdir isdevice getdpb
would have to be used to produce a TINY memory model version of CSAP and
would produce an EXE file with the name CSAP.EXE.
The EXE and OBJ files in the CSAPxxx ZIP have been produced for the COMPACT
model which is probably the most general.
This release of CSAP, which should fix the problem with large partitions and
small clusters (i.e. FATs larger than 64kb), still must be regarded as a Beta
release. I do not have the facilities to test it as thoroughly as I would
like. It has been tested as thoroughly as possible with the facilities that
I do have and seems to function correctly with both 12-bit and 16-bit FATs,
however, there are just too many possible configurations to allow really
adequate testing. To the best of my knowledge, it has not been tested at all
with disk compression utilities such as DoubleSpace, Stacker, SuperStore,
etc. Be sure to backup your hard disk before using CSAP 4.2.1 for at least
the first 3 or 4 times. Since CSAP does work with both the FATs and the
actual directory entries, a bug could easily destroy your hard disk!
Don A. Williams 3913 W. Solano Dr. N. Phoenix, AZ 85019 (602) 841-5333
I fixed a bug and changed calls to absread/abswrite to support large
Edgar W. Swank 5515 Spinnaker Dr., #4 San Jose, CA 95123 (408)227-3471
Internet: [email protected]