*** Mtools.1~ Thu Sep 10 17:00:31 1992 --- Mtools.1 Mon Feb 13 03:36:08 1995 *************** *** 65,74 **** .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), mcopy(1), mdir(1), mlabel(1), mmd(1), mread(1), mwrite(1) .SH BUGS An unfortunate side effect of not guessing the proper device (when ! multiple disk capacities are supported) is an occasional error message from the device driver. These can be safely ignored. --- 65,86 ---- .PP All the Mtools commands return 0 on success, 1 on utter failure, or 2 on partial failure. + .SH ENVIRONMENT + If the environment variable + .B MTOOLS_A + is set, then its value is used as the capacity of drive A + (eg. 1440) and the device has not to be guessed. + The value may be followed by a colon and the device name. This + permits to use vnode disks (see vnconfig(1)) (eg. 720:vn0c) + .sp + .B MTOOLS_B + .br + Same as above, but for drive B. .SH SEE ALSO mattrib(1), mcd(1), mdel(1), mformat(1), mrd(1), mren(1), mtype(1), mcopy(1), mdir(1), mlabel(1), mmd(1), mread(1), mwrite(1) .SH BUGS An unfortunate side effect of not guessing the proper device (when ! multiple disk capacities are supported and environment variable are ! not set) is an occasional error message from the device driver. These can be safely ignored. *** init.c~ Sun Feb 12 20:03:37 1995 --- init.c Sun Feb 12 20:13:04 1995 *************** *** 44,49 **** --- 44,50 ---- free((char *) disk_buf); free((char *) dir_buf); } + reset_devices (); /* check out the drive letter */ dev = devices; while (dev->drive) { *************** *** 361,363 **** --- 362,365 ---- #endif /* FCNTL */ return(0); } + #include "reset.c" *** mformat.c~ Sun Feb 12 20:03:38 1995 --- mformat.c Sun Feb 12 20:12:51 1995 *************** *** 71,77 **** drive = argv[argc -1][0]; if (islower(drive)) drive = toupper(drive); ! /* check out the drive letter */ dev = devices; while (dev->drive) { --- 71,78 ---- drive = argv[argc -1][0]; if (islower(drive)) drive = toupper(drive); ! ! reset_devices (); /* check out the drive letter */ dev = devices; while (dev->drive) { *************** *** 249,251 **** --- 250,253 ---- /* hooks for the missing parts */ void disk_write() {} + #include "reset.c" *** /dev/null Sun Feb 12 19:58:24 1995 --- reset.c Mon Feb 13 01:30:43 1995 *************** *** 0 **** --- 1,59 ---- + + reset_devices () + { + extern struct device devices[]; + char *p, *s, *getenv(), *strchr(); + static char adev[20], bdev[20]; + struct device *dev; + int i, j; + + p = getenv ("MTOOLS_A"); + if (p) { + s = strchr (p, ':'); + if (s) + *s++ = 0; + switch (atoi (p)) { + case 1720: i = 2; break; + case 1480: i = 3; break; + case 1440: i = 0; break; + case 1200: i = 4; break; + case 720: i = 1; break; + case 360: i = 5; break; + default: + fprintf (stderr, "MTOOLS_A: bad value: %s\n", p); + exit (1); + } + memmove (&devices[0], &devices[i], sizeof (struct device)); + memmove (&devices[1], &devices[6], 7*sizeof (struct device)); + if (s) { + sprintf (adev, "/dev/%s", s); + devices[0].name = adev; + } + j = 1; + } else + j = 6; + p = getenv ("MTOOLS_B"); + if (p) { + s = strchr (p, ':'); + if (s) + *s++ = 0; + switch (atoi (p)) { + case 1720: i = 10; break; + case 1480: i = 11; break; + case 1440: i = 7; break; + case 1200: i = 6; break; + case 720: i = 8; break; + case 360: i = 9; break; + default: + fprintf (stderr, "MTOOLS_B: bad value: %s\n", p); + exit (1); + } + memmove (&devices[j], &devices[j==1?i-4:i], sizeof (struct device)); + devices[j+1].drive = 0; + if (s) { + sprintf (bdev, "/dev/%s", s); + devices[j].name = bdev; + } + } + } +