SYSMAP.PAS ( File view )

  • By 2010-07-21
  • View(s):3
  • Download(s):0
  • Point(s): 1
			{
SystemMap:  Version 2.7, April     1994 -- Add /N option for No Files
             Version 2.6, September 1991 -- upgrade to support DOS 5

 Shows a map of system including BIOS, DOS, Memory and Disk Information.

 (C) Copyright 1989-1991, 1994, Earl F. Glynn, Overland Park, KS.
                                Compuserve 73257,3527

 All Rights Reserved.  This Turbo Pascal PROGRAM may be freely distributed
 only for non-commercial use.


 Usage:

   SYSMAP [dirspec] [/options] [> output.lst]

 Default:

   SYSMAP C:\ /F

 where

   'dirspec' is a directory specification. The default is the root
   directory on the C drive, but any directory can be specified,
   e.g., C:\DOS\.  Information on the specified directory, and all
   of its subdirectories, will be included in the system map.
   Other system information is displayed ONLY when the 'dirspec'
   is the root directory of a drive, such as C:\.

   '/option' is a one of the following characters (either case) that
   controls the sort order of the files.  Directories are always
   sorted in ascending order by name.

       D -- DOS order (no sort)

       E -- sort by extension (ascending) and filename (ascending)

       F -- sort by filespec -- filename.ext -- (ascending)  [default]

       S -- sort by file size (descending) and filespec (ascending)

       T -- sort by time stamp (descending) and filespec (ascending)

   Miscellaneous Options:

       C -- calculate CRC-16 on each file and checksum of CRC codes
            for each directory.  These decimal values are compatible
            with the program FILECHK for detecting changes in files.

       N -- No files in output.  Include only System and Directory
            Summaries in output.


 Output from SYSMAP can be redirected to a disk file using a
 command such as:  SYSMAP C:\ /E > A:disk.map

 Limitations:  Only the first 1000 entries (files or subdirectories)
               in any directory will be processed.

               SYSMAP has only been tested extensively under DOS 3.3
               on a variety of machines, e.g, PS/2s, ATs, XTs, Compaqs,
               Grids, Toshibas, Dells.

 Acknowledgements:

 Information for developing SYSMAP came from a number of sources
 including, The Waite Group's "MS-DOS Developer's Guide" (second
 edition), Ray Duncan's "IBM ROM BIOS" and "MS-DOS Functions"
 reference series, Que's "DOS and BIOS Functions Quick Reference",
 Steve Grant's (Long Beach, CA) SYSID.PAS from local BBS, and
 Dave Williams' (Jacsonville, AR) "Programming Technical Reference"
 from a local BBS.  Also consulted were IBM's "PS/2 Hardware Interface
 Technical Reference, "Technical Reference Personal Computer AT", and
 "Disk Operating System Version 3.30 Technical Reference".
}


