Thread View: comp.sources.bugs
1 messages
1 total messages
Started by Emmet P. Gray
Sun, 23 Aug 1992 03:55
Patch #6 to Mtools v2.0
Author: Emmet P. Gray
Date: Sun, 23 Aug 1992 03:55
Date: Sun, 23 Aug 1992 03:55
2035 lines
55426 bytes
55426 bytes
This is patch #6 to the Mtools v2.0 distribution package. This patch
will add the following features:
1) Mtools commands now use advisory locks to preclude two
processes from writing to the same DOS filesystem. You must
edit the Makefile to choose one of the 3 lock methods:
-DLOCKF, -DFLOCK, or -DFCNTL.
See the Configure file for more details.
2) An error detection routine has been added to determine if the
FAT encoding scheme in the devices.c file is correct.
3) Mtools commands now return exit codes with the following
meaning:
0 = success
1 = utter failure
2 = partial sucess/failure. (at least one successful
operation, but at least one failure)
It also corrects a bug when Mtools is used on machines that have 16 bit
integers. However, machines with 16 bit integers are limited to FAT
tables that are less than 64k in length.
Mtools v2.0.5 was posted to the comp.sources.unix news group the 2nd week
of January 92 as v25i097 thru v25i099.
The "always current" version of Mtools and all the patches are available
via anonymous ftp from cerl.cecer.army.mil (129.229.1.101). I've also
placed the code in the /tmp/mtools directory on ftp.uu.net, but I can't
say how long it will stay there.
Emmet P. Gray US Army, HQ III Corps & Fort Hood
...!uunet!uiucuxc!fthood!egray Attn: AFZF-DE-ENV
fthood!egray@uxc.cso.uiuc.edu Directorate of Engineering & Housing
Environmental Management Office
Fort Hood, TX 76544-5057
-------------------------------------------------------------------------------
Prereq: "2.0.5"
*** old/patchlevel.h Mon Aug 17 17:40:40 1992
--- patchlevel.h Wed Aug 19 18:08:36 1992
***************
*** 1,4 ****
! #define VERSION "2.0.5"
! #define DATE "25 Aug 91"
/*
--- 1,4 ----
! #define VERSION "2.0.6"
! #define DATE "21 Aug 92"
/*
***************
*** 16,18 ****
--- 16,19 ----
* patch #4 11 Apr 91
* patch #5 25 Aug 91
+ * patch #6 21 Aug 92
*** old/Configure Mon Aug 17 17:40:35 1992
--- Configure Sat Aug 22 13:48:45 1992
***************
*** 25,32 ****
BSD for systems without System V style strings functions
! and System V style utime().
! ISC default devices for ISC's Unix V.
UNIXPC default devices for AT&T Unix PC 7300/3B1
--- 25,49 ----
BSD for systems without System V style strings functions
! or System V style utime().
! INT16 Machines with 16 bit integers such as XENIX 286.
+ Pick one of the 3 following lock methods (if you have multiple
+ methods at your disposal, pick one in the following order). If
+ a method is not chosen, record locking will not be performed.
+
+ LOCKF XENIX3 and SVR3.2 lock method
+
+ FLOCK Berkeley lock method
+
+ FCNTL Alternate Berkeley lock method (may not work
+ on devices)
+
+ The folowing are pre-proccessor variables for the default device
+ setups for various flavors of Unix. Pick one of the these, or
+ create a new entry in the devices.c file.
+
+ ISC default devices for ISC's SVR3.2
+
UNIXPC default devices for AT&T Unix PC 7300/3B1
***************
*** 33,36 ****
--- 50,63 ----
SPARC default devices for SunOS 4.1 on a SPARCstation
+ DELL default devices for Dell's SVR4 and Merge
+
+ XENIX default devices for Xenix systems.
+
+ SUN386 default devices for Sun's i386 machine
+
+ RT_ACIS default devices for IBM's BSD clone.
+
+ SPARC_ODD for reading odd-ball disks on a Sparc
+
There is a variable in msdos.h called SIG_TYPE which should be
configured to the "base" return type of signal();
***************
*** 64,68 ****
fat_bits The encoding scheme for the File Allocation Table. Currently
! supports only 12 and 16 bit FATs.
mode any special open() mode flags (not normally used, except
--- 91,96 ----
fat_bits The encoding scheme for the File Allocation Table. Currently
! supports only 12 and 16 bit FATs. Hard disks usually use
! 16 bit FATs, while all diskettes use 12 bit FATs.
mode any special open() mode flags (not normally used, except
***************
*** 90,94 ****
safely ignored.
! 4) Examples devices
for Interactive 386ix 2.0.2 with:
--- 118,122 ----
safely ignored.
! 4) Some example devices
for Interactive 386ix 2.0.2 with:
***************
*** 115,119 ****
{'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9},
! {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, (int (*)()) 0, 0, 0, 0}
{'\0', (char *) NULL, 0L, 0, 0, (int (*)()) 0, 0, 0, 0}
--- 143,147 ----
{'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9},
! {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, (int (*)()) 0, 0, 0, 0},
{'\0', (char *) NULL, 0L, 0, 0, (int (*)()) 0, 0, 0, 0}
***************
*** 129,130 ****
--- 157,171 ----
device, and that only the number of sectors are
different.
+
+ for Dell's SVR4 with:
+ 5.25" 1.2m, 360k and 320k as a:
+ 3.5" 1.44m, 720k as b:
+ dos partition as c:
+
+ {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
+ {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
+ {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},
+ {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
+ {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
+ {'C', "/dev/rdsk/dos", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
+ {'\0', (char *) NULL, 0L, 0, 0, (int (*)()) 0, 0, 0, 0}
*** old/Makefile Sat Aug 22 10:09:04 1992
--- Makefile Sat Aug 22 14:06:57 1992
***************
*** 3,7 ****
#
# check the Configure file for some examples of device-specific setups
! # Berkeley flavors of Unix should include -DBSD in the CFLAGS
CFLAGS = -O
--- 3,17 ----
#
# check the Configure file for some examples of device-specific setups
! # Berkeley flavors of Unix should include -DBSD in the CFLAGS. Pick
! # a lock method... either -DLOCKF, -DFLOCK, or -DFCNTL and put that
! # string in the CFLAGS line below.
!
! # for Dell
! #CFLAGS = -O -DDELL -DLOCKF
! # for Sparc
! #CFLAGS = -O -DSPARC -DBSD -DFLOCK
! # for Xenix
! #CFLAGS = -O -M2e -DINT16 -DXENIX -DLOCKF
! #LDFLAGS = -s -M2e -i -f 5000
CFLAGS = -O
*** old/Mattrib.1 Mon Aug 17 17:40:36 1992
--- Mattrib.1 Sat Aug 22 14:13:13 1992
***************
*** 43,48 ****
is more cunning.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 43,48 ----
is more cunning.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 51,56 ****
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
.SH SEE ALSO
mcd(1)
.SH BUGS
! Most versions of ATTRIB don't allow this many options.
--- 51,59 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mattrib
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1)
.SH BUGS
! Most MSDOS versions of ATTRIB don't allow this many options.
*** old/Mcd.1 Mon Aug 17 17:40:36 1992
--- Mcd.1 Sat Aug 22 14:13:19 1992
***************
*** 18,28 ****
more than 6 hours old.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
directory name to be enclosed in quotes to protect it from the shell.
.SH SEE ALSO
mdir(1)
.SH BUGS
! MSDOS doesn't use CD to change to another device.
.PP
It may be wise to remove old .mcwd files at logout.
--- 18,33 ----
more than 6 hours old.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
directory name to be enclosed in quotes to protect it from the shell.
+ .PP
+ .I Mcd
+ returns 0 on success or 1 on failure.
.SH SEE ALSO
mdir(1)
.SH BUGS
! Unlike MSDOS versions of CD,
! .I mcd
! can be used to change to another device.
.PP
It may be wise to remove old .mcwd files at logout.
*** old/Mcopy.1 Mon Aug 17 17:40:36 1992
--- Mcopy.1 Sat Aug 22 14:13:24 1992
***************
*** 48,53 ****
asks whether or not to overwrite the file.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 48,53 ----
asks whether or not to overwrite the file.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 56,59 ****
--- 56,62 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mcopy
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1), mread(1), mwrite(1)
*** old/Mdel.1 Mon Aug 17 17:40:36 1992
--- Mdel.1 Sat Aug 22 14:13:31 1992
***************
*** 20,25 ****
will ask for verification prior to removing a read\-only file.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 20,25 ----
will ask for verification prior to removing a read\-only file.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 28,31 ****
--- 28,34 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mdel
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1)
*** old/Mdir.1 Mon Aug 17 17:40:36 1992
--- Mdir.1 Sat Aug 22 14:13:37 1992
***************
*** 25,30 ****
An error occurs if a component of the path is not a directory.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 25,30 ----
An error occurs if a component of the path is not a directory.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 33,36 ****
--- 33,39 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mdir
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1)
*** old/Mformat.1 Mon Aug 17 17:40:36 1992
--- Mformat.1 Thu Aug 20 14:25:50 1992
***************
*** 35,38 ****
--- 35,41 ----
(at least) those command line parameters that are different from the
default.
+ .PP
+ .I Mformat
+ returns 0 on success or 1 on failure.
.SH SEE ALSO
mlabel(1)
*** old/Mlabel.1 Mon Aug 17 17:40:37 1992
--- Mlabel.1 Thu Aug 20 14:26:06 1992
***************
*** 25,28 ****
--- 25,31 ----
will change the label (and display the new label if the verbose mode is
set).
+ .PP
+ .I Mlabel
+ returns 0 on success or 1 on failure.
.SH SEE ALSO
mformat(1)
*** old/Mmd.1 Mon Aug 17 17:40:37 1992
--- Mmd.1 Sat Aug 22 14:13:48 1992
***************
*** 26,31 ****
An error occurs if the directory already exists.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
directory name to be enclosed in quotes to protect it from the shell.
.PP
--- 26,31 ----
An error occurs if the directory already exists.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
directory name to be enclosed in quotes to protect it from the shell.
.PP
***************
*** 34,37 ****
--- 34,40 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mmd
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1), mrd(1)
*** old/Mrd.1 Mon Aug 17 17:40:37 1992
--- Mrd.1 Sat Aug 22 14:13:53 1992
***************
*** 11,16 ****
An error occurs if the directory is not empty.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
directory name to be enclosed in quotes to protect it from the shell.
.PP
--- 11,16 ----
An error occurs if the directory is not empty.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
directory name to be enclosed in quotes to protect it from the shell.
.PP
***************
*** 19,22 ****
--- 19,25 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mrd
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1), mmd(1)
*** old/Mread.1 Mon Aug 17 17:40:37 1992
--- Mread.1 Sat Aug 22 14:14:00 1992
***************
*** 40,45 ****
asks whether or not to overwrite the file.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 40,45 ----
asks whether or not to overwrite the file.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 48,51 ****
--- 48,54 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mread
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1), mcopy(1), mtype(1), mwrite(1)
*** old/Mren.1 Mon Aug 17 17:40:37 1992
--- Mren.1 Sat Aug 22 14:14:07 1992
***************
*** 32,37 ****
may be used to rename directories.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 32,37 ----
may be used to rename directories.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 40,45 ****
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
.SH SEE ALSO
mcd(1)
.SH BUGS
! MSDOS can't use REN to rename directories.
--- 40,50 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mread
+ returns 0 on success or 1 on failure.
.SH SEE ALSO
mcd(1)
.SH BUGS
! Unlike the MSDOS version of REN,
! .I mren
! can be used to rename directories.
*** old/Mtools.1 Mon Aug 17 17:40:37 1992
--- Mtools.1 Sat Aug 22 14:14:12 1992
***************
*** 26,30 ****
MSDOS filenames are optionally composed of a drive letter followed by a
colon, a subdirectory, and a filename. Subdirectory names can use either
! the '/' or '\e\' separator. The use of the '\e\' separator or wildcards
will require the names to be enclosed in quotes to protect them from the
shell.
--- 26,30 ----
MSDOS filenames are optionally composed of a drive letter followed by a
colon, a subdirectory, and a filename. Subdirectory names can use either
! the '/' or '\e' separator. The use of the '\e' separator or wildcards
will require the names to be enclosed in quotes to protect them from the
shell.
***************
*** 42,45 ****
--- 42,48 ----
directory (relative to the MSDOS filesystem), otherwise the default is
assumed to be A:/.
+ .PP
+ All the Mtools commands return 0 on success, 1 on utter failure, or 2
+ on partial failure.
.SH SEE ALSO
mattrib(1), mcd(1), mdel(1), mformat(1), mrd(1), mren(1), mtype(1),
*** old/Mtype.1 Mon Aug 17 17:40:37 1992
--- Mtype.1 Sat Aug 22 14:14:17 1992
***************
*** 24,29 ****
will strip the high bit from the data.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 24,29 ----
will strip the high bit from the data.
.PP
! MSDOS subdirectory names are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 32,35 ****
--- 32,38 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mtype
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1), mread(1)
*** old/Mwrite.1 Mon Aug 17 17:40:37 1992
--- Mwrite.1 Sat Aug 22 14:14:23 1992
***************
*** 50,55 ****
set).
.PP
! MSDOS subdirectory names are are supported with either the '/' or '\e\'
! separator. The use of the '\e\' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
--- 50,55 ----
set).
.PP
! MSDOS subdirectory names are are supported with either the '/' or '\e'
! separator. The use of the '\e' separator or wildcards will require the
names to be enclosed in quotes to protect them from the shell.
.PP
***************
*** 58,61 ****
--- 58,64 ----
command may be used to establish the device and the current working
directory (relative to MSDOS), otherwise the default is A:/.
+ .PP
+ .I Mwrite
+ returns 0 on success, 1 on utter failure, or 2 on partial failure.
.SH SEE ALSO
mcd(1), mcopy(1), mread(1)
*** old/Readme Mon Aug 17 17:40:37 1992
--- Readme Fri Aug 21 12:09:28 1992
***************
*** 62,65 ****
--- 62,68 ----
Mcopy is really a front-end to the low level Mread and Mwrite commands.
+ Please *DO* read the Configure file and the Release.notes (that's why
+ they're there...).
+
Emmet P. Gray US Army, HQ III Corps & Fort Hood
...!uunet!uiucuxc!fthood!egray Attn: AFZF-DE-ENV
*** old/Release.notes Mon Aug 17 17:40:38 1992
--- Release.notes Sat Aug 22 13:31:07 1992
***************
*** 1,2 ****
--- 1,70 ----
+ Patch #6, 21 Aug 92
+
+ This patch will add the following features:
+
+ 1) Mtools commands now use advisory locks to preclude two
+ processes from writing to the same DOS filesystem. You must
+ edit the Makefile to choose one of the 3 lock methods:
+ -DLOCKF, -DFLOCK, or -DFCNTL.
+ See the Configure file for more details.
+
+ 2) An error detection routine has been added to determine if the
+ FAT encoding scheme in the devices.c file is correct.
+
+ 3) Mtools commands now return exit codes with the following
+ meaning:
+ 0 = success
+ 1 = utter failure
+ 2 = partial sucess/failure. (at least one successful
+ operation, but at least one failure)
+
+ It also corrects a bug when Mtools is used on machines that have 16 bit
+ integers. However, machines with 16 bit integers are limited to FAT
+ tables that are less than 64k in length.
+ -------------------------------------------------------------------------------
+ Patch #5, 25 Aug 91
+
+ This patch will add a few new features:
+
+ 1) Mtools will now work properly on MSDOS partitions that are
+ greater than 32M.
+
+ 2) If the "current working directory" information (contained in
+ the $HOME/.mcwd file) is more than 6 hours old, Mtools will
+ issue a warning and ignore the old information.
+
+ 3) The mcopy command will now copy files between 2 MSDOS file
+ systems (such as mcopy "a:*" b:).
+
+ -------------------------------------------------------------------------------
+ Patch #4, 11 Apr 91
+
+ This patch will fix a bug in the mmd command where directories
+ inherited the file name extension of the parent directory. It
+ also adds a feature that will allow the copying of zero length
+ files.
+
+ -------------------------------------------------------------------------------
+ Patch #3, 28 Nov 90
+
+ This patch will fix a bug where Mtools sometimes bypasses the
+ disk "cache" and reads/writes to the disk directly.
+
+ -------------------------------------------------------------------------------
+ Patch #2, 21 Nov 90
+
+ This patch will fix a bug in the folding of MSDOS filenames to
+ lower case, and will fix a bug that could prevent the detection
+ of a full disk.
+
+ -------------------------------------------------------------------------------
+ Patch #1, 12 Oct 90
+
+ This patch will fix a few problems on Berkekely flavors of Unix,
+ and will fix the floating point exception bug when Mtools is
+ used with diskettes that have been formatted under very old DOS
+ (or formatted by some other non-DOS system).
+
+ -------------------------------------------------------------------------------
New in the v2.0 release....
*** old/buf_write.c Mon Aug 17 17:40:38 1992
--- buf_write.c Mon Aug 17 17:37:34 1992
***************
*** 11,15 ****
extern long disk_offset, disk_current;
extern unsigned char *disk_buf;
! static int blank_cyl();
void
--- 11,15 ----
extern long disk_offset, disk_current;
extern unsigned char *disk_buf;
! static int read_cyl();
void
***************
*** 49,52 ****
--- 49,53 ----
disk_flush();
+ disk_current = (i / disk_size) * disk_size;
/*
* If there is something on the new cylinder that
***************
*** 54,61 ****
* before writing.
*/
! if (blank_cyl(i))
! disk_current = (i / disk_size) * disk_size;
! else {
! disk_current = (i / disk_size) * disk_size;
where = (disk_current * MSECTOR_SIZE) + disk_offset;
length = disk_size * MSECTOR_SIZE;
--- 55,59 ----
* before writing.
*/
! if (read_cyl(disk_current)) {
where = (disk_current * MSECTOR_SIZE) + disk_offset;
length = disk_size * MSECTOR_SIZE;
***************
*** 114,131 ****
/*
* Determine if the cylinder has some useful information on it. Returns a 1
! * if it is blank.
*/
static int
! blank_cyl(num)
! long num;
{
register unsigned int i;
unsigned int start, end, fat_decode();
- long sector;
- sector = (num / disk_size) * disk_size;
if (!sector)
! return(0);
start = ((sector - dir_start - dir_len) / clus_size) + 2;
--- 112,127 ----
/*
* Determine if the cylinder has some useful information on it. Returns a 1
! * if it needs to be read.
*/
static int
! read_cyl(sector)
! long sector;
{
register unsigned int i;
unsigned int start, end, fat_decode();
if (!sector)
! return(1);
start = ((sector - dir_start - dir_len) / clus_size) + 2;
***************
*** 135,140 ****
/* if fat_decode returns non-zero */
if (fat_decode(i))
! return(0);
}
! return(1);
}
--- 131,136 ----
/* if fat_decode returns non-zero */
if (fat_decode(i))
! return(1);
}
! return(0);
}
*** old/devices.c Sat Aug 22 10:08:38 1992
--- devices.c Sat Aug 22 13:55:13 1992
***************
*** 32,42 ****
#endif /* ISC */
- #ifdef MASSCOMP
- struct device devices[] = {
- {'A', "/dev/rflp", 0L, 12, 0, (int (*) ()) 0, 80, 2, 8},
- {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
- };
- #endif /* MASSCOMP */
-
#ifdef SPARC
struct device devices[] = {
--- 32,35 ----
***************
*** 86,87 ****
--- 79,167 ----
}
#endif /* UNIXPC */
+
+ #ifdef RT_ACIS
+ struct device devices[] = {
+ {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
+ {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
+ {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
+ };
+ #endif /* RT_ACIS */
+
+ #ifdef SUN386
+ struct device devices[] = {
+ {'A', "/dev/rfdl0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
+ {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
+ {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
+ };
+ #endif /* SUN386 */
+
+
+ #ifdef SPARC_ODD
+ #include <sys/types.h>
+ #include <sun/dkio.h>
+ #include <fcntl.h>
+
+ int init_sparc();
+
+ struct device devices[] = {
+ {'A', "/dev/rfd0c", 0L, 12, 0, init_sparc, 80, 2, 0},
+ {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
+ };
+
+ /*
+ * Stuffing back the floppy parameters into the driver allows for gems
+ * like 10 sector or single sided floppies from Atari ST systems.
+ *
+ * Martin Schulz, Universite de Moncton, N.B., Canada, March 11, 1991.
+ */
+
+ int
+ init_sparc(fd, ntracks, nheads, nsect)
+ int fd, ntracks, nheads, nsect;
+ {
+ struct fdk_char dkbuf;
+ struct dk_map dkmap;
+
+ if (ioctl(fd, FDKIOGCHAR, &dkbuf) != 0) {
+ ioctl(fd, FDKEJECT, NULL);
+ return(1);
+ }
+
+ if (ioctl(fd, DKIOCGPART, &dkmap) != 0) {
+ ioctl(fd, FDKEJECT, NULL);
+ return(1);
+ }
+
+ if (ntracks && nheads)
+ dkbuf.ncyl = ntracks * nheads;
+ if (nheads)
+ dkbuf.nhead = nheads;
+ if (nsect)
+ dkbuf.secptrack = nsect;
+
+ if (ntracks && nheads && nsect )
+ dkmap.dkl_nblk = ntracks * nheads * nsect;
+
+ if (ioctl(fd, FDKIOSCHAR, &dkbuf) != 0) {
+ ioctl(fd, FDKEJECT, NULL);
+ return(1);
+ }
+
+ if (ioctl(fd, DKIOCSPART, &dkmap) != 0) {
+ ioctl(fd, FDKEJECT, NULL);
+ return(1);
+ }
+ return(0);
+ }
+ #endif /* SPARC_ODD */
+
+ #ifdef XENIX
+ struct device devices[] = {
+ {'A', "/dev/fd096ds15", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
+ {'A', "/dev/fd048ds9", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
+ {'B', "/dev/fd1135ds18", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
+ {'B', "/dev/fd1135ds9", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
+ {'C', "/dev/hd0d", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
+ {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
+ };
+ #endif /* XENIX */
*** old/dir_make.c Mon Aug 17 17:40:38 1992
--- dir_make.c Sun Sep 22 10:52:04 1991
***************
*** 63,67 ****
dir_buf = (unsigned char *) realloc((char *) dir_buf, (unsigned int) new * MSECTOR_SIZE);
if (dir_buf == NULL) {
! perror("dir_grow: malloc");
exit(1);
}
--- 63,67 ----
dir_buf = (unsigned char *) realloc((char *) dir_buf, (unsigned int) new * MSECTOR_SIZE);
if (dir_buf == NULL) {
! perror("dir_grow: realloc");
exit(1);
}
*** old/dir_read.c Mon Aug 17 17:40:38 1992
--- dir_read.c Sun Sep 22 11:08:00 1991
***************
*** 38,43 ****
unsigned int next, fat_decode();
unsigned char *offset;
! char *malloc();
! void free(), perror(), exit(), disk_read(), dir_flush();
length = 0;
--- 38,43 ----
unsigned int next, fat_decode();
unsigned char *offset;
! char *realloc();
! void perror(), exit(), disk_read(), dir_flush();
length = 0;
***************
*** 71,78 ****
dir_flush();
/* fill the dir_buf */
! free((char *) dir_buf);
! dir_buf = (unsigned char *) malloc((unsigned int) length * MSECTOR_SIZE);
if (dir_buf == NULL) {
! perror("fill_chain: malloc");
exit(1);
}
--- 71,77 ----
dir_flush();
/* fill the dir_buf */
! dir_buf = (unsigned char *) realloc(dir_buf, (unsigned int) length * MSECTOR_SIZE);
if (dir_buf == NULL) {
! perror("fill_chain: realloc");
exit(1);
}
***************
*** 96,101 ****
{
register int i;
! char *malloc();
! void free(), disk_read(), dir_flush(), exit(), perror();
if (dir_dirty)
--- 95,100 ----
{
register int i;
! char *malloc(), *realloc();
! void disk_read(), dir_flush(), exit(), perror();
if (dir_dirty)
***************
*** 106,112 ****
if (code == OLD)
! free((char *) dir_buf);
!
! dir_buf = (unsigned char *) malloc((unsigned int) dir_len * MSECTOR_SIZE);
if (dir_buf == NULL) {
perror("reset_chain: malloc");
--- 105,111 ----
if (code == OLD)
! dir_buf = (unsigned char *) realloc(dir_buf, (unsigned int) dir_len * MSECTOR_SIZE);
! else
! dir_buf = (unsigned char *) malloc((unsigned int) dir_len * MSECTOR_SIZE);
if (dir_buf == NULL) {
perror("reset_chain: malloc");
*** old/fat_read.c Mon Aug 17 17:40:38 1992
--- fat_read.c Sat Aug 22 13:46:35 1992
***************
*** 18,23 ****
unsigned int num;
{
! unsigned int fat, fat_hi, fat_low, byte_1, byte_2;
! int start;
if (fat_bits == 12) {
--- 18,22 ----
unsigned int num;
{
! unsigned int fat, fat_hi, fat_low, byte_1, byte_2, start;
if (fat_bits == 12) {
***************
*** 70,74 ****
/*
! * Read the entire FAT table into memory.
*/
--- 69,74 ----
/*
! * Read the entire FAT table into memory. Crude error detection on wrong
! * FAT encoding scheme.
*/
***************
*** 77,86 ****
int start;
{
! int buflen;
char *malloc();
void perror(), exit(), disk_read();
/* only the first copy of the FAT */
buflen = fat_len * MSECTOR_SIZE;
! fat_buf = (unsigned char *) malloc((unsigned int) buflen);
if (fat_buf == NULL) {
perror("fat_read: malloc");
--- 77,97 ----
int start;
{
! int i;
! unsigned int buflen;
char *malloc();
void perror(), exit(), disk_read();
+
+ #ifdef INT16
+ long junk;
+ junk = (long) fat_len * MSECTOR_SIZE;
+
+ if (junk > 65535L) {
+ fprintf(stderr, "fat_read: FAT table is too large\n");
+ exit(1);
+ }
+ #endif /* INT16 */
/* only the first copy of the FAT */
buflen = fat_len * MSECTOR_SIZE;
! fat_buf = (unsigned char *) malloc(buflen);
if (fat_buf == NULL) {
perror("fat_read: malloc");
***************
*** 88,92 ****
}
/* read the FAT sectors */
! disk_read((long) start, fat_buf, buflen);
/* the encoding scheme */
--- 99,104 ----
}
/* read the FAT sectors */
! for (i=start; i<start+fat_len; i++)
! disk_read((long) i, &fat_buf[(i-start)*MSECTOR_SIZE], MSECTOR_SIZE);
/* the encoding scheme */
***************
*** 94,97 ****
--- 106,113 ----
end_fat = 0xfff;
last_fat = 0xff8;
+ if (fat_buf[3] == 0xff) {
+ fprintf(stderr, "fat_read: wrong FAT encoding\n");
+ exit(1);
+ }
}
else {
***************
*** 98,101 ****
--- 114,121 ----
end_fat = 0xffff;
last_fat = 0xfff8;
+ if (fat_buf[3] != 0xff) {
+ fprintf(stderr, "fat_read: wrong FAT encoding\n");
+ exit(1);
+ }
}
return;
*** old/fat_write.c Mon Aug 17 17:40:38 1992
--- fat_write.c Sat Aug 22 13:17:03 1992
***************
*** 15,19 ****
unsigned int code;
{
! int start;
if (fat_bits == 12) {
--- 15,19 ----
unsigned int code;
{
! unsigned int start;
if (fat_bits == 12) {
***************
*** 71,75 ****
fat_write()
{
! int fat_start, buflen, dups;
void disk_write();
--- 71,75 ----
fat_write()
{
! int i, start, dups;
void disk_write();
***************
*** 77,84 ****
return;
! fat_start = dir_start - (fat_len * num_fat);
! buflen = fat_len * MSECTOR_SIZE;
! disk_write((long) fat_start, fat_buf, buflen);
/*
--- 77,84 ----
return;
! start = dir_start - (fat_len * num_fat);
! for (i=start; i<start+fat_len; i++)
! disk_write((long) i, &fat_buf[(i-start)*MSECTOR_SIZE], MSECTOR_SIZE);
/*
***************
*** 88,93 ****
dups = num_fat - 1;
while (dups--) {
! fat_start += fat_len;
! disk_write((long) fat_start, fat_buf, buflen);
}
}
--- 88,94 ----
dups = num_fat - 1;
while (dups--) {
! start += fat_len;
! for (i=start; i<start+fat_len; i++)
! disk_write((long) i, &fat_buf[(i-start)*MSECTOR_SIZE], MSECTOR_SIZE);
}
}
*** old/file_read.c Mon Aug 17 17:40:38 1992
--- file_read.c Sun Sep 22 10:04:24 1991
***************
*** 52,56 ****
/* write it */
if (fwrite((char *) out_buf, sizeof(*out_buf), out_len, fp) == 0) {
! perror("file_write: fwrite");
return(-1);
}
--- 52,56 ----
/* write it */
if (fwrite((char *) out_buf, sizeof(*out_buf), out_len, fp) == 0) {
! perror("file_read: fwrite");
return(-1);
}
***************
*** 60,64 ****
out_len = (size - current > in_len) ? in_len : size - current;
if (fwrite((char *) in_buf, sizeof(*in_buf), out_len, fp) == 0) {
! perror("file_write: fwrite");
return(-1);
}
--- 60,64 ----
out_len = (size - current > in_len) ? in_len : size - current;
if (fwrite((char *) in_buf, sizeof(*in_buf), out_len, fp) == 0) {
! perror("file_read: fwrite");
return(-1);
}
*** old/file_write.c Mon Aug 17 17:40:38 1992
--- file_write.c Sun Sep 22 10:04:36 1991
***************
*** 111,115 ****
else {
if ((i = fread((char *) tbuf, sizeof(*tbuf), buflen, fp)) <= 0) {
! perror("putcluster: fread");
return(-1);
}
--- 111,115 ----
else {
if ((i = fread((char *) tbuf, sizeof(*tbuf), buflen, fp)) <= 0) {
! perror("put_cluster: fread");
return(-1);
}
*** old/init.c Mon Aug 17 17:40:38 1992
--- init.c Fri Aug 21 13:20:30 1992
***************
*** 34,38 ****
{
int fat_start, tracks, heads, sectors, old_dos;
! char *malloc(), *name, *expand();
void perror(), exit(), reset_chain(), free(), fat_read();
struct bootsector *boot;
--- 34,38 ----
{
int fat_start, tracks, heads, sectors, old_dos;
! char buf[256], *malloc(), *name, *expand();
void perror(), exit(), reset_chain(), free(), fat_read();
struct bootsector *boot;
***************
*** 63,69 ****
name = expand(dev->name);
if ((fd = open(name, mode | dev->mode)) < 0) {
! perror("init: open");
exit(1);
}
/* set default parameters, if needed */
if (dev->gioctl) {
--- 63,75 ----
name = expand(dev->name);
if ((fd = open(name, mode | dev->mode)) < 0) {
! sprintf(buf, "init: open \"%s\"", name);
! perror(buf);
exit(1);
}
+ /* lock the device on writes */
+ if (mode == 2 && lock_dev(fd)) {
+ fprintf(stderr, "Device \"%s\" is busy\n", dev->name);
+ exit(1);
+ }
/* set default parameters, if needed */
if (dev->gioctl) {
***************
*** 210,220 ****
#endif /* FULL_CYL */
- /*
- * The driver in Dell's SVR4 v2.01 is unreliable with large writes.
- */
- #ifdef DELL
- disk_size = 1;
- #endif /* DELL */
-
disk_buf = (unsigned char *) malloc((unsigned int) disk_size * MSECTOR_SIZE);
if (disk_buf == NULL) {
--- 216,219 ----
***************
*** 323,325 ****
--- 322,363 ----
return(&boot);
+ }
+
+ /*
+ * Create an advisory lock on the device to prevent concurrent writes.
+ * Uses either lockf, flock, or fcntl locking methods. See the Makefile
+ * and the Configure files for how to specify the proper method.
+ */
+
+ static int
+ lock_dev(fd)
+ int fd;
+ {
+ #ifdef LOCKF
+ #include <unistd.h>
+
+ if (lockf(fd, F_TLOCK, 0) < 0)
+ return(1);
+ #endif /* LOCKF */
+
+ #ifdef FLOCK
+ #include <sys/file.h>
+
+ if (flock(fd, LOCK_EX|LOCK_NB) < 0)
+ return(1);
+ #endif /* FLOCK */
+
+ #ifdef FCNTL
+ #include <fcntl.h>
+ struct flock flk;
+
+ flk.l_type = F_WRLCK;
+ flk.l_whence = 0;
+ flk.l_start = 0L;
+ flk.l_len = 0L;
+
+ if (fcntl(fd, F_SETLK, &flk) < 0)
+ return(1);
+ #endif /* FCNTL */
+ return(0);
}
*** old/mattrib.c Mon Aug 17 17:40:39 1992
--- mattrib.c Wed Aug 19 12:22:42 1992
***************
*** 30,34 ****
{
int entry, ismatch, oops, fargn, read_only, hidden, sys, archive;
! int i, action;
char *filename, *newfile, *unix_name(), drive, get_drive();
char *get_path(), *pathname, *get_name(), *fix_mcwd(), last_drive;
--- 30,34 ----
{
int entry, ismatch, oops, fargn, read_only, hidden, sys, archive;
! int i, action, got_one, missed_one;
char *filename, *newfile, *unix_name(), drive, get_drive();
char *get_path(), *pathname, *get_name(), *fix_mcwd(), last_drive;
***************
*** 38,41 ****
--- 38,43 ----
oops = 0;
fargn = -1;
+ got_one = 0;
+ missed_one = 0;
archive = LEAVE;
hidden = LEAVE;
***************
*** 95,98 ****
--- 97,101 ----
if (init(drive, 2)) {
fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
+ missed_one++;
continue;
}
***************
*** 101,106 ****
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname))
continue;
/* see if exists and do it */
--- 104,111 ----
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname)) {
! missed_one++;
continue;
+ }
/* see if exists and do it */
***************
*** 140,147 ****
dir_write(entry, dir);
ismatch++;
}
}
! if (!ismatch)
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
}
dir_flush();
--- 145,155 ----
dir_write(entry, dir);
ismatch++;
+ got_one++;
}
}
! if (!ismatch) {
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
+ missed_one++;
+ }
}
dir_flush();
***************
*** 148,151 ****
--- 156,163 ----
disk_flush();
close(fd);
+ if (got_one && missed_one)
+ exit(2);
+ if (missed_one)
+ exit(1);
exit(0);
}
*** old/mcopy.c Mon Aug 17 17:40:39 1992
--- mcopy.c Fri Aug 21 13:35:22 1992
***************
*** 11,14 ****
--- 11,16 ----
#include <stdio.h>
#include <ctype.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
#include "patchlevel.h"
***************
*** 18,21 ****
--- 20,27 ----
#define MKDIR
+ #ifndef WEXITSTATUS
+ #define WEXITSTATUS(x) (((x)>>8)&0xff)
+ #endif /* WEXITSTATUS */
+
main(argc, argv)
int argc;
***************
*** 25,29 ****
extern char *optarg;
int i, oops, msdos_args, unix_args, destination;
! char **nargv, **malloc();
void exit();
/* get command line options */
--- 31,35 ----
extern char *optarg;
int i, oops, msdos_args, unix_args, destination;
! char **nargv, *malloc();
void exit();
/* get command line options */
***************
*** 93,98 ****
{
extern int optind;
! int i, j, pid, status;
! char *tmpdir, *mktemp(), **nargv, **malloc(), buf[256], *strcpy();
char *unixname(), *realloc();
void exit();
--- 99,104 ----
{
extern int optind;
! int i, j, pid, status_read, status_write;
! char *tmpdir, *mktemp(), **nargv, *malloc(), buf[256], *strcpy();
char *unixname(), *realloc();
void exit();
***************
*** 109,114 ****
/* create a temp directory */
tmpdir = mktemp("/tmp/mtoolsXXXXXX");
! if (mkdir(tmpdir, 0777) < 0)
perror("mkdir");
nargv[j++] = tmpdir;
--- 115,122 ----
/* create a temp directory */
tmpdir = mktemp("/tmp/mtoolsXXXXXX");
! if (mkdir(tmpdir, 0777) < 0) {
perror("mkdir");
+ exit(1);
+ }
nargv[j++] = tmpdir;
***************
*** 119,124 ****
execvp("mread", nargv);
! while (wait(&status) != pid)
;
/* reconstruct the argv[] */
nargv[0] = "sh";
--- 127,135 ----
execvp("mread", nargv);
! while (wait(&status_read) != pid)
;
+ /* we blew it... */
+ if (WEXITSTATUS(status_read) == 1)
+ exit(1);
/* reconstruct the argv[] */
nargv[0] = "sh";
***************
*** 154,158 ****
execvp("sh", nargv);
! while (wait(&status) != pid)
;
/* clobber the directory */
--- 165,169 ----
execvp("sh", nargv);
! while (wait(&status_write) != pid)
;
/* clobber the directory */
***************
*** 159,163 ****
sprintf(buf, "rm -fr %s", tmpdir);
system(buf);
! exit(0);
}
--- 170,174 ----
sprintf(buf, "rm -fr %s", tmpdir);
system(buf);
! exit(WEXITSTATUS(status_write));
}
***************
*** 190,193 ****
--- 201,205 ----
#ifdef MKDIR
+ /* ARGSUSED */
mkdir(path, mode)
char *path;
*** old/mdel.c Mon Aug 17 17:40:39 1992
--- mdel.c Tue Aug 18 13:39:28 1992
***************
*** 28,32 ****
char *argv[];
{
! int i, ismatch, entry, nogo, verbose, fargn;
unsigned int start;
char *filename, *newfile, *get_name(), *unix_name(), *get_path();
--- 28,32 ----
char *argv[];
{
! int i, ismatch, entry, nogo, verbose, fargn, got_one, missed_one;
unsigned int start;
char *filename, *newfile, *get_name(), *unix_name(), *get_path();
***************
*** 39,42 ****
--- 39,45 ----
signal(SIGQUIT, (SIG_TYPE(*) ()) got_signal);
+ got_one = 0;
+ missed_one = 0;
+
if (argc > 1 && !strcmp(argv[1], "-v")) {
verbose = 1;
***************
*** 66,69 ****
--- 69,73 ----
if (init(drive, 2)) {
fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
+ missed_one++;
continue;
}
***************
*** 72,77 ****
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname))
continue;
nogo = 0;
--- 76,83 ----
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname)) {
! missed_one++;
continue;
+ }
nogo = 0;
***************
*** 112,122 ****
dir->name[0] = 0xe5;
dir_write(entry, dir);
}
}
! if (fat_error)
break;
! if (!ismatch)
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
}
/* write the FAT, flush the buffers */
--- 118,133 ----
dir->name[0] = 0xe5;
dir_write(entry, dir);
+ got_one++;
}
}
! if (fat_error) {
! missed_one++;
break;
+ }
! if (!ismatch) {
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
+ missed_one++;
+ }
}
/* write the FAT, flush the buffers */
***************
*** 125,128 ****
--- 136,143 ----
disk_flush();
close(fd);
+ if (got_one && missed_one)
+ exit(2);
+ if (missed_one)
+ exit(1);
exit(0);
}
*** old/mmd.c Mon Aug 17 17:40:39 1992
--- mmd.c Tue Aug 18 14:03:24 1992
***************
*** 29,33 ****
char *argv[];
{
! int i, entry, slot, fargn, verbose, oops;
extern unsigned int end_fat;
unsigned int fat, dot, next_fat();
--- 29,33 ----
char *argv[];
{
! int i, entry, slot, fargn, verbose, oops, got_one, missed_one;
extern unsigned int end_fat;
unsigned int fat, dot, next_fat();
***************
*** 46,49 ****
--- 46,51 ----
verbose = 0;
oops = 0;
+ got_one = 0;
+ missed_one = 0;
if (argc > 1) {
if (!strcmp(argv[1], "-v")) {
***************
*** 73,76 ****
--- 75,79 ----
if (init(drive, 2)) {
fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
+ missed_one++;
continue;
}
***************
*** 83,88 ****
pathname = get_path(argv[i]);
! if (subdir(drive, pathname))
continue;
/* see if exists and get slot */
slot = -1;
--- 86,93 ----
pathname = get_path(argv[i]);
! if (subdir(drive, pathname)) {
! missed_one++;
continue;
+ }
/* see if exists and get slot */
slot = -1;
***************
*** 119,127 ****
}
}
! if (oops)
continue;
/* no '.' entry means root directory */
if (dot == 0 && slot < 0) {
fprintf(stderr, "%s: No directory slots\n", argv[0]);
continue;
}
--- 124,135 ----
}
}
! if (oops) {
! missed_one++;
continue;
+ }
/* no '.' entry means root directory */
if (dot == 0 && slot < 0) {
fprintf(stderr, "%s: No directory slots\n", argv[0]);
+ missed_one++;
continue;
}
***************
*** 130,133 ****
--- 138,142 ----
if (dir_grow(dot)) {
fprintf(stderr, "%s: Disk full\n", argv[0]);
+ missed_one++;
continue;
}
***************
*** 138,141 ****
--- 147,151 ----
if ((fat = next_fat(0)) == 1) {
fprintf(stderr, "%s: Disk full\n", argv[0]);
+ missed_one++;
continue;
}
***************
*** 147,150 ****
--- 157,161 ----
empty_dir(fat, dot);
fat_encode(fat, end_fat);
+ got_one++;
}
/* write the FAT, flush the buffers */
***************
*** 153,156 ****
--- 164,171 ----
disk_flush();
close(fd);
+ if (got_one && missed_one)
+ exit(2);
+ if (missed_one)
+ exit(1);
exit(0);
}
*** old/mrd.c Mon Aug 17 17:40:39 1992
--- mrd.c Tue Aug 18 14:05:06 1992
***************
*** 28,32 ****
char *argv[];
{
! int i, ismatch, entry, oops, empty;
unsigned int start;
char *filename, *newfile, *get_name(), drive, *pathname, *get_path();
--- 28,32 ----
char *argv[];
{
! int i, ismatch, entry, oops, empty, got_one, missed_one;
unsigned int start;
char *filename, *newfile, *get_name(), drive, *pathname, *get_path();
***************
*** 45,48 ****
--- 45,50 ----
}
+ got_one = 0;
+ missed_one = 0;
last_drive = 'x';
mcwd = fix_mcwd();
***************
*** 59,62 ****
--- 61,65 ----
if (init(drive, 2)) {
fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
+ missed_one++;
continue;
}
***************
*** 66,71 ****
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname))
continue;
oops = 0;
--- 69,76 ----
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname)) {
! missed_one++;
continue;
+ }
oops = 0;
***************
*** 103,116 ****
dir_write(entry, dir);
ismatch = 1;
}
}
! if (fat_error)
break;
! if (oops)
continue;
! if (!ismatch)
fprintf(stderr, "%s: Directory \"%s\" not found\n", argv[0], filename);
}
/* write the FAT, flush the buffers */
--- 108,128 ----
dir_write(entry, dir);
ismatch = 1;
+ got_one++;
}
}
! if (fat_error) {
! missed_one++;
break;
+ }
! if (oops) {
! missed_one++;
continue;
+ }
! if (!ismatch) {
fprintf(stderr, "%s: Directory \"%s\" not found\n", argv[0], filename);
+ missed_one++;
+ }
}
/* write the FAT, flush the buffers */
***************
*** 119,122 ****
--- 131,138 ----
disk_flush();
close(fd);
+ if (got_one && missed_one)
+ exit(2);
+ if (missed_one)
+ exit(1);
exit(0);
}
*** old/mread.c Mon Aug 17 17:40:39 1992
--- mread.c Tue Aug 18 13:53:24 1992
***************
*** 43,46 ****
--- 43,47 ----
extern char *optarg;
int i, ismatch, entry, single, c, oops, preserve, nowarn, textmode;
+ int got_one, missed_one;
unsigned int fat;
long size, mtime;
***************
*** 57,60 ****
--- 58,63 ----
nowarn = 0;
textmode = 0;
+ got_one = 0;
+ missed_one = 0;
while ((c = getopt(argc, argv, "tnmv")) != EOF) {
switch (c) {
***************
*** 103,106 ****
--- 106,110 ----
if (init(drive, 0)) {
fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
+ missed_one++;
continue;
}
***************
*** 109,114 ****
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname))
continue;
ismatch = 0;
--- 113,120 ----
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname)) {
! missed_one++;
continue;
+ }
ismatch = 0;
***************
*** 139,142 ****
--- 145,149 ----
if (file_read(fp, fat, textmode, 0, size)) {
fclose(fp);
+ missed_one++;
break;
}
***************
*** 143,148 ****
fclose(fp);
set_mtime(target, mtime);
}
! ismatch = 1;
break;
}
--- 150,158 ----
fclose(fp);
set_mtime(target, mtime);
+ ismatch = 1;
+ got_one++;
}
! else
! missed_one++;
break;
}
***************
*** 172,175 ****
--- 182,186 ----
if (file_read(fp, fat, textmode, 0, size)) {
fclose(fp);
+ missed_one++;
break;
}
***************
*** 176,191 ****
fclose(fp);
set_mtime(tmp, mtime);
}
! ismatch = 1;
}
}
}
! if (fat_error)
break;
! if (!ismatch)
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
}
close(fd);
exit(0);
}
--- 187,213 ----
fclose(fp);
set_mtime(tmp, mtime);
+ ismatch = 1;
+ got_one++;
}
! else
! missed_one++;
}
}
}
! if (fat_error) {
! missed_one++;
break;
+ }
! if (!ismatch) {
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
+ missed_one++;
+ }
}
close(fd);
+ if (got_one && missed_one)
+ exit(2);
+ if (missed_one)
+ exit(1);
exit(0);
}
*** old/mtype.c Mon Aug 17 17:40:39 1992
--- mtype.c Tue Aug 18 14:08:20 1992
***************
*** 27,31 ****
extern int optind;
extern char *optarg;
! int i, ismatch, entry, c, oops, textmode, stripmode;
unsigned int fat;
long size;
--- 27,32 ----
extern int optind;
extern char *optarg;
! int i, ismatch, entry, c, oops, textmode, stripmode, got_one;
! int missed_one;
unsigned int fat;
long size;
***************
*** 39,42 ****
--- 40,45 ----
stripmode = 0;
textmode = 0;
+ got_one = 0;
+ missed_one = 0;
while ((c = getopt(argc, argv, "st")) != EOF) {
switch (c) {
***************
*** 66,69 ****
--- 69,73 ----
if (init(drive, 0)) {
fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
+ missed_one++;
continue;
}
***************
*** 72,77 ****
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname))
continue;
ismatch = 0;
--- 76,83 ----
filename = get_name(argv[i]);
pathname = get_path(argv[i]);
! if (subdir(drive, pathname)) {
! missed_one++;
continue;
+ }
ismatch = 0;
***************
*** 97,109 ****
break;
ismatch = 1;
}
}
! if (fat_error)
break;
! if (!ismatch)
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
}
close(fd);
exit(0);
}
--- 103,124 ----
break;
ismatch = 1;
+ got_one++;
}
}
! if (fat_error) {
! missed_one++;
break;
+ }
! if (!ismatch) {
fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
+ missed_one++;
+ }
}
close(fd);
+ if (got_one && missed_one)
+ exit(2);
+ if (missed_one)
+ exit(1);
exit(0);
}
*** old/mwrite.c Mon Aug 17 17:40:40 1992
--- mwrite.c Fri Aug 21 14:19:50 1992
***************
*** 37,41 ****
extern int optind;
extern char *optarg;
! int i, entry, ismatch, nogo, slot, single;
int c, oops, verbose, first, mod_time;
unsigned int dot, start;
--- 37,41 ----
extern int optind;
extern char *optarg;
! int i, entry, ismatch, nogo, slot, single, got_one, missed_one;
int c, oops, verbose, first, mod_time;
unsigned int dot, start;
***************
*** 54,57 ****
--- 54,59 ----
verbose = 0;
mod_time = 0;
+ got_one = 0;
+ missed_one = 0;
while ((c = getopt(argc, argv, "tnvm")) != EOF) {
switch (c) {
***************
*** 196,201 ****
break;
}
! if (fat_error)
break;
if (nogo) /* chickened out... */
--- 198,205 ----
break;
}
! if (fat_error) {
! missed_one++;
break;
+ }
if (nogo) /* chickened out... */
***************
*** 204,207 ****
--- 208,212 ----
if (dot == 0 && slot < 0) {
fprintf(stderr, "%s: No directory slots\n", argv[0]);
+ missed_one++;
break;
}
***************
*** 210,213 ****
--- 215,219 ----
if (dir_grow(dot)) {
fprintf(stderr, "%s: Disk full\n", argv[0]);
+ missed_one++;
break;
}
***************
*** 216,221 ****
}
/* write the file */
! if (dir = writeit(fixed, argv[i], verbose, mod_time, single, target))
dir_write(slot, dir);
if (full) {
--- 222,231 ----
}
/* write the file */
! if (dir = writeit(fixed, argv[i], verbose, mod_time, single, target)) {
dir_write(slot, dir);
+ got_one++;
+ }
+ else
+ missed_one++;
if (full) {
***************
*** 231,234 ****
--- 241,248 ----
disk_flush();
close(fd);
+ if (got_one && missed_one)
+ exit(2);
+ if (missed_one)
+ exit(1);
exit(0);
}
End of Patch
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads