Dec 142017
 
PC Mag 8/89 utility - Modified for Turbo C (version 2).
File CHKFRAG.ZIP from The Programmer’s Corner in
Category Files from Magazines
PC Mag 8/89 utility – Modified for Turbo C (version 2).
File Name File Size Zip Size Zip Type
CHKFRAG.C 30752 8219 deflated
CHKFRAG.EXE 13888 8554 deflated
READ.ME 12273 2025 deflated

Download File CHKFRAG.ZIP Here

Contents of the READ.ME file



CHKFRAG 1.1 (c) Ziff Communications Co.
PC Magazine Bob Flanders & Michael Holmes



I have made the necessary changes needed to allow CHKFRAG.C to
compile with both Turbo C 2.0 and MicroSoft C 5.0. A summary
of the changes that were made are listed below.

I have also corrected a bug that resulted in a NULL POINTER
ASSIGNMENT run-time error, and a bug in the command line
switches where option 5 was selected if an incorrect switch
was given.

Additionally, the enclosed executable will check to see if the
disk was partitioned > 32 meg, and if so, will set the /4 switch.

The executable was compiled under Turbo C 2.0 as follows:

TCC -ms -C -K -k- -M -N -w -O -Z CHKFRAG.C

Modified on Sun 08-13-1989 [13:07] by Tony Tortorelli [71571,3647]
to allow compilation under both Turbo C and MicroSoft C




The following is a summary of the changes made:
(all line # references are to original code)

The following changes will allow CHKFRAG.C to be compiled
under BOTH TC2 and MSC:

Header and macro definitinons at beginning of file:


On line 9, delete #include (It will now be in the #elif)

On Line 10 (after #include's):

#if defined(__TURBOC__) /* Turbo C */
#include
#include
#include
#include
#include
#define _A_SYSTEM FA_SYSTEM
#define _A_HIDDEN FA_HIDDEN
#define _A_SUBDIR FA_DIREC
#define _A_VOLID FA_LABEL
#define _dos_findfirst(a,c,b) findfirst(a,b,c)
#define _dos_findnext(a) findnext(a)
#define find_t ffblk
#define name ff_name
#define halloc(a,b) farcalloc(a,b)
#define fcb FCB
#pragma warn -pia
#pragma warn -sig
#pragma warn -use
#if defined (__TINY__)
#error farcalloc() not supported by Tiny Model
#endif


#elif defined(M_I86) && !defined(__ZTC__) /* MSC/QuickC */
#include
#include
#else
#error *** Unsupported Compiler ***
#endif


On line 122 make the following change:


#if defined(__TURBOC__) /* Turbo C */
sdrive = getdisk()+1;
#else
_dos_getdrive(&sdrive); /* get the default drive */
#endif


On line 181 make the following change:


#if defined(__TURBOC__) /* Turbo C */
setdisk((*drive-'A'));
#else
_dos_setdrive((*drive-'A')+1, &i); /* set up the work drive */
#endif


On line 922 make the following change:


#if defined(__TURBOC__) /* Turbo C */
setdisk(sdrive-1);
#else
_dos_setdrive(sdrive, &i); /* reset the default drive */
#endif



Although not needed to port to TC2, the following will check for
a partition > 32 meg and will automatically set the /4 switch


On line 845 =add= the following:

#if defined (__TURBOC__) /* check for > 32 meg partiction */
struct fatinfo fat;
#endif


On line 870 =add= the following:


#if defined (__TURBOC__) /* check for > 32 meg partiction */
getfat(c-64,&fat);
if(((long)fat.fi_sclus * (long)fat.fi_nclus
* (long)fat.fi_bysec) > 32000000L)
dos4++;
#endif


The following changes are necessary to correct a
NULL POINTER ASSIGNMENT:


#: 16088 S2/Utilities [U]
13-Aug-89 00:43:13
Sb: #16065-Please support Turbo C
Fm: Don E. Groves, Jr. 71310,3702
To: Tony Tortorelli 71571,3647

Tony, Inside of the routine next_cluster. Make sure all pointer
references are huge. The ones I'm talking about are p = (UINT *)
&fat[0]; this should be wrote as p = (UINT huge *) &fat[0]; so that
no matter what memory model you use its always a huge to a huge
pointer assigment. I hope this helps. {the poor typer}



The following is necessary to correct the command line switches:



Also, v1.1 has an error in the command line switches in
that option 5 is selected if an incorrect option is given:

Line 138:

for (j = 0; strcmp(p, options[j]) /* search arguments */
&& (j < 5); j++);


Should be 6.



Tony Tortorelli
71571,3647


 December 14, 2017  Add comments

Leave a Reply