{
$M 32768,150000,150000
}
PROGRAM SystemMap;

  USES
    DOS,  {
DirStr,ExtStr,NameStr,PathStr,SearchRec,AnyFile,       
}
          {
ReadOnly,Hidden,SysFile,VolumeID,Directory,Archive,    
}
          {
FSplit,FindFirst,FindNext,FExpand,GetFaddr,DOSError,   
}
          {
EnvCount,EnvStr,Intr,Directory                         
}
    DOSStructures,
    Clocks, {
DateFormat,TimeFormat,ClockValue,UnPackTime          
}
    REXX,   {
B2X, C2X, Copies, Left, Plural, Space, W2x
}
    CRC;  {
CalcFileCRC
}

  CONST
    BufferSize      = 10240;  {
Large buffer for quick I/O for CheckSum.
}
    MaxEntriesInDir =  1000;  {
Most root directories are limited to 512
}
    Version = '2.7, Apr 94'; {
entries; Subdirectories are limited by  
}
                             {
available disk space.                   
}
  TYPE
    Buffer      =  ARRAY[1..BufferSize] OF BYTE;
    DirPtr      = ^DirRecord;
    DirRecord   =             {
This RECORD is to form a LIFO stack of   
}
      RECORD                  {
directory names as the disk tree is      
}
        next    :  DirPtr;    {
traversed.  Recursive tree traversal is  
}
        time    :  LongInt;   {
not possible using FINDFIRST/FINDNEXT.   
}
        attr    :  BYTE;
        DirSpec :  PathStr;
      END;
    EntryPtr    = ^EntryRecord;
    EntryRecord =             {
This RECORD is to form an array of direc-
}
      RECORD                  {
ory entries, i.e., files, subdirectories 
}
        attr    :  BYTE;      {
volume label, which will not be in the   
}
        time    :  LongInt;   {
current data segment.  See ENTRY VAR.    
}
        size    :  LongInt;
        FileSpec:  STRING[12] {
file specification:  filename.ext
}
      END;
    CompareFunction = FUNCTION(Dir1,Dir2: EntryPtr): BOOLEAN;


  VAR
    BasePath        :  PathStr;    {
 STRING[79] 
}
    CheckSumFlag    :  BOOLEAN;
    clockdata       :  ClockValue;
    clkCMOS,clkDOS  :  Clock;
    ClusterSize     :  WORD;       {
size of disk cluster in bytes
}
    Compare         :  CompareFunction;
    CompareFiles    :  CompareFunction;
    DirAttr         :  BYTE;
    DirHead         :  DirPtr;     {
head of directory linked list
}
    DirLink         :  DirPtr;     {
next node of linked list     
}
    DirTime         :  LongInt;
    drive           :  BYTE;
    Entry           :  ARRAY[1..MaxEntriesInDir] of EntryPtr;
    Ext             :  ExtStr;     {
 STRING[4] 
}
    FileInfo        :  SearchRec;
    FileName        :  NameStr;    {
 STRING[8] 
}
    FirstDrive      :  BYTE;
    i               :  WORD;
    InBuffer        :  ^Buffer;    {
I/O buffer for checksum      
}
    ListAllFiles    :  BOOLEAN;    {
list files in output
}
    nFile           :  WORD;       {
number of files in directory
}
    nSubDir         :  WORD;       {
number of subdirectories in directory
}
    nTotalArchive   :  WORD;       {
number of files with Archive attribute
}
    nTotalByte      :  LongInt;    {
total bytes from all directories
}
    nTotalDir       :  WORD;       {
total number of directories
}
    nTotalDirByte   :  LongInt;    {
total number of bytes in directories
}
    nTotalFragByte  :  LongInt;    {
total fragmented bytes all directories
}
    nTotalHidden    :  WORD;       {
number of hidden files
}
    nTotalHiddenByte:  WORD;       {
number of bytes in hidden files
}
    nTotalFile      :  WORD;       {
total number of files
}
    nTotalReadOnly  :  WORD;       {
total number of ReadOnly files
}
    nTotalSystem    :  WORD;       {
total number of System files
}
    OutBuffer       :  ^Buffer;
    Path            :  PathStr;    {
 STRING[79] 
}
    PathParm        :  PathStr;    {
 STRING[79] 
}
    r               :  Registers;
    Root            :  DirStr;     {
 STRING[67] 
}
    t               :  STRING;
    tDiff           :  REAL;
    VolFlag         :  BOOLEAN;

  {
$F+
} {
force 'far' calls to be used by QuickSort
}

  {
The following Compare functions are used by QuickSort.  Each function
   results in a unique sort order by sorting on a key, and sometimes a
   secondary sort key, which is unique within a directory.  
}

  FUNCTION CompareExtension (File1, File2: EntryPtr): BOOLEAN;
    VAR
      index:  WORD;
      s1,s2:  STRING[12];
  BEGIN
    index := POS('.',File1^.FileSpec);
    IF   index = 0
    THEN s1 := '   ' + File1^.FileSpec        {
'.ext' + 'filename'
}
    ELSE s1 := COPY(File1^.FileSpec,index+1,3) +
                       COPY(File1^.FileSpec,1,index-1);
    index := POS('.',File2^.FileSpec);
    IF   index = 0
    THEN s2 := '   ' + File2^.FileSpec
    ELSE s2 := COPY(File2^.FileSpec,index+1,3) +
                       COPY(File2^.FileSpec,1,index-1);
    CompareExtension := s1 < s2
  END {
CompareExtension
};

  FUNCTION CompareFileSpec (File1, File2: EntryPtr): BOOLEAN;
  BEGIN
    CompareFileSpec := File1^.FileSpec < File2^.FileSpec
  END {
CompareFileSpec
};

  FUNCTION CompareSize (File1, File2: EntryPtr): BOOLEAN;
  BEGIN
    IF   File1^.size  = File2^.size
    THEN CompareSize := CompareFileSpec(File1,File2)
    ELSE CompareSize := File1^.size > File2^.size
  END {
CompareSize
};

  FUNCTION CompareTime (File1, File2: EntryPtr): BOOLEAN;
  BEGIN
    IF   File1^.time  = File2^.time
    THEN Comparetime := CompareFileSpec(File1,File2)
    ELSE Comparetime := File1^.time > File2^.time
  END {
CompareTime
};

  {
$F-
}

  PROCEDURE QuickSort (left,right:  INTEGER);
  {
Adapted from Borland's DIRDEMO example program on Turbo Pascal 5.0
   distribution disk.
}
    VAR
      i,j   :  INTEGER;
      middle:  EntryPtr;
      temp  :  EntryPtr;
  BEGIN
    i := left;
    j := right;
    middle := Entry[(left + right) DIV 2];
    REPEAT
      WHILE Compare(Entry[i], middle) DO
        INC (i);
      WHILE Compare(middle, Entry[j]) DO
        DEC (j);
      IF   i <= j
      THEN BEGIN
        temp := Entry[i];
        Entry[i] := Entry[j];
        Entry[j] := temp;
        INC (i);
        DEC (j);
      END
    UNTIL i > j;
    IF   left < j
    THEN QuickSort (left, j);
    IF   i < right
    THEN QuickSort (i, right)
  END {
QuickSort
};

  PROCEDURE ProcessParms;
    VAR
      attr:  WORD;
      f   :  File;
      i,j :  INTEGER;
      s   :  PathStr;
  BEGIN
    ListAllFiles := TRUE;
    CheckSumFlag := FALSE;
    PathParm := '*:\';       {
