home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
C128
/
CPMPRMR2.TXT
< prev
next >
Wrap
Text File
|
2000-06-30
|
12KB
|
302 lines
*********************************************************************
This article is being presented through the *StarBoard* Journal of
the FlagShip/StarShip SIGs (Special Interest Groups) on the Delphi
and GEnie telecommunications networks. Permission is hereby granted
to non-profit organizations only to reprint this article or pass it
along electronically as long as proper credit is given to both the
author and the *StarBoard* Journal.
*********************************************************************
-
CP/M Primer #2
-
Disk and File Attributes - Time/Date Stamping - Password Protection
-
By: Mike Mantino (GEnie address: MIKEM)
-
Last month we discussed the DIR and DIR.COM utilities (built-in and
transient) which allowed us to view the disk directory in a variety of
ways using a number of options. We were able to acquire listings of
all the files we had on each drive and in each 'user area' of the disk,
and in doing so we noticed that these files had their own distinct
attributes. Some were SYS files, others were DIR files, and they all
had a two-letter identifier signifying whether they were Read-Only (RO)
or Read-Write (RW). So, too, we had brushed over the term
'time-stamping' and inferred that it was possible to password-protect
individual files and/or whole disks. This month we will attempt to
change and set these attributes and parameters in order to give you full
control over your disk files.
-
The first thing we need to do upon boot-up of CP/M is to set the
current time and date. This will later allow us to use time and date
stamping of our files, so we can quickly locate the most recent copy of
a file and check to see when it was last updated or accessed from
disk. Let's do this right now.
The DATE command is another transient utility that allows us to change
the current date and time of day. When you boot-up CP/M, the date and
time are defaulted to the creation date of your system. Let's see what
that current time and date is. At the A> prompt, type DATE. CP/M will
respond with something like: SAT 07/18/85 10:45:10 Now we will
change this to the current date and time. There are two ways of doing
this. The first is to type DATE followed by the current day and time,
in the format: MM/DD/YY HH:MM:SS For example, we might type:
A> DATE 08/10/86 11:30:00
CP/M would respond with:
Press any key to set time.
Another way of going about the same thing, would be to type DATE SET,
and letting CP/M prompt us for input. For instance:
A> DATE SET
Would cause CP/M to respond with:
Enter todays date (MM/DD/YY):
Enter the date, or just press <RETURN> to skip the date, and CP/M will
then respond with:
Enter the time (HH:MM:SS):
Enter the time, or press <RETURN> to skip the time, and CP/M will
respond with:
Press any key to set the time.
Now that we have set the current date and current time, let us check
to ensure that CP/M has indeed noticed our actions. At the A> prompt,
type DATE and make sure that the date and time is actually what we had
set it to.
-
We are ready to begin time and date-stamping of our files on disk and
set up blank disks for future stamping.
To do this, we must first run the INITDIR utility in order to
initialize the directory. If files already exist on the disk, INITDIR
will check the space available for date and time stamps in the
directory. If there is not enough room there, INITDIR will not
initialize it and will return an error message. If the disk is
blank, the utility will set up your disk and set aside the appropriate
space in the directory to store the stamping. INITDIR can also be used
to clear time/date stamping from an already initialized disk, thus
recovering some disk space. Let's take an example of how all of this
is accomplished.
A> INITDIR
The system will return the following message:
INITDIR WILL ACTIVATE TIME STAMPS FOR SPECIFIED DRIVE.
Do you really want to re-format the directory: A (Y/N)?
If the directory were already initialized for time and date stamping,
then INITDIR would ask you:
Directory is already re-formatted.
Do you wish to recover date/time stamping directory space (Y/N)?
Answering Y will eliminate stamping on that disk and recover space. If
you answer N, then stamping remains active and INITDIR will then ask:
Do you want the existing date/time stamping cleared (Y/N)?
Entering Y will clear all current dates and times, but keep the disk
initialized for further stamping.
-
Now we are ready to stamp some files with the current date and time,
and once that is accomplished, any time we access or change that file,
the current time and date can be easily assigned. We need to use the
SET utility to set-up the file for the current time and date.
This SET utility is one with lots of power. Besides using it for time
and date stamping, it can allow us to set the file attributes (R/O and
R/W, DIR and SYS), set the disk attributes (R/O and R/W), assign a
label to the disk (just like a disk name in 64/128 mode), and assign
passwords to the disk and/or files. More about these other options
later. First, let's finish up time/date stamping.
SET has three accompanying specifications for time and date stamping.
They are: ACCESS, CREATE, and UPDATE. The first two, ACCESS and
CREATE, are mutually exclusive options, meaning that when one is turned
on, the other is automatically off.
SET [CREATE=ON] is used before you create a CP/M file and will record
the creation time of that file.
SET [ACCESS=ON] is used to record when the last file was accessed.
SET [UPDATE=ON] is used to record the time that the file was last
updated.
Thus, if you use both CREATE and UPDATE together, editing a file will
change both the UPDATE and CREATE stamps.
To view the file-stamping on your disk, all you have to do is use the
DIR.COM utility with the [FULL] specification, like this:
A> DIR [FULL]
The best way to understand how this stamping operation works is to set
ACCESS to ON, then load in a file on your disk. Abort from the
program and type in the DIR [FULL] command to see what has happened.
-
Now we will review how to set the file attributes to READ ONLY,
READ/WRITE, SYS, and DIR.
As you know, files that have a SYS designation are SYStem files which,
when in USER area 0 can be accessed from *any* USER area of the disk.
To set a file to a SYStem file, we would call up the SET command again,
but in this form (assuming that the file is called TESTING.COM):
A> SET TESTING.COM [SYS]
We could have, at the same time, set that same file so that it were
READ ONLY by typing this:
A> SET TESTING.COM [RO SYS]
The same holds true for the DIR and READ/WRITE attributes.
That was easy enough, and so is doing the same for the drive itself!
To set drive B for READ ONLY, we would type:
A> SET B: [RO]
NOTE that setting a drive to READ ONLY would mean that PIP could not
copy a file to it, RENAME could not rename a file on it, ERASE could
not delete a file from it, and you could not perform any disk writing
operation. Specifying READ/WRITE (RW) will reset the drive to its
original state, as will pressing CONTROL-C.
-
Now, let's set up a label for your disk, just like giving the disk a
name in C-64 or C-128 mode.
We can assign a label name of up to eight characters, plus a three
character type, similar to a file name and file type. For instance:
A> SET [NAME=GAMES.108]
This would give our disk the name GAMES.108. If we did not specify any
name, the label would be defaulted to LABEL. Labels make it easy for
us to catalog all of our CP/M disks.
-
We aren't done with the SET utility yet! If you've ever wanted to
password-protect a disk or disk file before, now is your chance.
To assign a password to the entire disk (actually to the disk label),
all you need to do is use the following format. We will assume that
you want to use a password of GENIE......
A> SET [PASSWORD=GENIE]
Easy enough. Hereafter, the SET command will prompt for this password
whenever you (or anyone else) tries to set any of the functions that
are controlled by the SET utility. If you do not set up a disk
password (label password), then anyone who has access to the disk can
set up other attributes using SET, which will make the disk
inaccessible to *you*!
Any time you want to remove this password from the disk label, use the
same syntax you used to assign it, but instead of the word just hit
<RETURN>. Example:
A> SET [PASSWORD=<RETURN>
Again, note that the first bracket '[' must be used for specs, but the
ending bracket ']' is optional.
-
Along with password-protecting the disk, we can also assign passwords
to individual files on that disk. To do this, we must first tell CP/M
to turn on protection for all disk files. We do this with yet another
form of the SET utility:
A> SET [PROTECT=ON]
Now we specify the file which we want to assign a password to, and then
the password itself:
A> SET TESTFILE.TXT [PASSWORD=GENIE]
Passwords for files do not need to be the same as those you use for the
disk. Also, passwords can be up to eight characters in length, and all
lower-case letters are translated to uppercase. In addition, you may
use wildcards in your filespecs and SET will assign that password to
all files that match.
Now we can set a password-protection mode for those files with
passwords. There are four forms we can use: READ, WRITE, DELETE, and
NONE. An example of this would be:
A> SET TESTFILE.TXT [PROTECT=READ]
Here is an explanation of the individual modes and the level of
protection they give your files:
READ - The password is required in order to read, copy, write, delete
or rename the file.
WRITE - The password is required in order to write, rename, or delete
the file. The password is not necessary to read the file.
DELETE - The password is required only if you want to rename or delete
the file. The password is not necessary to modify or read the file.
NONE - No password is in existence for the file. If one does exist,
you may use this to delete the password.
Here are two examples of chaining specs in order to password protect
files:
A> SET TESTFILE.TXT [PASSWORD=GENIE PROTECT=WRITE]
A> SET *.TXT [PASSWORD=GENIE PROTECT=WRITE]
The first example sets the password 'GENIE' to the file called
TESTFILE.TXT, and makes it WRITE protected to prevent someone from
editing it.
The second example does the same thing, but because we used the *
wildcard, *all* text files on the disk will be given the password and
WRITE protection.
-
WARNING!!!! Always make a record of your passwords! You will not be
able to access your files without your file-passwords, unless you turn
off the protection for the whole disk. AND!!.....if you forget the
password to the disk itself, you cannot access the disk in order to
access those files!
-
NOTES: I realize that the options we have discussed this month are not
really basic essentials that one needs to know, but they do go a long
way in familiarizing you with the CP/M environment and the syntax that
is used in almost all programs and utilities encountered in this
environment.
Next month we will discuss the KEYFIG utility that allows us to set-up
default colors, change our keyboard configuration, and execute them
automatically upon boot-up. Also, we will take a peek into SUBMIT files
and the PROFILE.SUB start-up file. Same time, same station!
-Mike Mantino