home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sources / bugs / 222 < prev    next >
Encoding:
Text File  |  1992-08-22  |  52.1 KB  |  2,046 lines

  1. Newsgroups: comp.sources.bugs
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!osiris.cso.uiuc.edu!egray
  3. From: egray@osiris.cso.uiuc.edu (Emmet P. Gray)
  4. Subject: Patch #6 to Mtools v2.0
  5. Message-ID: <BtF49C.89q@news.cso.uiuc.edu>
  6. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  7. Organization: US Army Corps of Engineers - Construction Eng Research Lab
  8. Date: Sun, 23 Aug 1992 03:55:59 GMT
  9. Lines: 2035
  10.  
  11. This is patch #6 to the Mtools v2.0 distribution package.  This patch
  12. will add the following features:
  13.  
  14.     1) Mtools commands now use advisory locks to preclude two
  15.     processes from writing to the same DOS filesystem.  You must
  16.     edit the Makefile to choose one of the 3 lock methods:
  17.         -DLOCKF, -DFLOCK, or -DFCNTL.
  18.     See the Configure file for more details.
  19.  
  20.     2) An error detection routine has been added to determine if the
  21.     FAT encoding scheme in the devices.c file is correct.
  22.  
  23.     3) Mtools commands now return exit codes with the following
  24.     meaning:
  25.         0 = success
  26.         1 = utter failure
  27.         2 = partial sucess/failure.  (at least one successful
  28.             operation, but at least one failure)
  29.  
  30. It also corrects a bug when Mtools is used on machines that have 16 bit
  31. integers.  However, machines with 16 bit integers are limited to FAT
  32. tables that are less than 64k in length.
  33.  
  34. Mtools v2.0.5 was posted to the comp.sources.unix news group the 2nd week
  35. of January 92 as v25i097 thru v25i099.
  36.  
  37. The "always current" version of Mtools and all the patches are available
  38. via anonymous ftp from cerl.cecer.army.mil (129.229.1.101).  I've also
  39. placed the code in the /tmp/mtools directory on ftp.uu.net, but I can't
  40. say how long it will stay there.
  41.  
  42. Emmet P. Gray                US Army, HQ III Corps & Fort Hood
  43. ...!uunet!uiucuxc!fthood!egray        Attn: AFZF-DE-ENV
  44. fthood!egray@uxc.cso.uiuc.edu        Directorate of Engineering & Housing
  45.                     Environmental Management Office
  46.                     Fort Hood, TX 76544-5057
  47.  
  48. -------------------------------------------------------------------------------
  49. Prereq: "2.0.5"
  50. *** old/patchlevel.h    Mon Aug 17 17:40:40 1992
  51. --- patchlevel.h    Wed Aug 19 18:08:36 1992
  52. ***************
  53. *** 1,4 ****
  54. ! #define VERSION    "2.0.5"
  55. ! #define DATE    "25 Aug 91"
  56.   
  57.   /*
  58. --- 1,4 ----
  59. ! #define VERSION    "2.0.6"
  60. ! #define DATE    "21 Aug 92"
  61.   
  62.   /*
  63. ***************
  64. *** 16,18 ****
  65. --- 16,19 ----
  66.    *  patch #4        11 Apr 91
  67.    *  patch #5        25 Aug 91
  68. +  *  patch #6        21 Aug 92
  69.  
  70. *** old/Configure    Mon Aug 17 17:40:35 1992
  71. --- Configure    Sat Aug 22 13:48:45 1992
  72. ***************
  73. *** 25,32 ****
  74.   
  75.           BSD    for systems without System V style strings functions
  76. !              and System V style utime().
  77.   
  78. !         ISC    default devices for ISC's Unix V.
  79.   
  80.           UNIXPC    default devices for AT&T Unix PC 7300/3B1
  81.   
  82. --- 25,49 ----
  83.   
  84.           BSD    for systems without System V style strings functions
  85. !              or System V style utime().
  86.   
  87. !         INT16    Machines with 16 bit integers such as XENIX 286.
  88.   
  89. +     Pick one of the 3 following lock methods (if you have multiple
  90. +     methods at your disposal, pick one in the following order).  If
  91. +     a method is not chosen, record locking will not be performed.
  92. +         LOCKF    XENIX3 and SVR3.2 lock method
  93. +         FLOCK    Berkeley lock method
  94. +         FCNTL    Alternate Berkeley lock method (may not work
  95. +             on devices)
  96. +     The folowing are pre-proccessor variables for the default device
  97. +     setups for various flavors of Unix.  Pick one of the these, or
  98. +     create a new entry in the devices.c file.
  99. +         ISC    default devices for ISC's SVR3.2
  100.           UNIXPC    default devices for AT&T Unix PC 7300/3B1
  101.   
  102. ***************
  103. *** 33,36 ****
  104. --- 50,63 ----
  105.           SPARC    default devices for SunOS 4.1 on a SPARCstation
  106.   
  107. +         DELL    default devices for Dell's SVR4 and Merge
  108. +         XENIX    default devices for Xenix systems.
  109. +         SUN386    default devices for Sun's i386 machine
  110. +         RT_ACIS    default devices for IBM's BSD clone.        
  111. +         SPARC_ODD for reading odd-ball disks on a Sparc
  112. +         
  113.       There is a variable in msdos.h called SIG_TYPE which should be
  114.       configured to the "base" return type of signal();
  115. ***************
  116. *** 64,68 ****
  117.   
  118.       fat_bits The encoding scheme for the File Allocation Table.  Currently
  119. !         supports only 12 and 16 bit FATs.
  120.   
  121.       mode    any special open() mode flags (not normally used, except
  122. --- 91,96 ----
  123.   
  124.       fat_bits The encoding scheme for the File Allocation Table.  Currently
  125. !         supports only 12 and 16 bit FATs.  Hard disks usually use
  126. !         16 bit FATs, while all diskettes use 12 bit FATs.
  127.   
  128.       mode    any special open() mode flags (not normally used, except
  129. ***************
  130. *** 90,94 ****
  131.       safely ignored.
  132.   
  133. ! 4)  Examples devices
  134.   
  135.       for Interactive 386ix 2.0.2 with:
  136. --- 118,122 ----
  137.       safely ignored.
  138.   
  139. ! 4)  Some example devices
  140.   
  141.       for Interactive 386ix 2.0.2 with:
  142. ***************
  143. *** 115,119 ****
  144.   
  145.           {'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9},
  146. !         {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, (int (*)()) 0, 0, 0, 0}
  147.           {'\0', (char *) NULL, 0L, 0, 0, (int (*)()) 0, 0, 0, 0}
  148.   
  149. --- 143,147 ----
  150.   
  151.           {'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9},
  152. !         {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, (int (*)()) 0, 0, 0, 0},
  153.           {'\0', (char *) NULL, 0L, 0, 0, (int (*)()) 0, 0, 0, 0}
  154.   
  155. ***************
  156. *** 129,130 ****
  157. --- 157,171 ----
  158.           device, and that only the number of sectors are
  159.           different.
  160. +     for Dell's SVR4 with:
  161. +         5.25" 1.2m, 360k and 320k as a:
  162. +         3.5" 1.44m, 720k as b:
  163. +         dos partition as c:
  164. +         {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  165. +         {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  166. +         {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},
  167. +         {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  168. +         {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  169. +         {'C', "/dev/rdsk/dos", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  170. +         {'\0', (char *) NULL, 0L, 0, 0, (int (*)()) 0, 0, 0, 0}
  171. *** old/Makefile    Sat Aug 22 10:09:04 1992
  172. --- Makefile    Sat Aug 22 14:06:57 1992
  173. ***************
  174. *** 3,7 ****
  175.   #
  176.   # check the Configure file for some examples of device-specific setups
  177. ! # Berkeley flavors of Unix should include -DBSD in the CFLAGS
  178.   
  179.   CFLAGS    = -O
  180. --- 3,17 ----
  181.   #
  182.   # check the Configure file for some examples of device-specific setups
  183. ! # Berkeley flavors of Unix should include -DBSD in the CFLAGS.  Pick
  184. ! # a lock method... either -DLOCKF, -DFLOCK, or -DFCNTL and put that
  185. ! # string in the CFLAGS line below.
  186. ! # for Dell
  187. ! #CFLAGS    = -O -DDELL -DLOCKF
  188. ! # for Sparc
  189. ! #CFLAGS    = -O -DSPARC -DBSD -DFLOCK
  190. ! # for Xenix
  191. ! #CFLAGS = -O -M2e -DINT16 -DXENIX -DLOCKF
  192. ! #LDFLAGS = -s -M2e -i -f 5000
  193.   
  194.   CFLAGS    = -O
  195. *** old/Mattrib.1    Mon Aug 17 17:40:36 1992
  196. --- Mattrib.1    Sat Aug 22 14:13:13 1992
  197. ***************
  198. *** 43,48 ****
  199.   is more cunning.
  200.   .PP
  201. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  202. ! separator.  The use of the '\e\' separator or wildcards will require the
  203.   names to be enclosed in quotes to protect them from the shell.
  204.   .PP
  205. --- 43,48 ----
  206.   is more cunning.
  207.   .PP
  208. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  209. ! separator.  The use of the '\e' separator or wildcards will require the
  210.   names to be enclosed in quotes to protect them from the shell.
  211.   .PP
  212. ***************
  213. *** 51,56 ****
  214.   command may be used to establish the device and the current working
  215.   directory (relative to MSDOS), otherwise the default is A:/.
  216.   .SH SEE ALSO
  217.   mcd(1)
  218.   .SH BUGS
  219. ! Most versions of ATTRIB don't allow this many options.
  220. --- 51,59 ----
  221.   command may be used to establish the device and the current working
  222.   directory (relative to MSDOS), otherwise the default is A:/.
  223. + .PP
  224. + .I Mattrib
  225. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  226.   .SH SEE ALSO
  227.   mcd(1)
  228.   .SH BUGS
  229. ! Most MSDOS versions of ATTRIB don't allow this many options.
  230. *** old/Mcd.1    Mon Aug 17 17:40:36 1992
  231. --- Mcd.1    Sat Aug 22 14:13:19 1992
  232. ***************
  233. *** 18,28 ****
  234.   more than 6 hours old.
  235.   .PP
  236. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  237. ! separator.  The use of the '\e\' separator or wildcards will require the
  238.   directory name to be enclosed in quotes to protect it from the shell.
  239.   .SH SEE ALSO
  240.   mdir(1)
  241.   .SH BUGS
  242. ! MSDOS doesn't use CD to change to another device.
  243.   .PP
  244.   It may be wise to remove old .mcwd files at logout.
  245. --- 18,33 ----
  246.   more than 6 hours old.
  247.   .PP
  248. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  249. ! separator.  The use of the '\e' separator or wildcards will require the
  250.   directory name to be enclosed in quotes to protect it from the shell.
  251. + .PP
  252. + .I Mcd
  253. + returns 0 on success or 1 on failure.
  254.   .SH SEE ALSO
  255.   mdir(1)
  256.   .SH BUGS
  257. ! Unlike MSDOS versions of CD,
  258. ! .I mcd
  259. ! can be used to change to another device.
  260.   .PP
  261.   It may be wise to remove old .mcwd files at logout.
  262. *** old/Mcopy.1    Mon Aug 17 17:40:36 1992
  263. --- Mcopy.1    Sat Aug 22 14:13:24 1992
  264. ***************
  265. *** 48,53 ****
  266.   asks whether or not to overwrite the file.
  267.   .PP
  268. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  269. ! separator.  The use of the '\e\' separator or wildcards will require the
  270.   names to be enclosed in quotes to protect them from the shell.
  271.   .PP
  272. --- 48,53 ----
  273.   asks whether or not to overwrite the file.
  274.   .PP
  275. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  276. ! separator.  The use of the '\e' separator or wildcards will require the
  277.   names to be enclosed in quotes to protect them from the shell.
  278.   .PP
  279. ***************
  280. *** 56,59 ****
  281. --- 56,62 ----
  282.   command may be used to establish the device and the current working
  283.   directory (relative to MSDOS), otherwise the default is A:/.
  284. + .PP
  285. + .I Mcopy
  286. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  287.   .SH SEE ALSO
  288.   mcd(1), mread(1), mwrite(1)
  289. *** old/Mdel.1    Mon Aug 17 17:40:36 1992
  290. --- Mdel.1    Sat Aug 22 14:13:31 1992
  291. ***************
  292. *** 20,25 ****
  293.   will ask for verification prior to removing a read\-only file.
  294.   .PP
  295. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  296. ! separator.  The use of the '\e\' separator or wildcards will require the
  297.   names to be enclosed in quotes to protect them from the shell.
  298.   .PP
  299. --- 20,25 ----
  300.   will ask for verification prior to removing a read\-only file.
  301.   .PP
  302. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  303. ! separator.  The use of the '\e' separator or wildcards will require the
  304.   names to be enclosed in quotes to protect them from the shell.
  305.   .PP
  306. ***************
  307. *** 28,31 ****
  308. --- 28,34 ----
  309.   command may be used to establish the device and the current working
  310.   directory (relative to MSDOS), otherwise the default is A:/.
  311. + .PP
  312. + .I Mdel
  313. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  314.   .SH SEE ALSO
  315.   mcd(1)
  316. *** old/Mdir.1    Mon Aug 17 17:40:36 1992
  317. --- Mdir.1    Sat Aug 22 14:13:37 1992
  318. ***************
  319. *** 25,30 ****
  320.   An error occurs if a component of the path is not a directory.
  321.   .PP
  322. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  323. ! separator.  The use of the '\e\' separator or wildcards will require the
  324.   names to be enclosed in quotes to protect them from the shell.
  325.   .PP
  326. --- 25,30 ----
  327.   An error occurs if a component of the path is not a directory.
  328.   .PP
  329. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  330. ! separator.  The use of the '\e' separator or wildcards will require the
  331.   names to be enclosed in quotes to protect them from the shell.
  332.   .PP
  333. ***************
  334. *** 33,36 ****
  335. --- 33,39 ----
  336.   command may be used to establish the device and the current working
  337.   directory (relative to MSDOS), otherwise the default is A:/.
  338. + .PP
  339. + .I Mdir
  340. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  341.   .SH SEE ALSO
  342.   mcd(1)
  343. *** old/Mformat.1    Mon Aug 17 17:40:36 1992
  344. --- Mformat.1    Thu Aug 20 14:25:50 1992
  345. ***************
  346. *** 35,38 ****
  347. --- 35,41 ----
  348.   (at least) those command line parameters that are different from the
  349.   default.
  350. + .PP
  351. + .I Mformat
  352. + returns 0 on success or 1 on failure.
  353.   .SH SEE ALSO
  354.   mlabel(1)
  355. *** old/Mlabel.1    Mon Aug 17 17:40:37 1992
  356. --- Mlabel.1    Thu Aug 20 14:26:06 1992
  357. ***************
  358. *** 25,28 ****
  359. --- 25,31 ----
  360.   will change the label (and display the new label if the verbose mode is
  361.   set).
  362. + .PP
  363. + .I Mlabel
  364. + returns 0 on success or 1 on failure.
  365.   .SH SEE ALSO
  366.   mformat(1)
  367. *** old/Mmd.1    Mon Aug 17 17:40:37 1992
  368. --- Mmd.1    Sat Aug 22 14:13:48 1992
  369. ***************
  370. *** 26,31 ****
  371.   An error occurs if the directory already exists.
  372.   .PP
  373. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  374. ! separator.  The use of the '\e\' separator or wildcards will require the
  375.   directory name to be enclosed in quotes to protect it from the shell.
  376.   .PP
  377. --- 26,31 ----
  378.   An error occurs if the directory already exists.
  379.   .PP
  380. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  381. ! separator.  The use of the '\e' separator or wildcards will require the
  382.   directory name to be enclosed in quotes to protect it from the shell.
  383.   .PP
  384. ***************
  385. *** 34,37 ****
  386. --- 34,40 ----
  387.   command may be used to establish the device and the current working
  388.   directory (relative to MSDOS), otherwise the default is A:/.
  389. + .PP
  390. + .I Mmd
  391. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  392.   .SH SEE ALSO
  393.   mcd(1), mrd(1)
  394. *** old/Mrd.1    Mon Aug 17 17:40:37 1992
  395. --- Mrd.1    Sat Aug 22 14:13:53 1992
  396. ***************
  397. *** 11,16 ****
  398.   An error occurs if the directory is not empty.
  399.   .PP
  400. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  401. ! separator.  The use of the '\e\' separator or wildcards will require the
  402.   directory name to be enclosed in quotes to protect it from the shell.
  403.   .PP
  404. --- 11,16 ----
  405.   An error occurs if the directory is not empty.
  406.   .PP
  407. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  408. ! separator.  The use of the '\e' separator or wildcards will require the
  409.   directory name to be enclosed in quotes to protect it from the shell.
  410.   .PP
  411. ***************
  412. *** 19,22 ****
  413. --- 19,25 ----
  414.   command may be used to establish the device and the current working
  415.   directory (relative to MSDOS), otherwise the default is A:/.
  416. + .PP
  417. + .I Mrd
  418. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  419.   .SH SEE ALSO
  420.   mcd(1), mmd(1)
  421. *** old/Mread.1    Mon Aug 17 17:40:37 1992
  422. --- Mread.1    Sat Aug 22 14:14:00 1992
  423. ***************
  424. *** 40,45 ****
  425.   asks whether or not to overwrite the file.
  426.   .PP
  427. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  428. ! separator.  The use of the '\e\' separator or wildcards will require the
  429.   names to be enclosed in quotes to protect them from the shell.
  430.   .PP
  431. --- 40,45 ----
  432.   asks whether or not to overwrite the file.
  433.   .PP
  434. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  435. ! separator.  The use of the '\e' separator or wildcards will require the
  436.   names to be enclosed in quotes to protect them from the shell.
  437.   .PP
  438. ***************
  439. *** 48,51 ****
  440. --- 48,54 ----
  441.   command may be used to establish the device and the current working
  442.   directory (relative to MSDOS), otherwise the default is A:/.
  443. + .PP
  444. + .I Mread
  445. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  446.   .SH SEE ALSO
  447.   mcd(1), mcopy(1), mtype(1), mwrite(1)
  448. *** old/Mren.1    Mon Aug 17 17:40:37 1992
  449. --- Mren.1    Sat Aug 22 14:14:07 1992
  450. ***************
  451. *** 32,37 ****
  452.   may be used to rename directories.
  453.   .PP
  454. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  455. ! separator.  The use of the '\e\' separator or wildcards will require the
  456.   names to be enclosed in quotes to protect them from the shell.
  457.   .PP
  458. --- 32,37 ----
  459.   may be used to rename directories.
  460.   .PP
  461. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  462. ! separator.  The use of the '\e' separator or wildcards will require the
  463.   names to be enclosed in quotes to protect them from the shell.
  464.   .PP
  465. ***************
  466. *** 40,45 ****
  467.   command may be used to establish the device and the current working
  468.   directory (relative to MSDOS), otherwise the default is A:/.
  469.   .SH SEE ALSO
  470.   mcd(1)
  471.   .SH BUGS
  472. ! MSDOS can't use REN to rename directories.
  473. --- 40,50 ----
  474.   command may be used to establish the device and the current working
  475.   directory (relative to MSDOS), otherwise the default is A:/.
  476. + .PP
  477. + .I Mread
  478. + returns 0 on success or 1 on failure.
  479.   .SH SEE ALSO
  480.   mcd(1)
  481.   .SH BUGS
  482. ! Unlike the MSDOS version of REN,
  483. ! .I mren
  484. ! can be used to rename directories.
  485. *** old/Mtools.1    Mon Aug 17 17:40:37 1992
  486. --- Mtools.1    Sat Aug 22 14:14:12 1992
  487. ***************
  488. *** 26,30 ****
  489.   MSDOS filenames are optionally composed of a drive letter followed by a
  490.   colon, a subdirectory, and a filename.  Subdirectory names can use either
  491. ! the '/' or '\e\' separator.  The use of the '\e\' separator or wildcards
  492.   will require the names to be enclosed in quotes to protect them from the
  493.   shell.
  494. --- 26,30 ----
  495.   MSDOS filenames are optionally composed of a drive letter followed by a
  496.   colon, a subdirectory, and a filename.  Subdirectory names can use either
  497. ! the '/' or '\e' separator.  The use of the '\e' separator or wildcards
  498.   will require the names to be enclosed in quotes to protect them from the
  499.   shell.
  500. ***************
  501. *** 42,45 ****
  502. --- 42,48 ----
  503.   directory (relative to the MSDOS filesystem), otherwise the default is
  504.   assumed to be A:/.
  505. + .PP
  506. + All the Mtools commands return 0 on success, 1 on utter failure, or 2
  507. + on partial failure.
  508.   .SH SEE ALSO
  509.   mattrib(1), mcd(1), mdel(1), mformat(1), mrd(1), mren(1), mtype(1),
  510. *** old/Mtype.1    Mon Aug 17 17:40:37 1992
  511. --- Mtype.1    Sat Aug 22 14:14:17 1992
  512. ***************
  513. *** 24,29 ****
  514.   will strip the high bit from the data.
  515.   .PP
  516. ! MSDOS subdirectory names are supported with either the '/' or '\e\'
  517. ! separator.  The use of the '\e\' separator or wildcards will require the
  518.   names to be enclosed in quotes to protect them from the shell.
  519.   .PP
  520. --- 24,29 ----
  521.   will strip the high bit from the data.
  522.   .PP
  523. ! MSDOS subdirectory names are supported with either the '/' or '\e'
  524. ! separator.  The use of the '\e' separator or wildcards will require the
  525.   names to be enclosed in quotes to protect them from the shell.
  526.   .PP
  527. ***************
  528. *** 32,35 ****
  529. --- 32,38 ----
  530.   command may be used to establish the device and the current working
  531.   directory (relative to MSDOS), otherwise the default is A:/.
  532. + .PP
  533. + .I Mtype
  534. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  535.   .SH SEE ALSO
  536.   mcd(1), mread(1)
  537. *** old/Mwrite.1    Mon Aug 17 17:40:37 1992
  538. --- Mwrite.1    Sat Aug 22 14:14:23 1992
  539. ***************
  540. *** 50,55 ****
  541.   set).
  542.   .PP
  543. ! MSDOS subdirectory names are are supported with either the '/' or '\e\'
  544. ! separator.  The use of the '\e\' separator or wildcards will require the
  545.   names to be enclosed in quotes to protect them from the shell.
  546.   .PP
  547. --- 50,55 ----
  548.   set).
  549.   .PP
  550. ! MSDOS subdirectory names are are supported with either the '/' or '\e'
  551. ! separator.  The use of the '\e' separator or wildcards will require the
  552.   names to be enclosed in quotes to protect them from the shell.
  553.   .PP
  554. ***************
  555. *** 58,61 ****
  556. --- 58,64 ----
  557.   command may be used to establish the device and the current working
  558.   directory (relative to MSDOS), otherwise the default is A:/.
  559. + .PP
  560. + .I Mwrite
  561. + returns 0 on success, 1 on utter failure, or 2 on partial failure.
  562.   .SH SEE ALSO
  563.   mcd(1), mcopy(1), mread(1)
  564. *** old/Readme    Mon Aug 17 17:40:37 1992
  565. --- Readme    Fri Aug 21 12:09:28 1992
  566. ***************
  567. *** 62,65 ****
  568. --- 62,68 ----
  569.   Mcopy is really a front-end to the low level Mread and Mwrite commands.
  570.   
  571. + Please *DO* read the Configure file and the Release.notes (that's why 
  572. + they're there...).
  573.   Emmet P. Gray                US Army, HQ III Corps & Fort Hood
  574.   ...!uunet!uiucuxc!fthood!egray        Attn: AFZF-DE-ENV
  575. *** old/Release.notes    Mon Aug 17 17:40:38 1992
  576. --- Release.notes    Sat Aug 22 13:31:07 1992
  577. ***************
  578. *** 1,2 ****
  579. --- 1,70 ----
  580. + Patch #6, 21 Aug 92
  581. + This patch will add the following features:
  582. +     1) Mtools commands now use advisory locks to preclude two
  583. +     processes from writing to the same DOS filesystem.  You must
  584. +     edit the Makefile to choose one of the 3 lock methods:
  585. +         -DLOCKF, -DFLOCK, or -DFCNTL.
  586. +     See the Configure file for more details.
  587. +     2) An error detection routine has been added to determine if the
  588. +     FAT encoding scheme in the devices.c file is correct.
  589. +     3) Mtools commands now return exit codes with the following
  590. +     meaning:
  591. +         0 = success
  592. +         1 = utter failure
  593. +         2 = partial sucess/failure.  (at least one successful
  594. +             operation, but at least one failure)
  595. + It also corrects a bug when Mtools is used on machines that have 16 bit
  596. + integers.  However, machines with 16 bit integers are limited to FAT
  597. + tables that are less than 64k in length.
  598. + -------------------------------------------------------------------------------
  599. + Patch #5, 25 Aug 91
  600. + This patch will add a few new features:
  601. +     1) Mtools will now work properly on MSDOS partitions that are
  602. +     greater than 32M.
  603. +     2) If the "current working directory" information (contained in
  604. +     the $HOME/.mcwd file) is more than 6 hours old, Mtools will
  605. +     issue a warning and ignore the old information.
  606. +     3) The mcopy command will now copy files between 2 MSDOS file
  607. +     systems (such as mcopy "a:*" b:).
  608. + -------------------------------------------------------------------------------
  609. + Patch #4, 11 Apr 91
  610. +     This patch will fix a bug in the mmd command where directories
  611. +     inherited the file name extension of the parent directory.  It
  612. +     also adds a feature that will allow the copying of zero length
  613. +     files.
  614. + -------------------------------------------------------------------------------
  615. + Patch #3, 28 Nov 90
  616. +     This patch will fix a bug where Mtools sometimes bypasses the
  617. +     disk "cache" and reads/writes to the disk directly.
  618. + -------------------------------------------------------------------------------
  619. + Patch #2, 21 Nov 90
  620. +     This patch will fix a bug in the folding of MSDOS filenames to
  621. +     lower case, and will fix a bug that could prevent the detection
  622. +     of a full disk.
  623. + -------------------------------------------------------------------------------
  624. + Patch #1, 12 Oct 90
  625. +     This patch will fix a few problems on Berkekely flavors of Unix,
  626. +     and will fix the floating point exception bug when Mtools is
  627. +     used with diskettes that have been formatted under very old DOS
  628. +     (or formatted by some other non-DOS system).
  629. + -------------------------------------------------------------------------------
  630.   New in the v2.0 release....
  631.   
  632. *** old/buf_write.c    Mon Aug 17 17:40:38 1992
  633. --- buf_write.c    Mon Aug 17 17:37:34 1992
  634. ***************
  635. *** 11,15 ****
  636.   extern long disk_offset, disk_current;
  637.   extern unsigned char *disk_buf;
  638. ! static int blank_cyl();
  639.   
  640.   void
  641. --- 11,15 ----
  642.   extern long disk_offset, disk_current;
  643.   extern unsigned char *disk_buf;
  644. ! static int read_cyl();
  645.   
  646.   void
  647. ***************
  648. *** 49,52 ****
  649. --- 49,53 ----
  650.                   disk_flush();
  651.   
  652. +             disk_current = (i / disk_size) * disk_size;
  653.               /*
  654.                * If there is something on the new cylinder that
  655. ***************
  656. *** 54,61 ****
  657.                * before writing.
  658.                */
  659. !             if (blank_cyl(i))
  660. !                 disk_current = (i / disk_size) * disk_size;
  661. !             else {
  662. !                 disk_current = (i / disk_size) * disk_size;
  663.                   where = (disk_current * MSECTOR_SIZE) + disk_offset;
  664.                   length = disk_size * MSECTOR_SIZE;
  665. --- 55,59 ----
  666.                * before writing.
  667.                */
  668. !             if (read_cyl(disk_current)) {
  669.                   where = (disk_current * MSECTOR_SIZE) + disk_offset;
  670.                   length = disk_size * MSECTOR_SIZE;
  671. ***************
  672. *** 114,131 ****
  673.   /*
  674.    * Determine if the cylinder has some useful information on it.  Returns a 1
  675. !  * if it is blank.
  676.    */
  677.   
  678.   static int
  679. ! blank_cyl(num)
  680. ! long num;
  681.   {
  682.       register unsigned int i;
  683.       unsigned int start, end, fat_decode();
  684. -     long sector;
  685.   
  686. -     sector = (num / disk_size) * disk_size;
  687.       if (!sector)
  688. !         return(0);
  689.   
  690.       start = ((sector - dir_start - dir_len) / clus_size) + 2;
  691. --- 112,127 ----
  692.   /*
  693.    * Determine if the cylinder has some useful information on it.  Returns a 1
  694. !  * if it needs to be read.
  695.    */
  696.   
  697.   static int
  698. ! read_cyl(sector)
  699. ! long sector;
  700.   {
  701.       register unsigned int i;
  702.       unsigned int start, end, fat_decode();
  703.   
  704.       if (!sector)
  705. !         return(1);
  706.   
  707.       start = ((sector - dir_start - dir_len) / clus_size) + 2;
  708. ***************
  709. *** 135,140 ****
  710.                       /* if fat_decode returns non-zero */
  711.           if (fat_decode(i))
  712. !             return(0);
  713.       }
  714. !     return(1);
  715.   }
  716. --- 131,136 ----
  717.                       /* if fat_decode returns non-zero */
  718.           if (fat_decode(i))
  719. !             return(1);
  720.       }
  721. !     return(0);
  722.   }
  723. *** old/devices.c    Sat Aug 22 10:08:38 1992
  724. --- devices.c    Sat Aug 22 13:55:13 1992
  725. ***************
  726. *** 32,42 ****
  727.   #endif /* ISC */
  728.   
  729. - #ifdef MASSCOMP
  730. - struct device devices[] = {
  731. -     {'A', "/dev/rflp", 0L, 12, 0, (int (*) ()) 0, 80, 2, 8},
  732. -     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  733. - };
  734. - #endif /* MASSCOMP */
  735.   #ifdef SPARC
  736.   struct device devices[] = {
  737. --- 32,35 ----
  738. ***************
  739. *** 86,87 ****
  740. --- 79,167 ----
  741.   }
  742.   #endif /* UNIXPC */
  743. + #ifdef RT_ACIS
  744. + struct device devices[] = {
  745. +     {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  746. +     {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  747. +     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  748. + };
  749. + #endif /* RT_ACIS */
  750. + #ifdef SUN386
  751. + struct device devices[] = {
  752. +     {'A', "/dev/rfdl0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  753. +     {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  754. +     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  755. + };
  756. + #endif /* SUN386 */
  757. +   
  758. + #ifdef SPARC_ODD
  759. + #include <sys/types.h>
  760. + #include <sun/dkio.h>
  761. + #include <fcntl.h>
  762. + int init_sparc();
  763. + struct device devices[] = {
  764. +     {'A', "/dev/rfd0c", 0L, 12, 0, init_sparc, 80, 2, 0},
  765. +     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  766. + };
  767. + /*
  768. +  * Stuffing back the floppy parameters into the driver allows for gems
  769. +  * like 10 sector or single sided floppies from Atari ST systems.
  770. +  * 
  771. +  * Martin Schulz, Universite de Moncton, N.B., Canada, March 11, 1991.
  772. +  */
  773. + int
  774. + init_sparc(fd, ntracks, nheads, nsect)
  775. + int fd, ntracks, nheads, nsect;
  776. + {
  777. +     struct fdk_char dkbuf;
  778. +     struct dk_map   dkmap;
  779. +     if (ioctl(fd, FDKIOGCHAR, &dkbuf) != 0) {
  780. +         ioctl(fd, FDKEJECT, NULL);
  781. +         return(1);
  782. +     }
  783. +     if (ioctl(fd, DKIOCGPART, &dkmap) != 0) {
  784. +         ioctl(fd, FDKEJECT, NULL);
  785. +         return(1);
  786. +     }
  787. +     if (ntracks && nheads)
  788. +         dkbuf.ncyl = ntracks * nheads;
  789. +     if (nheads)
  790. +         dkbuf.nhead = nheads;
  791. +     if (nsect)
  792. +         dkbuf.secptrack = nsect;
  793. +     if (ntracks && nheads && nsect )
  794. +         dkmap.dkl_nblk = ntracks * nheads * nsect;
  795. +     if (ioctl(fd, FDKIOSCHAR, &dkbuf) != 0) {
  796. +         ioctl(fd, FDKEJECT, NULL);
  797. +         return(1);
  798. +     }
  799. +     if (ioctl(fd, DKIOCSPART, &dkmap) != 0) {
  800. +         ioctl(fd, FDKEJECT, NULL);
  801. +         return(1);
  802. +     }
  803. +     return(0);
  804. + }
  805. + #endif /* SPARC_ODD */
  806. +   
  807. + #ifdef XENIX
  808. + struct device devices[] = {
  809. +     {'A', "/dev/fd096ds15", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  810. +     {'A', "/dev/fd048ds9", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  811. +     {'B', "/dev/fd1135ds18", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  812. +     {'B', "/dev/fd1135ds9", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  813. +     {'C', "/dev/hd0d", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  814. +     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  815. + };
  816. + #endif /* XENIX */
  817. *** old/dir_make.c    Mon Aug 17 17:40:38 1992
  818. --- dir_make.c    Sun Sep 22 10:52:04 1991
  819. ***************
  820. *** 63,67 ****
  821.       dir_buf = (unsigned char *) realloc((char *) dir_buf, (unsigned int) new * MSECTOR_SIZE);
  822.       if (dir_buf == NULL) {
  823. !         perror("dir_grow: malloc");
  824.           exit(1);
  825.       }
  826. --- 63,67 ----
  827.       dir_buf = (unsigned char *) realloc((char *) dir_buf, (unsigned int) new * MSECTOR_SIZE);
  828.       if (dir_buf == NULL) {
  829. !         perror("dir_grow: realloc");
  830.           exit(1);
  831.       }
  832. *** old/dir_read.c    Mon Aug 17 17:40:38 1992
  833. --- dir_read.c    Sun Sep 22 11:08:00 1991
  834. ***************
  835. *** 38,43 ****
  836.       unsigned int next, fat_decode();
  837.       unsigned char *offset;
  838. !     char *malloc();
  839. !     void free(), perror(), exit(), disk_read(), dir_flush();
  840.   
  841.       length = 0;
  842. --- 38,43 ----
  843.       unsigned int next, fat_decode();
  844.       unsigned char *offset;
  845. !     char *realloc();
  846. !     void perror(), exit(), disk_read(), dir_flush();
  847.   
  848.       length = 0;
  849. ***************
  850. *** 71,78 ****
  851.           dir_flush();
  852.                       /* fill the dir_buf */
  853. !     free((char *) dir_buf);
  854. !     dir_buf = (unsigned char *) malloc((unsigned int) length * MSECTOR_SIZE);
  855.       if (dir_buf == NULL) {
  856. !         perror("fill_chain: malloc");
  857.           exit(1);
  858.       }
  859. --- 71,77 ----
  860.           dir_flush();
  861.                       /* fill the dir_buf */
  862. !     dir_buf = (unsigned char *) realloc(dir_buf, (unsigned int) length * MSECTOR_SIZE);
  863.       if (dir_buf == NULL) {
  864. !         perror("fill_chain: realloc");
  865.           exit(1);
  866.       }
  867. ***************
  868. *** 96,101 ****
  869.   {
  870.       register int i;
  871. !     char *malloc();
  872. !     void free(), disk_read(), dir_flush(), exit(), perror();
  873.   
  874.       if (dir_dirty)
  875. --- 95,100 ----
  876.   {
  877.       register int i;
  878. !     char *malloc(), *realloc();
  879. !     void disk_read(), dir_flush(), exit(), perror();
  880.   
  881.       if (dir_dirty)
  882. ***************
  883. *** 106,112 ****
  884.   
  885.       if (code == OLD)
  886. !         free((char *) dir_buf);
  887. !     dir_buf = (unsigned char *) malloc((unsigned int) dir_len * MSECTOR_SIZE);
  888.       if (dir_buf == NULL) {
  889.           perror("reset_chain: malloc");
  890. --- 105,111 ----
  891.   
  892.       if (code == OLD)
  893. !         dir_buf = (unsigned char *) realloc(dir_buf, (unsigned int) dir_len * MSECTOR_SIZE);
  894. !     else
  895. !         dir_buf = (unsigned char *) malloc((unsigned int) dir_len * MSECTOR_SIZE);
  896.       if (dir_buf == NULL) {
  897.           perror("reset_chain: malloc");
  898. *** old/fat_read.c    Mon Aug 17 17:40:38 1992
  899. --- fat_read.c    Sat Aug 22 13:46:35 1992
  900. ***************
  901. *** 18,23 ****
  902.   unsigned int num;
  903.   {
  904. !     unsigned int fat, fat_hi, fat_low, byte_1, byte_2;
  905. !     int start;
  906.   
  907.       if (fat_bits == 12) {
  908. --- 18,22 ----
  909.   unsigned int num;
  910.   {
  911. !     unsigned int fat, fat_hi, fat_low, byte_1, byte_2, start;
  912.   
  913.       if (fat_bits == 12) {
  914. ***************
  915. *** 70,74 ****
  916.   
  917.   /*
  918. !  * Read the entire FAT table into memory.
  919.    */
  920.   
  921. --- 69,74 ----
  922.   
  923.   /*
  924. !  * Read the entire FAT table into memory.  Crude error detection on wrong
  925. !  * FAT encoding scheme.
  926.    */
  927.   
  928. ***************
  929. *** 77,86 ****
  930.   int start;
  931.   {
  932. !     int buflen;
  933.       char *malloc();
  934.       void perror(), exit(), disk_read();
  935.                       /* only the first copy of the FAT */
  936.       buflen = fat_len * MSECTOR_SIZE;
  937. !     fat_buf = (unsigned char *) malloc((unsigned int) buflen);
  938.       if (fat_buf == NULL) {
  939.           perror("fat_read: malloc");
  940. --- 77,97 ----
  941.   int start;
  942.   {
  943. !     int i;
  944. !     unsigned int buflen;
  945.       char *malloc();
  946.       void perror(), exit(), disk_read();
  947. + #ifdef INT16
  948. +     long junk;
  949. +     junk = (long) fat_len * MSECTOR_SIZE;
  950. +     
  951. +     if (junk > 65535L) {
  952. +         fprintf(stderr, "fat_read: FAT table is too large\n");
  953. +         exit(1);
  954. +     }
  955. + #endif /* INT16 */
  956.                       /* only the first copy of the FAT */
  957.       buflen = fat_len * MSECTOR_SIZE;
  958. !     fat_buf = (unsigned char *) malloc(buflen);
  959.       if (fat_buf == NULL) {
  960.           perror("fat_read: malloc");
  961. ***************
  962. *** 88,92 ****
  963.       }
  964.                       /* read the FAT sectors */
  965. !     disk_read((long) start, fat_buf, buflen);
  966.   
  967.                       /* the encoding scheme */
  968. --- 99,104 ----
  969.       }
  970.                       /* read the FAT sectors */
  971. !     for (i=start; i<start+fat_len; i++)
  972. !         disk_read((long) i, &fat_buf[(i-start)*MSECTOR_SIZE], MSECTOR_SIZE);
  973.   
  974.                       /* the encoding scheme */
  975. ***************
  976. *** 94,97 ****
  977. --- 106,113 ----
  978.           end_fat = 0xfff;
  979.           last_fat = 0xff8;
  980. +         if (fat_buf[3] == 0xff) {
  981. +             fprintf(stderr, "fat_read: wrong FAT encoding\n");
  982. +             exit(1);
  983. +         }
  984.       }
  985.       else {
  986. ***************
  987. *** 98,101 ****
  988. --- 114,121 ----
  989.           end_fat = 0xffff;
  990.           last_fat = 0xfff8;
  991. +         if (fat_buf[3] != 0xff) {
  992. +             fprintf(stderr, "fat_read: wrong FAT encoding\n");
  993. +             exit(1);
  994. +         }
  995.       }
  996.       return;
  997. *** old/fat_write.c    Mon Aug 17 17:40:38 1992
  998. --- fat_write.c    Sat Aug 22 13:17:03 1992
  999. ***************
  1000. *** 15,19 ****
  1001.   unsigned int code;
  1002.   {
  1003. !     int start;
  1004.   
  1005.       if (fat_bits == 12) {
  1006. --- 15,19 ----
  1007.   unsigned int code;
  1008.   {
  1009. !     unsigned int start;
  1010.   
  1011.       if (fat_bits == 12) {
  1012. ***************
  1013. *** 71,75 ****
  1014.   fat_write()
  1015.   {
  1016. !     int fat_start, buflen, dups;
  1017.       void disk_write();
  1018.   
  1019. --- 71,75 ----
  1020.   fat_write()
  1021.   {
  1022. !     int i, start, dups;
  1023.       void disk_write();
  1024.   
  1025. ***************
  1026. *** 77,84 ****
  1027.           return;
  1028.   
  1029. !     fat_start = dir_start - (fat_len * num_fat);
  1030. !     buflen = fat_len * MSECTOR_SIZE;
  1031.   
  1032. !     disk_write((long) fat_start, fat_buf, buflen);
  1033.   
  1034.       /*
  1035. --- 77,84 ----
  1036.           return;
  1037.   
  1038. !     start = dir_start - (fat_len * num_fat);
  1039.   
  1040. !     for (i=start; i<start+fat_len; i++)
  1041. !         disk_write((long) i, &fat_buf[(i-start)*MSECTOR_SIZE], MSECTOR_SIZE);
  1042.   
  1043.       /*
  1044. ***************
  1045. *** 88,93 ****
  1046.           dups = num_fat - 1;
  1047.           while (dups--) {
  1048. !             fat_start += fat_len;
  1049. !             disk_write((long) fat_start, fat_buf, buflen);
  1050.           }
  1051.       }
  1052. --- 88,94 ----
  1053.           dups = num_fat - 1;
  1054.           while (dups--) {
  1055. !             start += fat_len;
  1056. !             for (i=start; i<start+fat_len; i++)
  1057. !                 disk_write((long) i, &fat_buf[(i-start)*MSECTOR_SIZE], MSECTOR_SIZE);
  1058.           }
  1059.       }
  1060. *** old/file_read.c    Mon Aug 17 17:40:38 1992
  1061. --- file_read.c    Sun Sep 22 10:04:24 1991
  1062. ***************
  1063. *** 52,56 ****
  1064.                       /* write it */
  1065.               if (fwrite((char *) out_buf, sizeof(*out_buf), out_len, fp) == 0) {
  1066. !                 perror("file_write: fwrite");
  1067.                   return(-1);
  1068.               }
  1069. --- 52,56 ----
  1070.                       /* write it */
  1071.               if (fwrite((char *) out_buf, sizeof(*out_buf), out_len, fp) == 0) {
  1072. !                 perror("file_read: fwrite");
  1073.                   return(-1);
  1074.               }
  1075. ***************
  1076. *** 60,64 ****
  1077.               out_len = (size - current > in_len) ? in_len : size - current;
  1078.               if (fwrite((char *) in_buf, sizeof(*in_buf), out_len, fp) == 0) {
  1079. !                 perror("file_write: fwrite");
  1080.                   return(-1);
  1081.               }
  1082. --- 60,64 ----
  1083.               out_len = (size - current > in_len) ? in_len : size - current;
  1084.               if (fwrite((char *) in_buf, sizeof(*in_buf), out_len, fp) == 0) {
  1085. !                 perror("file_read: fwrite");
  1086.                   return(-1);
  1087.               }
  1088. *** old/file_write.c    Mon Aug 17 17:40:38 1992
  1089. --- file_write.c    Sun Sep 22 10:04:36 1991
  1090. ***************
  1091. *** 111,115 ****
  1092.       else {
  1093.           if ((i = fread((char *) tbuf, sizeof(*tbuf), buflen, fp)) <= 0) {
  1094. !             perror("putcluster: fread");
  1095.               return(-1);
  1096.           }
  1097. --- 111,115 ----
  1098.       else {
  1099.           if ((i = fread((char *) tbuf, sizeof(*tbuf), buflen, fp)) <= 0) {
  1100. !             perror("put_cluster: fread");
  1101.               return(-1);
  1102.           }
  1103. *** old/init.c    Mon Aug 17 17:40:38 1992
  1104. --- init.c    Fri Aug 21 13:20:30 1992
  1105. ***************
  1106. *** 34,38 ****
  1107.   {
  1108.       int fat_start, tracks, heads, sectors, old_dos;
  1109. !     char *malloc(), *name, *expand();
  1110.       void perror(), exit(), reset_chain(), free(), fat_read();
  1111.       struct bootsector *boot;
  1112. --- 34,38 ----
  1113.   {
  1114.       int fat_start, tracks, heads, sectors, old_dos;
  1115. !     char buf[256], *malloc(), *name, *expand();
  1116.       void perror(), exit(), reset_chain(), free(), fat_read();
  1117.       struct bootsector *boot;
  1118. ***************
  1119. *** 63,69 ****
  1120.           name = expand(dev->name);
  1121.           if ((fd = open(name, mode | dev->mode)) < 0) {
  1122. !             perror("init: open");
  1123.               exit(1);
  1124.           }
  1125.                       /* set default parameters, if needed */
  1126.           if (dev->gioctl) {
  1127. --- 63,75 ----
  1128.           name = expand(dev->name);
  1129.           if ((fd = open(name, mode | dev->mode)) < 0) {
  1130. !             sprintf(buf, "init: open \"%s\"", name);
  1131. !             perror(buf);
  1132.               exit(1);
  1133.           }
  1134. +                     /* lock the device on writes */
  1135. +         if (mode == 2 && lock_dev(fd)) {
  1136. +             fprintf(stderr, "Device \"%s\" is busy\n", dev->name);
  1137. +             exit(1);
  1138. +         }
  1139.                       /* set default parameters, if needed */
  1140.           if (dev->gioctl) {
  1141. ***************
  1142. *** 210,220 ****
  1143.   #endif /* FULL_CYL */
  1144.   
  1145. - /*
  1146. -  * The driver in Dell's SVR4 v2.01 is unreliable with large writes.
  1147. -  */
  1148. - #ifdef DELL
  1149. -     disk_size = 1;
  1150. - #endif /* DELL */
  1151.       disk_buf = (unsigned char *) malloc((unsigned int) disk_size * MSECTOR_SIZE);
  1152.       if (disk_buf == NULL) {
  1153. --- 216,219 ----
  1154. ***************
  1155. *** 323,325 ****
  1156. --- 322,363 ----
  1157.   
  1158.       return(&boot);
  1159. + }
  1160. + /*
  1161. +  * Create an advisory lock on the device to prevent concurrent writes.
  1162. +  * Uses either lockf, flock, or fcntl locking methods.  See the Makefile
  1163. +  * and the Configure files for how to specify the proper method.
  1164. +  */
  1165. + static int
  1166. + lock_dev(fd)
  1167. + int fd;
  1168. + {
  1169. + #ifdef LOCKF
  1170. + #include <unistd.h>
  1171. +     if (lockf(fd, F_TLOCK, 0) < 0)
  1172. +         return(1);
  1173. + #endif /* LOCKF */
  1174. + #ifdef FLOCK
  1175. + #include <sys/file.h>
  1176. +     if (flock(fd, LOCK_EX|LOCK_NB) < 0)
  1177. +         return(1);
  1178. + #endif /* FLOCK */
  1179. + #ifdef FCNTL
  1180. + #include <fcntl.h>
  1181. +     struct flock flk;
  1182. +     flk.l_type = F_WRLCK;
  1183. +     flk.l_whence = 0;
  1184. +     flk.l_start = 0L;
  1185. +     flk.l_len = 0L;
  1186. +     if (fcntl(fd, F_SETLK, &flk) < 0)
  1187. +         return(1);
  1188. + #endif /* FCNTL */
  1189. +     return(0);
  1190.   }
  1191. *** old/mattrib.c    Mon Aug 17 17:40:39 1992
  1192. --- mattrib.c    Wed Aug 19 12:22:42 1992
  1193. ***************
  1194. *** 30,34 ****
  1195.   {
  1196.       int entry, ismatch, oops, fargn, read_only, hidden, sys, archive;
  1197. !     int i, action;
  1198.       char *filename, *newfile, *unix_name(), drive, get_drive();
  1199.       char *get_path(), *pathname, *get_name(), *fix_mcwd(), last_drive;
  1200. --- 30,34 ----
  1201.   {
  1202.       int entry, ismatch, oops, fargn, read_only, hidden, sys, archive;
  1203. !     int i, action, got_one, missed_one;
  1204.       char *filename, *newfile, *unix_name(), drive, get_drive();
  1205.       char *get_path(), *pathname, *get_name(), *fix_mcwd(), last_drive;
  1206. ***************
  1207. *** 38,41 ****
  1208. --- 38,43 ----
  1209.       oops = 0;
  1210.       fargn = -1;
  1211. +     got_one = 0;
  1212. +     missed_one = 0;
  1213.       archive = LEAVE;
  1214.       hidden = LEAVE;
  1215. ***************
  1216. *** 95,98 ****
  1217. --- 97,101 ----
  1218.               if (init(drive, 2)) {
  1219.                   fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
  1220. +                 missed_one++;
  1221.                   continue;
  1222.               }
  1223. ***************
  1224. *** 101,106 ****
  1225.           filename = get_name(argv[i]);
  1226.           pathname = get_path(argv[i]);
  1227. !         if (subdir(drive, pathname))
  1228.               continue;
  1229.   
  1230.                       /* see if exists and do it */
  1231. --- 104,111 ----
  1232.           filename = get_name(argv[i]);
  1233.           pathname = get_path(argv[i]);
  1234. !         if (subdir(drive, pathname)) {
  1235. !             missed_one++;
  1236.               continue;
  1237. +         }
  1238.   
  1239.                       /* see if exists and do it */
  1240. ***************
  1241. *** 140,147 ****
  1242.                   dir_write(entry, dir);
  1243.                   ismatch++;
  1244.               }
  1245.           }
  1246. !         if (!ismatch)
  1247.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1248.       }
  1249.       dir_flush();
  1250. --- 145,155 ----
  1251.                   dir_write(entry, dir);
  1252.                   ismatch++;
  1253. +                 got_one++;
  1254.               }
  1255.           }
  1256. !         if (!ismatch) {
  1257.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1258. +             missed_one++;
  1259. +         }
  1260.       }
  1261.       dir_flush();
  1262. ***************
  1263. *** 148,151 ****
  1264. --- 156,163 ----
  1265.       disk_flush();
  1266.       close(fd);
  1267. +     if (got_one && missed_one)
  1268. +         exit(2);
  1269. +     if (missed_one)
  1270. +         exit(1);
  1271.       exit(0);
  1272.   }
  1273. *** old/mcopy.c    Mon Aug 17 17:40:39 1992
  1274. --- mcopy.c    Fri Aug 21 13:35:22 1992
  1275. ***************
  1276. *** 11,14 ****
  1277. --- 11,16 ----
  1278.   #include <stdio.h>
  1279.   #include <ctype.h>
  1280. + #include <sys/types.h>
  1281. + #include <sys/wait.h>
  1282.   #include "patchlevel.h"
  1283.   
  1284. ***************
  1285. *** 18,21 ****
  1286. --- 20,27 ----
  1287.   #define MKDIR
  1288.   
  1289. + #ifndef WEXITSTATUS
  1290. + #define WEXITSTATUS(x) (((x)>>8)&0xff)
  1291. + #endif /* WEXITSTATUS */
  1292.   main(argc, argv)
  1293.   int argc;
  1294. ***************
  1295. *** 25,29 ****
  1296.       extern char *optarg;
  1297.       int i, oops, msdos_args, unix_args, destination;
  1298. !     char **nargv, **malloc();
  1299.       void exit();
  1300.                       /* get command line options */
  1301. --- 31,35 ----
  1302.       extern char *optarg;
  1303.       int i, oops, msdos_args, unix_args, destination;
  1304. !     char **nargv, *malloc();
  1305.       void exit();
  1306.                       /* get command line options */
  1307. ***************
  1308. *** 93,98 ****
  1309.   {
  1310.       extern int optind;
  1311. !     int i, j, pid, status;
  1312. !     char *tmpdir, *mktemp(), **nargv, **malloc(), buf[256], *strcpy();
  1313.       char *unixname(), *realloc();
  1314.       void exit();
  1315. --- 99,104 ----
  1316.   {
  1317.       extern int optind;
  1318. !     int i, j, pid, status_read, status_write;
  1319. !     char *tmpdir, *mktemp(), **nargv, *malloc(), buf[256], *strcpy();
  1320.       char *unixname(), *realloc();
  1321.       void exit();
  1322. ***************
  1323. *** 109,114 ****
  1324.                       /* create a temp directory */
  1325.       tmpdir = mktemp("/tmp/mtoolsXXXXXX");
  1326. !     if (mkdir(tmpdir, 0777) < 0)
  1327.           perror("mkdir");
  1328.   
  1329.       nargv[j++] = tmpdir;
  1330. --- 115,122 ----
  1331.                       /* create a temp directory */
  1332.       tmpdir = mktemp("/tmp/mtoolsXXXXXX");
  1333. !     if (mkdir(tmpdir, 0777) < 0) {
  1334.           perror("mkdir");
  1335. +         exit(1);
  1336. +     }
  1337.   
  1338.       nargv[j++] = tmpdir;
  1339. ***************
  1340. *** 119,124 ****
  1341.           execvp("mread", nargv);
  1342.   
  1343. !     while (wait(&status) != pid)
  1344.           ;
  1345.                       /* reconstruct the argv[] */
  1346.       nargv[0] = "sh";
  1347. --- 127,135 ----
  1348.           execvp("mread", nargv);
  1349.   
  1350. !     while (wait(&status_read) != pid)
  1351.           ;
  1352. +                     /* we blew it... */
  1353. +     if (WEXITSTATUS(status_read) == 1)
  1354. +         exit(1);
  1355.                       /* reconstruct the argv[] */
  1356.       nargv[0] = "sh";
  1357. ***************
  1358. *** 154,158 ****
  1359.           execvp("sh", nargv);
  1360.   
  1361. !     while (wait(&status) != pid)
  1362.           ;
  1363.                       /* clobber the directory */
  1364. --- 165,169 ----
  1365.           execvp("sh", nargv);
  1366.   
  1367. !     while (wait(&status_write) != pid)
  1368.           ;
  1369.                       /* clobber the directory */
  1370. ***************
  1371. *** 159,163 ****
  1372.       sprintf(buf, "rm -fr %s", tmpdir);
  1373.       system(buf);
  1374. !     exit(0);
  1375.   }
  1376.   
  1377. --- 170,174 ----
  1378.       sprintf(buf, "rm -fr %s", tmpdir);
  1379.       system(buf);
  1380. !     exit(WEXITSTATUS(status_write));
  1381.   }
  1382.   
  1383. ***************
  1384. *** 190,193 ****
  1385. --- 201,205 ----
  1386.   
  1387.   #ifdef MKDIR
  1388. + /* ARGSUSED */
  1389.   mkdir(path, mode)
  1390.   char *path;
  1391. *** old/mdel.c    Mon Aug 17 17:40:39 1992
  1392. --- mdel.c    Tue Aug 18 13:39:28 1992
  1393. ***************
  1394. *** 28,32 ****
  1395.   char *argv[];
  1396.   {
  1397. !     int i, ismatch, entry, nogo, verbose, fargn;
  1398.       unsigned int start;
  1399.       char *filename, *newfile, *get_name(), *unix_name(), *get_path();
  1400. --- 28,32 ----
  1401.   char *argv[];
  1402.   {
  1403. !     int i, ismatch, entry, nogo, verbose, fargn, got_one, missed_one;
  1404.       unsigned int start;
  1405.       char *filename, *newfile, *get_name(), *unix_name(), *get_path();
  1406. ***************
  1407. *** 39,42 ****
  1408. --- 39,45 ----
  1409.       signal(SIGQUIT, (SIG_TYPE(*) ()) got_signal);
  1410.   
  1411. +     got_one = 0;
  1412. +     missed_one = 0;
  1413.       if (argc > 1 && !strcmp(argv[1], "-v")) {
  1414.           verbose = 1;
  1415. ***************
  1416. *** 66,69 ****
  1417. --- 69,73 ----
  1418.               if (init(drive, 2)) {
  1419.                   fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
  1420. +                 missed_one++;
  1421.                   continue;
  1422.               }
  1423. ***************
  1424. *** 72,77 ****
  1425.           filename = get_name(argv[i]);
  1426.           pathname = get_path(argv[i]);
  1427. !         if (subdir(drive, pathname))
  1428.               continue;
  1429.   
  1430.           nogo = 0;
  1431. --- 76,83 ----
  1432.           filename = get_name(argv[i]);
  1433.           pathname = get_path(argv[i]);
  1434. !         if (subdir(drive, pathname)) {
  1435. !             missed_one++;
  1436.               continue;
  1437. +         }
  1438.   
  1439.           nogo = 0;
  1440. ***************
  1441. *** 112,122 ****
  1442.                   dir->name[0] = 0xe5;
  1443.                   dir_write(entry, dir);
  1444.               }
  1445.           }
  1446. !         if (fat_error)
  1447.               break;
  1448.   
  1449. !         if (!ismatch)
  1450.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1451.       }
  1452.                       /* write the FAT, flush the buffers */
  1453. --- 118,133 ----
  1454.                   dir->name[0] = 0xe5;
  1455.                   dir_write(entry, dir);
  1456. +                 got_one++;
  1457.               }
  1458.           }
  1459. !         if (fat_error) {
  1460. !             missed_one++;
  1461.               break;
  1462. +         }
  1463.   
  1464. !         if (!ismatch) {
  1465.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1466. +             missed_one++;
  1467. +         }
  1468.       }
  1469.                       /* write the FAT, flush the buffers */
  1470. ***************
  1471. *** 125,128 ****
  1472. --- 136,143 ----
  1473.       disk_flush();
  1474.       close(fd);
  1475. +     if (got_one && missed_one)
  1476. +         exit(2);
  1477. +     if (missed_one)
  1478. +         exit(1);
  1479.       exit(0);
  1480.   }
  1481. *** old/mmd.c    Mon Aug 17 17:40:39 1992
  1482. --- mmd.c    Tue Aug 18 14:03:24 1992
  1483. ***************
  1484. *** 29,33 ****
  1485.   char *argv[];
  1486.   {
  1487. !     int i, entry, slot, fargn, verbose, oops;
  1488.       extern unsigned int end_fat;
  1489.       unsigned int fat, dot, next_fat();
  1490. --- 29,33 ----
  1491.   char *argv[];
  1492.   {
  1493. !     int i, entry, slot, fargn, verbose, oops, got_one, missed_one;
  1494.       extern unsigned int end_fat;
  1495.       unsigned int fat, dot, next_fat();
  1496. ***************
  1497. *** 46,49 ****
  1498. --- 46,51 ----
  1499.       verbose = 0;
  1500.       oops = 0;
  1501. +     got_one = 0;
  1502. +     missed_one = 0;
  1503.       if (argc > 1) {
  1504.           if (!strcmp(argv[1], "-v")) {
  1505. ***************
  1506. *** 73,76 ****
  1507. --- 75,79 ----
  1508.               if (init(drive, 2)) {
  1509.                   fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
  1510. +                 missed_one++;
  1511.                   continue;
  1512.               }
  1513. ***************
  1514. *** 83,88 ****
  1515.           pathname = get_path(argv[i]);
  1516.   
  1517. !         if (subdir(drive, pathname))
  1518.               continue;
  1519.                       /* see if exists and get slot */
  1520.           slot = -1;
  1521. --- 86,93 ----
  1522.           pathname = get_path(argv[i]);
  1523.   
  1524. !         if (subdir(drive, pathname)) {
  1525. !             missed_one++;
  1526.               continue;
  1527. +         }
  1528.                       /* see if exists and get slot */
  1529.           slot = -1;
  1530. ***************
  1531. *** 119,127 ****
  1532.               }
  1533.           }
  1534. !         if (oops)
  1535.               continue;
  1536.                       /* no '.' entry means root directory */
  1537.           if (dot == 0 && slot < 0) {
  1538.               fprintf(stderr, "%s: No directory slots\n", argv[0]);
  1539.               continue;
  1540.           }
  1541. --- 124,135 ----
  1542.               }
  1543.           }
  1544. !         if (oops) {
  1545. !             missed_one++;
  1546.               continue;
  1547. +         }
  1548.                       /* no '.' entry means root directory */
  1549.           if (dot == 0 && slot < 0) {
  1550.               fprintf(stderr, "%s: No directory slots\n", argv[0]);
  1551. +             missed_one++;
  1552.               continue;
  1553.           }
  1554. ***************
  1555. *** 130,133 ****
  1556. --- 138,142 ----
  1557.               if (dir_grow(dot)) {
  1558.                   fprintf(stderr, "%s: Disk full\n", argv[0]);
  1559. +                 missed_one++;
  1560.                   continue;
  1561.               }
  1562. ***************
  1563. *** 138,141 ****
  1564. --- 147,151 ----
  1565.           if ((fat = next_fat(0)) == 1) {
  1566.               fprintf(stderr, "%s: Disk full\n", argv[0]);
  1567. +             missed_one++;
  1568.               continue;
  1569.           }
  1570. ***************
  1571. *** 147,150 ****
  1572. --- 157,161 ----
  1573.           empty_dir(fat, dot);
  1574.           fat_encode(fat, end_fat);
  1575. +         got_one++;
  1576.       }
  1577.                       /* write the FAT, flush the buffers */
  1578. ***************
  1579. *** 153,156 ****
  1580. --- 164,171 ----
  1581.       disk_flush();
  1582.       close(fd);
  1583. +     if (got_one && missed_one)
  1584. +         exit(2);
  1585. +     if (missed_one)
  1586. +         exit(1);
  1587.       exit(0);
  1588.   }
  1589. *** old/mrd.c    Mon Aug 17 17:40:39 1992
  1590. --- mrd.c    Tue Aug 18 14:05:06 1992
  1591. ***************
  1592. *** 28,32 ****
  1593.   char *argv[];
  1594.   {
  1595. !     int i, ismatch, entry, oops, empty;
  1596.       unsigned int start;
  1597.       char *filename, *newfile, *get_name(), drive, *pathname, *get_path();
  1598. --- 28,32 ----
  1599.   char *argv[];
  1600.   {
  1601. !     int i, ismatch, entry, oops, empty, got_one, missed_one;
  1602.       unsigned int start;
  1603.       char *filename, *newfile, *get_name(), drive, *pathname, *get_path();
  1604. ***************
  1605. *** 45,48 ****
  1606. --- 45,50 ----
  1607.       }
  1608.   
  1609. +     got_one = 0;
  1610. +     missed_one = 0;
  1611.       last_drive = 'x';
  1612.       mcwd = fix_mcwd();
  1613. ***************
  1614. *** 59,62 ****
  1615. --- 61,65 ----
  1616.               if (init(drive, 2)) {
  1617.                   fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
  1618. +                 missed_one++;
  1619.                   continue;
  1620.               }
  1621. ***************
  1622. *** 66,71 ****
  1623.           filename = get_name(argv[i]);
  1624.           pathname = get_path(argv[i]);
  1625. !         if (subdir(drive, pathname))
  1626.               continue;
  1627.   
  1628.           oops = 0;
  1629. --- 69,76 ----
  1630.           filename = get_name(argv[i]);
  1631.           pathname = get_path(argv[i]);
  1632. !         if (subdir(drive, pathname)) {
  1633. !             missed_one++;
  1634.               continue;
  1635. +         }
  1636.   
  1637.           oops = 0;
  1638. ***************
  1639. *** 103,116 ****
  1640.                   dir_write(entry, dir);
  1641.                   ismatch = 1;
  1642.               }
  1643.           }
  1644. !         if (fat_error)
  1645.               break;
  1646.   
  1647. !         if (oops)
  1648.               continue;
  1649.   
  1650. !         if (!ismatch)
  1651.               fprintf(stderr, "%s: Directory \"%s\" not found\n", argv[0], filename);
  1652.       }
  1653.                       /* write the FAT, flush the buffers */
  1654. --- 108,128 ----
  1655.                   dir_write(entry, dir);
  1656.                   ismatch = 1;
  1657. +                 got_one++;
  1658.               }
  1659.           }
  1660. !         if (fat_error) {
  1661. !             missed_one++;
  1662.               break;
  1663. +         }
  1664.   
  1665. !         if (oops) {
  1666. !             missed_one++;
  1667.               continue;
  1668. +         }
  1669.   
  1670. !         if (!ismatch) {
  1671.               fprintf(stderr, "%s: Directory \"%s\" not found\n", argv[0], filename);
  1672. +             missed_one++;
  1673. +         }
  1674.       }
  1675.                       /* write the FAT, flush the buffers */
  1676. ***************
  1677. *** 119,122 ****
  1678. --- 131,138 ----
  1679.       disk_flush();
  1680.       close(fd);
  1681. +     if (got_one && missed_one)
  1682. +         exit(2);
  1683. +     if (missed_one)
  1684. +         exit(1);
  1685.       exit(0);
  1686.   }
  1687. *** old/mread.c    Mon Aug 17 17:40:39 1992
  1688. --- mread.c    Tue Aug 18 13:53:24 1992
  1689. ***************
  1690. *** 43,46 ****
  1691. --- 43,47 ----
  1692.       extern char *optarg;
  1693.       int i, ismatch, entry, single, c, oops, preserve, nowarn, textmode;
  1694. +     int got_one, missed_one;
  1695.       unsigned int fat;
  1696.       long size, mtime;
  1697. ***************
  1698. *** 57,60 ****
  1699. --- 58,63 ----
  1700.       nowarn = 0;
  1701.       textmode = 0;
  1702. +     got_one = 0;
  1703. +     missed_one = 0;
  1704.       while ((c = getopt(argc, argv, "tnmv")) != EOF) {
  1705.           switch (c) {
  1706. ***************
  1707. *** 103,106 ****
  1708. --- 106,110 ----
  1709.               if (init(drive, 0)) {
  1710.                   fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
  1711. +                 missed_one++;
  1712.                   continue;
  1713.               }
  1714. ***************
  1715. *** 109,114 ****
  1716.           filename = get_name(argv[i]);
  1717.           pathname = get_path(argv[i]);
  1718. !         if (subdir(drive, pathname))
  1719.               continue;
  1720.   
  1721.           ismatch = 0;
  1722. --- 113,120 ----
  1723.           filename = get_name(argv[i]);
  1724.           pathname = get_path(argv[i]);
  1725. !         if (subdir(drive, pathname)) {
  1726. !             missed_one++;
  1727.               continue;
  1728. +         }
  1729.   
  1730.           ismatch = 0;
  1731. ***************
  1732. *** 139,142 ****
  1733. --- 145,149 ----
  1734.                           if (file_read(fp, fat, textmode, 0, size)) {
  1735.                               fclose(fp);
  1736. +                             missed_one++;
  1737.                               break;
  1738.                           }
  1739. ***************
  1740. *** 143,148 ****
  1741.                           fclose(fp);
  1742.                           set_mtime(target, mtime);
  1743.                       }
  1744. !                     ismatch = 1;
  1745.                       break;
  1746.                   }
  1747. --- 150,158 ----
  1748.                           fclose(fp);
  1749.                           set_mtime(target, mtime);
  1750. +                         ismatch = 1;
  1751. +                         got_one++;
  1752.                       }
  1753. !                     else
  1754. !                         missed_one++;
  1755.                       break;
  1756.                   }
  1757. ***************
  1758. *** 172,175 ****
  1759. --- 182,186 ----
  1760.                           if (file_read(fp, fat, textmode, 0, size)) {
  1761.                               fclose(fp);
  1762. +                             missed_one++;
  1763.                               break;
  1764.                           }
  1765. ***************
  1766. *** 176,191 ****
  1767.                           fclose(fp);
  1768.                           set_mtime(tmp, mtime);
  1769.                       }
  1770. !                     ismatch = 1;
  1771.                   }
  1772.               }
  1773.           }
  1774. !         if (fat_error)
  1775.               break;
  1776.   
  1777. !         if (!ismatch)
  1778.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1779.       }
  1780.       close(fd);
  1781.       exit(0);
  1782.   }
  1783. --- 187,213 ----
  1784.                           fclose(fp);
  1785.                           set_mtime(tmp, mtime);
  1786. +                         ismatch = 1;
  1787. +                         got_one++;
  1788.                       }
  1789. !                     else
  1790. !                         missed_one++;
  1791.                   }
  1792.               }
  1793.           }
  1794. !         if (fat_error) {
  1795. !             missed_one++;
  1796.               break;
  1797. +         }
  1798.   
  1799. !         if (!ismatch) {
  1800.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1801. +             missed_one++;
  1802. +         }
  1803.       }
  1804.       close(fd);
  1805. +     if (got_one && missed_one)
  1806. +         exit(2);
  1807. +     if (missed_one)
  1808. +         exit(1);
  1809.       exit(0);
  1810.   }
  1811. *** old/mtype.c    Mon Aug 17 17:40:39 1992
  1812. --- mtype.c    Tue Aug 18 14:08:20 1992
  1813. ***************
  1814. *** 27,31 ****
  1815.       extern int optind;
  1816.       extern char *optarg;
  1817. !     int i, ismatch, entry, c, oops, textmode, stripmode;
  1818.       unsigned int fat;
  1819.       long size;
  1820. --- 27,32 ----
  1821.       extern int optind;
  1822.       extern char *optarg;
  1823. !     int i, ismatch, entry, c, oops, textmode, stripmode, got_one;
  1824. !     int missed_one;
  1825.       unsigned int fat;
  1826.       long size;
  1827. ***************
  1828. *** 39,42 ****
  1829. --- 40,45 ----
  1830.       stripmode = 0;
  1831.       textmode = 0;
  1832. +     got_one = 0;
  1833. +     missed_one = 0;
  1834.       while ((c = getopt(argc, argv, "st")) != EOF) {
  1835.           switch (c) {
  1836. ***************
  1837. *** 66,69 ****
  1838. --- 69,73 ----
  1839.               if (init(drive, 0)) {
  1840.                   fprintf(stderr, "%s: Cannot initialize '%c:'\n", argv[0], drive);
  1841. +                 missed_one++;
  1842.                   continue;
  1843.               }
  1844. ***************
  1845. *** 72,77 ****
  1846.           filename = get_name(argv[i]);
  1847.           pathname = get_path(argv[i]);
  1848. !         if (subdir(drive, pathname))
  1849.               continue;
  1850.   
  1851.           ismatch = 0;
  1852. --- 76,83 ----
  1853.           filename = get_name(argv[i]);
  1854.           pathname = get_path(argv[i]);
  1855. !         if (subdir(drive, pathname)) {
  1856. !             missed_one++;
  1857.               continue;
  1858. +         }
  1859.   
  1860.           ismatch = 0;
  1861. ***************
  1862. *** 97,109 ****
  1863.                       break;
  1864.                   ismatch = 1;
  1865.               }
  1866.           }
  1867. !         if (fat_error)
  1868.               break;
  1869.   
  1870. !         if (!ismatch)
  1871.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1872.       }
  1873.       close(fd);
  1874.       exit(0);
  1875.   }
  1876. --- 103,124 ----
  1877.                       break;
  1878.                   ismatch = 1;
  1879. +                 got_one++;
  1880.               }
  1881.           }
  1882. !         if (fat_error) {
  1883. !             missed_one++;
  1884.               break;
  1885. +         }
  1886.   
  1887. !         if (!ismatch) {
  1888.               fprintf(stderr, "%s: File \"%s\" not found\n", argv[0], filename);
  1889. +             missed_one++;
  1890. +         }
  1891.       }
  1892.       close(fd);
  1893. +     if (got_one && missed_one)
  1894. +         exit(2);
  1895. +     if (missed_one)
  1896. +         exit(1);
  1897.       exit(0);
  1898.   }
  1899. *** old/mwrite.c    Mon Aug 17 17:40:40 1992
  1900. --- mwrite.c    Fri Aug 21 14:19:50 1992
  1901. ***************
  1902. *** 37,41 ****
  1903.       extern int optind;
  1904.       extern char *optarg;
  1905. !     int i, entry, ismatch, nogo, slot, single;
  1906.       int c, oops, verbose, first, mod_time;
  1907.       unsigned int dot, start;
  1908. --- 37,41 ----
  1909.       extern int optind;
  1910.       extern char *optarg;
  1911. !     int i, entry, ismatch, nogo, slot, single, got_one, missed_one;
  1912.       int c, oops, verbose, first, mod_time;
  1913.       unsigned int dot, start;
  1914. ***************
  1915. *** 54,57 ****
  1916. --- 54,59 ----
  1917.       verbose = 0;
  1918.       mod_time = 0;
  1919. +     got_one = 0;
  1920. +     missed_one = 0;
  1921.       while ((c = getopt(argc, argv, "tnvm")) != EOF) {
  1922.           switch (c) {
  1923. ***************
  1924. *** 196,201 ****
  1925.                   break;
  1926.           }
  1927. !         if (fat_error)
  1928.               break;
  1929.   
  1930.           if (nogo)        /* chickened out... */
  1931. --- 198,205 ----
  1932.                   break;
  1933.           }
  1934. !         if (fat_error) {
  1935. !             missed_one++;
  1936.               break;
  1937. +         }
  1938.   
  1939.           if (nogo)        /* chickened out... */
  1940. ***************
  1941. *** 204,207 ****
  1942. --- 208,212 ----
  1943.           if (dot == 0 && slot < 0) {
  1944.               fprintf(stderr, "%s: No directory slots\n", argv[0]);
  1945. +             missed_one++;
  1946.               break;
  1947.           }
  1948. ***************
  1949. *** 210,213 ****
  1950. --- 215,219 ----
  1951.               if (dir_grow(dot)) {
  1952.                   fprintf(stderr, "%s: Disk full\n", argv[0]);
  1953. +                 missed_one++;
  1954.                   break;
  1955.               }
  1956. ***************
  1957. *** 216,221 ****
  1958.           }
  1959.                       /* write the file */
  1960. !         if (dir = writeit(fixed, argv[i], verbose, mod_time, single, target))
  1961.               dir_write(slot, dir);
  1962.   
  1963.           if (full) {
  1964. --- 222,231 ----
  1965.           }
  1966.                       /* write the file */
  1967. !         if (dir = writeit(fixed, argv[i], verbose, mod_time, single, target)) {
  1968.               dir_write(slot, dir);
  1969. +             got_one++;
  1970. +         }
  1971. +         else
  1972. +             missed_one++;
  1973.   
  1974.           if (full) {
  1975. ***************
  1976. *** 231,234 ****
  1977. --- 241,248 ----
  1978.       disk_flush();
  1979.       close(fd);
  1980. +     if (got_one && missed_one)
  1981. +         exit(2);
  1982. +     if (missed_one)
  1983. +         exit(1);
  1984.       exit(0);
  1985.   }
  1986. End of Patch
  1987.