default directory specification
}
    @CompareFiles := @CompareFileSpec;
    FOR i := 1 TO ParamCount DO BEGIN
      s := ParamStr(i);
      IF   s[1] = '/'
      THEN
        FOR j := 2 TO LENGTH(s) DO
          CASE UpCase(s[j]) OF
            'C':  CheckSumFlag := TRUE;
            'D':  @CompareFiles := NIL;     {
DOS order -- no sorting
}
            'E':  CompareFiles := CompareExtension;
            'F':  CompareFiles := CompareFileSpec;
            'N':  ListAllFiles := FALSE;
            'S':  CompareFiles := CompareSize;
            'T':  CompareFiles := CompareTime
            ELSE
              WRITELN ('Invalid option: ', s[j]);
              HALT(1)
          END
      ELSE
        PathParm := s
    END;
    IF   PathParm <> '*:\'
    THEN BEGIN

      PathParm := FExpand(PathParm);    {
also translates to upper case
}

      IF   LENGTH(PathParm) > 3     {
ignore BasePath='x:\', with valid x
}
      THEN BEGIN
        IF   PathParm[LENGTH(PathParm)] = '\'
        THEN PathParm := COPY(PathParm,1,
...
...
(Not finished, please download and read the complete file)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
CRC.PAS4.20 kB07-04-89|13:16
DOSSTRUC.PAS9.68 kB09-22-91|12:22
REXX.PAS14.29 kB02-16-92|10:38
SNAPSHOT.BAT197.00 B04-24-94|23:41
SYSMAP.EXE44.81 kB04-24-94|23:31
SYSMAP.PAS50.02 kB04-24-94|23:31
...
Sponsored links

SYSMAP.PAS (44.40 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D