home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
451.lha
/
Free
/
Free.doc
< prev
next >
Wrap
Text File
|
1990-12-08
|
7KB
|
224 lines
FREE: Display free space on your mounted disk volumes.
Author: Daniel Jay Barrett, barrett@cs.jhu.edu.
April, 1990.
Inspired by "Free" by Tom Smythe on Fish Disk 66.
For a list of improvements over Smythe's program,
see the end of this file.
Distribution: This program is Freely Distributable.
Make as many copies as you want.
Give this program to anybody, without cost.
Use my source code in any programs of your own.
(Please give me credit in your program -- thanks!)
----------------------------------------------------------------
INTRODUCTION
------------
This program will display how much free space is remaining
on your disk volumes. It runs from the CLI only. The syntax is:
1> Free [<OPTIONS>] [volume1] [volume2] ... [volumeN]
HOW TO USE "Free"
------------------
There are three different ways that Free may behave.
(1) You can specify volume names on the command line. Free will
display the free space on those volumes only.
Example:
1> Free df0: df1: RAM:
Of course, you can use the Commodore Shell (or similar shell) to
define aliases, if you want to see disk space on your favorite
volumes:
1> alias floppies Free df0: df1:
1> floppies
(2) If you specify NO volume names on the command line, Free will then
look for an environment variable called FREE_DRIVES. This is a
standard Commodore ENV: variable, whose value is set using the
"setenv" command.
The value of FREE_DRIVES is a list of volumes, separated by
commas. There is no whitespace between volumes and commas,
and each volume must end (as usual) with a colon. For
example:
1> setenv FREE_DRIVES "df0:,df1:,dh0:,dh1:,RAM:,RAD:"
You can put a line like this in your startup-sequence.
REMEMBER: In order to use environment variables and setenv, you
must have ENV: assigned somewhere. (Under AmigaDOS 1.4 and up,
you must explicitly mount ENV:, I think.) See your Amiga
documentation about ENV: and environment variables.
(3) If you specify no volume names on the command line, and the
variable FREE_DRIVES does not exist, then Free will use a
default list of volumes:
RAD:
DF0:
DF1:
You can change this default list by modifying the value of
DEFAULT_VOLUMES in the header file of the source code.
I see no reason to do this, however, since you can use FREE_DRIVES
or Shell aliases (adding command-line arguments) to make an
equivalent change without recompiling.
GETTING HELP
------------
Type:
1> Free ?
for a summary of usage information.
DISPLAYING FREE MEMORY
----------------------
If you give the volume name "RAM:" (case doesn't matter), you will
be shown how much free memory you have. If you have FAST RAM, the number
will be broken up into separate CHIP and FAST amounts, plus a TOTAL.
COMMAND-LINE OPTIONS
--------------------
Command-line options always begin with a dash '-'. You may specify
each option with its own dash, or group several options under each dash.
However, all options must preceed all volume names on the command line.
-b Give answers in blocks instead of bytes.
-r Turn on volume requestors (turned off by default).
NOTE: If you use -r and "ENV:" is not available, you
will get a requestor asking for ENV:. This is not a
bug... but I wanted you to be aware of it. It's a VERY
good idea ALWAYS to have ENV: available, since more and
more programs are going to use it.
-m [Advanced.] Allocate memory for the output of Free.
To speed up screen output, everything is stored in a single
character array and then written to the screen.
The default array length is BUFSIZ (1024) bytes.
You can override this number with "-m BYTES", where BYTES
is the size of the output array.
I doubt you will ever need to use the -m option, but I
have included it for completeness.
-l Specify the maximum length of a volume name (including
the colon). Free assumes that all your volume names are
four characters long (df1:, rad:, etc.) or less.
Use this option to override this default.
The value you specify must be between 1 and 255, inclusive.
Examples:
1> Free -r -b dh0:
1> Free -br df1: df2:
1> Free -m 10000 -rbl 8 df1:
1> Free -m10000 -bl8
ERROR HANDLING
--------------
If you specify a volume name illegally, Free will complain about
it. For example:
1> Free df1
Since "df1" does not end with a colon (should be df1:), it is not a valid
volume name.
If you specify a legal volume name, but the volume is not mounted,
then Free will display the volume name with the symbol "--" next to it.
This indicates that a floppy drive has no disk in it, or that a volume is
not mounted.
Example:
1> Free Nonexistent:
Nonexistent: --
Non-existent volumes will not cause any volume requestors to pop up,
since Free turns them off while it runs. (You can enable volume requestors
with the -r option.)
LIMITATIONS OF THIS PROGRAM
---------------------------
The following is a list of limitations on how this program
works, due to the way it was designed. If you don't like these decisions
that I made, just modify the source code and recompile. (Honestly, these
are such minor issues that I think nobody will care about them.)
1) If you specify your volume names using FREE_DRIVES, no device
name may have a comma in it. The comma is used as a delimiter
character for separating volume names.
However, this is a simple problem to get around. You can ASSIGN
an alternate name for your volume, or you can specify the volume
on the command line (where there are no "comma" restrictions).
2) The "free space" displayed must fit into 10 digits, or else
the indenting may not be correct. (You don't have to worry about
this, unless you have more than 10 Gigabytes of space on a volume!)
If you want to change this limit in the source code, just change
the value of DEFAULT_SPACING in the file free.h.
3) The length of the value of FREE_DRIVES must be 1023 characters or
less, or else FREE_DRIVES will be ignored. I think this is enough
space.
You can increase this limit in the source code; change the size of
array envString in function TheEnvValue() in file env.c.
4) Free RAM: space is always in bytes, even if the -b option is
specified. "Blocks" makes no sense when you're talking about
RAM:.
CHANGES/IMPROVEMENTS OVER TOM SMYTHE'S PROGRAM
----------------------------------------------
o Does not use self-modifying code, so it should work on
ALL Amigas, not just 68000-based systems.
o You can specify a device list on the command line.
o You can specify a device list using an environment variable.
o Requestors are turned off, so non-mounted devices are just
skipped. (See -r option.)
o Data is written in correct columns, regardless of the
lengths of the volume names. (See -l option.)
o Total memory free is shown, along with CHIP and FAST
subtotals.
o Command-line options added so the user can customize the
program.
o Written in ANSI C, in a modular and easy-to-read style.
STUPID DISCLAIMER
-----------------
Daniel Jay Barrett makes no claims about the suitability of this program
for any particular purpose. Any damages incurred through the use of
this program are entirely the responsibility of the USER. Use at your
own risk. So there! :-)