home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
dskutl
/
lan.arc
/
LAN.DOC
< prev
next >
Wrap
Text File
|
1988-06-29
|
24KB
|
674 lines
FLOPPY-LAN
(A floppy based local-area-network)
by L. P. Levine
3942 N. Oakland Avenue, Apt 241
Shorewood, WI 53211
This is a Beta test version of a file
control system. It is available for use at no
cost. Please let the author know about
failures and desired features. The programs
install.pas, lanmkdir.pas and lancomp.pas and
the batch file lan.bat are copyright L. P.
Levine 1988. The program touch.exe is
copyright Peter Stephen Heitman 1986.
This system allows a user to work on two PC computers (so
called IBM compatible), one that I will call the Home machine and
the other the Work machine and keep a reasonable number of files
on both machines current. The program will permit the user to
carry a floppy disk containing copies of whatever files have
changed from Home to Work and back with no special attention,
other than to run a process twice on each machine, once when the
user arrives at the machine, and again, just before leaving. Of
course the two computers must share a common floppy drive type.
The amount of file space supported can be considerably larger
than the capacity of a single floppy when the program is used
with the TRIM feature.
In practice, the user inserts a floppy disk and types "LAN"
when arriving at work and again just before leaving the office.
When the user gets home, it is only necessary to insert the same
disk and type "LAN" before beginning and again after completion
of home based work. Any files that have changed are written to
and from the floppy disk as the user moves that disk from machine
to machine.
In writing this document, I wrote part of the documenation
at home and part at work. I did software development at both
places. Files transferred without attention and at no time did
the fingers leave the hand.
With the exception of the PICNIX program touch.exe, all
programs are presented in source form. The programs install,
lanmkdir and lancomp deal only with text files and do no user
file manipulation. All file manipulation is done with normal DOS
calls (copy, del, mkdir, command, and dir) and with touch. These
calls appear in machine written batch files.
floppy-LAN Page 1
EXECUTION PROCEDURES
The batch file "lan.bat" is custom written by the INSTALL
program. Lan.bat consists of 5 main parts. First is an
execution of the program "lanmkdir" which reads a list of files
to be dually supported and writes a batch file "x1.bat". That
batch file is executed next, and outputs to a data file "x1.dat".
Third is executed a program "lancomp" which reads that data file
and prepares a second batch file "x2.bat" whose purpose is to
replace the older version of each of the supported files by the
younger. x2.bat is then executed and files are transferred.
Finally, in the delivered version of the program, the 3 files
named "x?.?at" are deleted. Pictorially it might appear as
follows:
Process: Data Files: What Happens:
------------ ----------- -----------------
lanmkdir.com <--- lan.fil A list of files is
---> x1.bat changed into a list
of DIR commands.
x1.bat ---> x1.dat The DIR commands are
executed into an
output file.
lancomp.com <--- x1.dat Differences in dates
---> x2.bat are noted. COPY com-
mands are created.
x2.bat Files are moved
between the floppy
and hard drives.
floppy-LAN Page 2
SYSTEM INITIALIZATION
FLOPPY DISK. A floppy disk must be formatted that is compatible
with both systems. A directory called \lan must be put on that
disk and one file, a copy of lan.fil, (the list of files
supported) or its alias must be put into that directory. LAN
will add any other files and directories needed.
HARD DISKS. On each of the two host machines a root directory
must be created called \lan. In that directory the four files
lan.bat, lan.fil, lanmkdir.com and lancomp.com must be placed.
(Touch.exe might be put in this directory also.) Lanmkdir and
lancomp are Turbo Pascal 3.01 programs whose sources are included
with this package. Lan.bat is a file that must be tailored to
each of the installations. Lan.fil is a file in which is put the
names of the files to be commonly supported. Finally, a
subdirectory of \lan on the hard disk called \lan\baq should (but
not must) be created.
LAN.FIL. This file is the main user interface with the LAN
system. In it the user must place all files that are to be
maintained on the two machines. The first file supported, and
therefore the first entry, must be the file \lan\lan.fil itself.
Other file names may be added at any time. An example of lan.fil
and instructions for its control are shown in the Technical
Details section below.
floppy-LAN Page 3
TECHNICAL DETAILS
The program uses four files: lan.bat, lanmkdir.com, lancomp.com
and lan.fil. They should be installed in the directory \lan on
the hard drive of both the Home and Work computers. In addition
a subdirectory \lan\baq should be prepared. No special pathing
is needed. During execution of the batch file, three files are
created, \lan\x1.bat, \lan\x1.dat, and \lan\x2.bat. They are
normally deleted at the end of the execution, but their deletion
can be inhibited (so that you can look at them) by the removal of
the last line of lan.bat.
LAN.BAT
Lan.bat is a batch file. It is created by running the
INSTALL program on each of the two computers used. A typical
file is shown below:
@echo off
lanmkdir BC
command /c \lan\x1
lancomp
command /c \lan\x2
del x?.?at
LANMKDIR
Name: lanmkdir - Create batch Directory commands
Usage: lanmkdir [FH [FILE]]
Version: 1.00 for PC-DOS and MS-DOS
(C) Copyright L. P. Levine 1988 -- All Rights
Reserved.
The options for lanmkdir are:
FH The drive letters used for the Floppy and Hard Disks.
Default values are A and C.
FILE The file used for input. Default value is lan.fil.
Lanmkdir is a Turbo Pascal program which may be called with
options. In the example above, the options are B and C, where
the first letter (B) is the floppy drive to be used and the
second letter (C) is the hard drive. It reads data from lan.fil
and writes the file x1.bat. The filename of the input file may
be added as a second option. Thus:
lanmkdir AD SUSIE.FIL
will use drives A and D and take data from file SUSIE.FIL. If no
options are used the default drives are A and C, and the default
file is lan.fil.
floppy-LAN Page 4
LAN.FIL
The ASCII file lan.fil is the list of files to be supported
on the two computers. An example of a typical lan.fil is shown
below:
\lan\lan.fil
\an\NOTES.
\llclass\students.dbf
\llclass\students.ndx
The first file supported is lan.fil itself, to ensure that the
two computers are working from the same list. If a file with no
extension is desired be sure to include the '.' at the end of its
name, as is shown in the example for the file \an\notes. The
filenames may be entered case independent and with the usual mix
of wildcards. Wildcard use is not encouraged as it becomes
increasingly difficult to keep track of the files created when
they are used. (For example, a scrap file may be created in the
wildcard group. It is dutifully saved and transferred. Later
the user may delete the file at home. It may well be returned at
the next execution of LAN and will show up again and again like
the bad penny.) In the present version no root files may be
supported.
X1.BAT
The output of lanmkdir is the file x1.bat which, for the
example above will be:
@echo off
echo --System Messages, if any-----
echo -------------------------------- >x1.dat
dir B:\lan\lan.fil >>x1.dat
echo -------------------------------- >>x1.dat
dir C:\lan\lan.fil >>x1.dat
echo -------------------------------- >>x1.dat
dir B:\an\notes. >>x1.dat
echo -------------------------------- >>x1.dat
dir C:\an\notes. >>x1.dat
echo -------------------------------- >>x1.dat
dir B:\llclass\students.dbf >>x1.dat
echo -------------------------------- >>x1.dat
dir C:\llclass\students.dbf >>x1.dat
echo -------------------------------- >>x1.dat
dir B:\llclass\students.ndx >>x1.dat
echo -------------------------------- >>x1.dat
dir C:\llclass\students.ndx >>x1.dat
echo -------------------------------- >>x1.dat
When x1.bat is executed, output is generated into x1.dat.
An example of x1.dat follows:
floppy-LAN Page 5
X1.DAT
--------------------------------
Volume in drive B has no label
Directory of B:\LAN
LAN FIL 384 6-09-88 1:10p
1 File(s) 35840 bytes free
--------------------------------
Volume in drive C is DRIVE_C
Directory of C:\LAN
LAN FIL 384 6-09-88 1:10p
1 File(s) 5181440 bytes free
--------------------------------
Volume in drive B has no label
Directory of B:\AN
NOTES 3141 6-08-88 11:49a
1 File(s) 35840 bytes free
--------------------------------
Volume in drive C is DRIVE_C
Directory of C:\AN
NOTES 3141 6-07-88 11:01p
1 File(s) 5179392 bytes free
--------------------------------
Volume in drive B has no label
Directory of B:\LLCLASS
STUDENTS DBF 75894 5-30-88 12:06p
1 File(s) 35840 bytes free
--------------------------------
Volume in drive C is DRIVE_C
Directory of C:\LLCLASS
STUDENTS DBF 75894 5-31-88 7:12p
1 File(s) 5177344 bytes free
--------------------------------
Volume in drive B has no label
Directory of B:\LLCLASS
STUDENTS NDX 63488 5-30-88 11:47a
1 File(s) 35840 bytes free
-------------------------------- (extra lines have
Volume in drive C is DRIVE_C have been
removed.)
Directory of C:\LLCLASS
STUDENTS NDX 63488 5-30-88 11:47a
1 File(s) 5177344 bytes free
--------------------------------
floppy-LAN Page 6
LANCOMP
Name: lancomp - makes copy commands
Usage: lancomp [TRIM]
Version: 1.00 for PC-DOS and MS-DOS
(C) Copyright L. P. Levine 1988 -- All Rights
Reserved.
The only option for lancomp is:
TRIM Causes files on the floppy drive to be
reduced in size after transfer to the hard
drive. Use only after system has been
debugged. Option is case dependent.
Lancomp is a program that reads the file x1.dat and writes a
command file x2.bat. From the example above it should be clear
that the hard disk copy of the file students.dbf is younger than
the floppy copy. In x2.bat (below) line 4 creates a new version
for the floppy drive, with echo on so that the user sees what is
happening. Since the file B:\an\notes is younger than its
version on the hard disk, lines 6-8 move a copy to the hard disk,
after saving the original version of the file in a backup
location (line 6). Finally, if the TRIM option of lancomp is
used, lines 10 and 11 replace the floppy copy with a file of
length zero bytes. That file occupies NO disk space on drive B,
permitting more files to be supported by LAN than will fit on the
floppy disk. The file is created and its date is set with the
unix like touch command. The only legal option for lancomp is
the option TRIM (case matters). The continuous switching of the
echo commands permits control of system messages.
X2.BAT
@echo off
echo --System Messages, if any-----
echo on
line 4 copy C:\LLCLASS\STUDENTS.DBF B:\LLCLASS\STUDENTS.DBF
@echo off
line 6 copy C:\AN\NOTES. C:\LAN\BAQ >nul:
echo on
line 8 copy B:\AN\NOTES. C:\AN\NOTES. >nul:
@echo off
line 10 del B:\AN\NOTES. >nul:
line 11 touch 0608114988 B:\AN\NOTES.
floppy-LAN Page 7
TOUCH.EXE
This file was taken from the shareware PICNIX set and is included
(with permission) with this program. Its documentation, repeated
below, can be displayed to the screen with the command "touch /h"
Name: touch - update last-write times of files
Usage: touch [ -c ] [ mmddhhmm[yy] ] file1 ...
Version: 1.0 for PC-DOS and MS-DOS
(C) Copyright Peter Stephen Heitman 1986 -- All
Rights Reserved Distributed with the PiCnix Package (tm) by
Peter Stephan Heitman
The options for touch are:
-c: prevent touch from creating files that
did not previously exist
[mmddhhmm[yy]]: set the last-write times of the arguments
to the given date and time.
NOTE: If the date and time are not given on the command line,
the last-write times of the arguments are set to the
current system time
/?: display this description of the program
NOTE: If the environment variable TOUCH exists, its value is
used to establish default options.
floppy-LAN Page 8
OPTIONS
The call to the program lanmkdir is:
lanmkdir [FH [FILE]]
The options are:
FH The drive letters used for the Floppy and Hard Disks.
Default values are A and C.
FILE The file used for input. Default value is lan.fil.
Typical calls are:
lanmkdir {Drives A and C, file lan.fil}
lanmkdir AD {Drives A and D, file lan.fil}
lanmkdir BC TEST.FIL {Drives B and C, file TEST.FIL}
The call to the program lancomp is:
lancomp [TRIM]
The options are:
TRIM Causes files on the floppy drive to be reduced in size
after transfer to the hard drive. Use only after
system has been debugged. Is case dependent.
Typical calls are:
lancomp {Does not reduce size of
floppy files after transfer}
lancomp TRIM {Reduces size of floppy files
after transfer}
The directory \lan\baq.
Before each transfer of data from the floppy disk to the
hard disk, the file about to be replaced is copied to the
directory \lan\baq, if that directory exists. Thus, the previous
edition of all files on the hard disk is preserved in this backup
directory. If the directory does not exist, the feature will
fail and no backup will be made. We recommend that the feature
be used.
floppy-LAN Page 9
ERROR MESSAGES
Message: File [filename] does not exist.
If the file lan.fil, or its equivalent does not exist,
the program lanmkdir will fail with this message.
Check to see if you have correctly handled the alias
name, if you are using one.
Message: File not found
Invalid Directory
If a file was recently added to the lan.fil list, it
might well not be on one of the volumes (either the
floppy or hard drive). If that is the case, the batch
file X1.BAT will generate this message. It is not an
error, merely an unavoidable diagnostic.
Message: There is a File On Hard Drive, not on Floppy Drive:
C:\dir\file.ext
Should I move it to floppy?(y,n)
There is a File On Floppy Drive, not on Hard Drive:
A:\dir\file.ext
Should I move it to hard drive?(y,n)
A new file has been created on one machine's hard disk
and put into lan.fil. This message requests the
user's permission to write it to the floppy, or later,
to the hard disk on the other computer. (In the
example, the name of the file is \dir\file.ext, in
reality, the true name of the file is used.) A "y" or
an "n" must be entered.
Message: There is a problem with file \dir\file.ext
(the floppy file is newer, but is of length zero.)
(there may be a clock error, no action will be taken.)
Strike a key to continue.
This is a message that should never arise. When used
with the TRIM option, the files on the floppy drive
are replaced with zero length files after being moved
to a hard drive. Thus there can be no way for a hard
disk file to have an earlier date than this zero
length floppy file. If, however, the time or date was
wrongly set on one computer, or if a computer battery
clock stops, or if the touch command was used to
backdate a file, time may actually run backwards.
This message reports on that event. No data transfer
occurs.
floppy-LAN Page 10
Message: Unable to create directory
In batch file X2.BAT, an attempt to move a NEW file to
either the hard or floppy disk is always preceded by
an attempt to create the associated directory. If
that directory already exists, this message will
result. It is not an error, merely an unavoidable
diagnostic.
Message: Insufficient disk space
It means what it says; bad news. Using the TRIM option
will enormously reduce the probability of having this
message appear when it applies to a floppy transfer
disk. If you are using the TRIM option and change
files controlling a large amount of supported
filespace in one session, then this message can
appear. Corrective action might be: split the system
into several small parts, make fewer changes at once,
deal with smaller files.
floppy-LAN Page 11