Newsgroups: comp.os.linux.announce
From: B.Bergt@Informatik.tu-chemnitz.de (Birko Bergt)
Subject: PATCH using mtools/mformat to low-level format disks
Message-ID: <1993May31.210248.5634@klaava.Helsinki.FI>
Date: Mon, 31 May 1993 21:02:48 GMT
Approved: linux-announce@tc.cornell.edu (Lars Wirzenius)

Hello,

	here is a patch  for  the  mtools  to  use  fdformat  for
low-level formating disk's with the mformat command and to create
a special bootselector as bootsector on the formated disk.  There
are some new options for mformat. Please read the  man  page  for
mformat.

There are 3 files in this mail:

	1.)	mboot.h	included by mformat.c
	2.)	modified fdformat.c
	3.)	the context diff from mtools-2.05 (merged)

	vy73		Birko

--------------- 8< -------------- 8< --------------- 8< --------------
/* mboot.h - included by mformat.c
 * a special bootselector, german and english version, use the define in
 * Makefile
 *
 * Birko Bergt, (c) 1993, bergt@informatik.tu-chemnitz.de
 */
char bbboot[]
#ifdef	GERMAN
      = {
		0xeb, 0x3c, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x33,
		0xc0, 0x8e, 0xd8, 0x8e, 0xc0, 0xfc, 0xb9, 0x00,
		0x01, 0xbe, 0x00, 0x7c, 0xbf, 0x00, 0x80, 0xf3,
		0xa5, 0xea, 0x56, 0x00, 0x00, 0x08, 0xbe, 0x84,
		0x01, 0xe8, 0xad, 0x00, 0xb4, 0x03, 0x32, 0xff,
		0xcd, 0x10, 0xb9, 0x0f, 0x00, 0xbe, 0x18, 0x01,
		0xe8, 0x89, 0x00, 0xbb, 0x6c, 0x04, 0x8b, 0x37,
		0x8b, 0x7f, 0x02, 0x83, 0xc6, 0x12, 0x83, 0xd7,
		0x00, 0xb4, 0x01, 0xcd, 0x16, 0x75, 0x15, 0x39,
		0x7f, 0x02, 0x72, 0xf5, 0x39, 0x37, 0x72, 0xf1,
		0xe2, 0xdb, 0xbe, 0x18, 0x01, 0xe8, 0x64, 0x00,
		0xb0, 0x43, 0xeb, 0x06, 0xb4, 0x00, 0xcd, 0x16,
		0x24, 0x5f, 0x3c, 0x41, 0x74, 0x54, 0x3c, 0x42,
		0x74, 0x1f, 0x3c, 0x43, 0x75, 0x98, 0xbe, 0x84,
		0x01, 0xe8, 0x5d, 0x00, 0xb8, 0x01, 0x02, 0xbb,
		0x00, 0x7c, 0xba, 0x80, 0x00, 0xb9, 0x01, 0x00,
		0xcd, 0x13, 0x72, 0x36, 0xea, 0x00, 0x7c, 0x00,
		0x00, 0x8b, 0x1e, 0x02, 0x01, 0x23, 0xdb, 0x74,
		0x29, 0x53, 0xbe, 0x61, 0x01, 0xe8, 0x39, 0x00,
		0x5b, 0x89, 0x1e, 0x42, 0x03, 0xbf, 0x00, 0x03,
		0x8b, 0xc7, 0x87, 0x06, 0x00, 0x01, 0xa3, 0x40,
		0x03, 0x8c, 0x06, 0x02, 0x01, 0xbe, 0x87, 0x01,
		0x81, 0xc6, 0x00, 0x80, 0xb9, 0x0f, 0x00, 0x90,
		0xf3, 0xa4, 0xcd, 0x19, 0x89, 0x16, 0x50, 0x04,
		0x8b, 0xc1, 0xd4, 0x0a, 0x05, 0x30, 0x30, 0x86,
		0xe0, 0x2e, 0xa3, 0x55, 0x01, 0xe8, 0x01, 0x00,
		0xc3, 0x2e, 0xac, 0x0a, 0xc0, 0x74, 0x08, 0x32,
		0xff, 0xb4, 0x0e, 0xcd, 0x10, 0xeb, 0xf2, 0xc3,
		0x2a, 0x2a, 0x2a, 0x20, 0x42, 0x2e, 0x42, 0x2e,
		0x27, 0x73, 0x20, 0x2d, 0x20, 0x42, 0x6f, 0x6f,
		0x74, 0x73, 0x65, 0x28, 0x6c, 0x65, 0x29, 0x6b,
		0x74, 0x6f, 0x72, 0x3a, 0x20, 0x54, 0x61, 0x73,
		0x74, 0x65, 0x20, 0x41, 0x2c, 0x20, 0x42, 0x20,
		0x6f, 0x64, 0x65, 0x72, 0x20, 0x43, 0x20, 0x2d,
		0x20, 0x41, 0x75, 0x74, 0x6f, 0x62, 0x6f, 0x6f,
		0x74, 0x20, 0x69, 0x6e, 0x20, 0x30, 0x30, 0x20,
		0x73, 0x20, 0x76, 0x6f, 0x6e, 0x20, 0x43, 0x3a,
		0x00, 0x0d, 0x0a, 0x4c, 0x61, 0x75, 0x66, 0x77,
		0x65, 0x72, 0x6b, 0x65, 0x20, 0x41, 0x3a, 0x20,
		0x75, 0x6e, 0x64, 0x20, 0x42, 0x3a, 0x20, 0x76,
		0x65, 0x72, 0x74, 0x61, 0x75, 0x73, 0x63, 0x68,
		0x74, 0x2e, 0x2e, 0x2e, 0x0d, 0x0a, 0x00, 0x9c,
		0x80, 0xf2, 0x01, 0x9d, 0xcd, 0xd0, 0x9c, 0x80,
		0xf2, 0x01, 0x9d, 0xca, 0x02, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa
	};
#else
      = {
		0xEB, 0x3C, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x33,
		0xC0, 0x8E, 0xD8, 0x8E, 0xC0, 0xFC, 0xB9, 0x00,
		0x01, 0xBE, 0x00, 0x7C, 0xBF, 0x00, 0x80, 0xF3,
		0xA5, 0xEA, 0x56, 0x00, 0x00, 0x08, 0xBE, 0x7A,
		0x01, 0xE8, 0xAD, 0x00, 0xB4, 0x03, 0x32, 0xFF,
		0xCD, 0x10, 0xB9, 0x0F, 0x00, 0xBE, 0x18, 0x01,
		0xE8, 0x89, 0x00, 0xBB, 0x6C, 0x04, 0x8B, 0x37,
		0x8B, 0x7F, 0x02, 0x83, 0xC6, 0x12, 0x83, 0xD7,
		0x00, 0xB4, 0x01, 0xCD, 0x16, 0x75, 0x15, 0x39,
		0x7F, 0x02, 0x72, 0xF5, 0x39, 0x37, 0x72, 0xF1,
		0xE2, 0xDB, 0xBE, 0x18, 0x01, 0xE8, 0x64, 0x00,
		0xB0, 0x43, 0xEB, 0x06, 0xB4, 0x00, 0xCD, 0x16,
		0x24, 0x5F, 0x3C, 0x41, 0x74, 0x54, 0x3C, 0x42,
		0x74, 0x1F, 0x3C, 0x43, 0x75, 0x98, 0xBE, 0x7A,
		0x01, 0xE8, 0x5D, 0x00, 0xB8, 0x01, 0x02, 0xBB,
		0x00, 0x7C, 0xBA, 0x80, 0x00, 0xB9, 0x01, 0x00,
		0xCD, 0x13, 0x72, 0x36, 0xEA, 0x00, 0x7C, 0x00,
		0x00, 0x8B, 0x1E, 0x02, 0x01, 0x23, 0xDB, 0x74,
		0x29, 0x53, 0xBE, 0x5E, 0x01, 0xE8, 0x39, 0x00,
		0x5B, 0x89, 0x1E, 0x42, 0x03, 0xBF, 0x00, 0x03,
		0x8B, 0xC7, 0x87, 0x06, 0x00, 0x01, 0xA3, 0x40,
		0x03, 0x8C, 0x06, 0x02, 0x01, 0xBE, 0x7D, 0x01,
		0x81, 0xC6, 0x00, 0x80, 0xB9, 0x0F, 0x00, 0x90,
		0xF3, 0xA4, 0xCD, 0x19, 0x89, 0x16, 0x50, 0x04,
		0x8B, 0xC1, 0xD4, 0x0A, 0x05, 0x30, 0x30, 0x86,
		0xE0, 0x2E, 0xA3, 0x51, 0x01, 0xE8, 0x01, 0x00,
		0xC3, 0x2E, 0xAC, 0x0A, 0xC0, 0x74, 0x08, 0x32,
		0xFF, 0xB4, 0x0E, 0xCD, 0x10, 0xEB, 0xF2, 0xC3,
		0x2A, 0x2A, 0x2A, 0x20, 0x42, 0x2E, 0x42, 0x2E,
		0x27, 0x73, 0x20, 0x2D, 0x20, 0x42, 0x6F, 0x6F,
		0x74, 0x73, 0x65, 0x28, 0x6C, 0x65, 0x29, 0x63,
		0x74, 0x6F, 0x72, 0x3A, 0x20, 0x4B, 0x65, 0x79,
		0x20, 0x41, 0x2C, 0x20, 0x42, 0x20, 0x6F, 0x72,
		0x20, 0x43, 0x20, 0x2D, 0x20, 0x41, 0x75, 0x74,
		0x6F, 0x62, 0x6F, 0x6F, 0x74, 0x20, 0x69, 0x6E,
		0x20, 0x30, 0x30, 0x20, 0x73, 0x20, 0x66, 0x72,
		0x6F, 0x6D, 0x20, 0x43, 0x3A, 0x00, 0x0D, 0x0A,
		0x44, 0x72, 0x69, 0x76, 0x65, 0x20, 0x41, 0x3A,
		0x20, 0x61, 0x6E, 0x64, 0x20, 0x42, 0x3A, 0x20,
		0x63, 0x68, 0x61, 0x6E, 0x67, 0x65, 0x64, 0x2E,
		0x2E, 0x2E, 0x0D, 0x0A, 0x00, 0x9C, 0x80, 0xF2,
		0x01, 0x9D, 0xCD, 0xD0, 0x9C, 0x80, 0xF2, 0x01,
		0x9D, 0xCA, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xAA
	};
#endif /* GERMAN */
/* end of mboot.h */
--------------- 8< -------------- 8< --------------- 8< --------------

/* fdformat.c  -  Low-level formats a floppy disk. */

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/fd.h>


static int ctrl;
struct floppy_struct param;


#define SECTOR_SIZE 512
#define PERROR(msg) { perror(msg); exit(1); }


static void format_disk(char *name)
{
    struct format_descr descr;
    int track;
    char dummy;

    printf("Formatting ... ");
    fflush(stdout);
    if (ioctl(ctrl,FDFMTBEG,NULL) < 0) PERROR("\nioctl(FDFMTBEG)");
    for (track = 0; track < param.track; track++) {
        descr.track = track;
        descr.head = 0;
        if (ioctl(ctrl,FDFMTTRK,(int) &descr) < 0) PERROR("\nioctl(FDFMTTRK)");
        printf("%3d\b\b\b",track);
        fflush(stdout);
        if (param.head == 2) {
            descr.head = 1;
            if (ioctl(ctrl,FDFMTTRK,(int) &descr) < 0)
                PERROR("\nioctl(FDFMTTRK)");
        }
    }
    if (ioctl(ctrl,FDFMTEND,NULL) < 0) PERROR("\nioctl(FDFMTEND)");
    printf("done\n");
}


static void verify_disk(char *name)
{
    unsigned char *data;
    int fd,cyl_size,cyl,count;

    cyl_size = param.sect*param.head*512;
    if ((data = (unsigned char *) malloc(cyl_size)) == NULL) PERROR("malloc");
    printf("Verifying ... ");
    fflush(stdout);
    if ((fd = open(name,O_RDONLY)) < 0) PERROR(name);
    for (cyl = 0; cyl < param.track; cyl++) {
        printf("%3d\b\b\b",cyl);
        fflush(stdout);
        if (read(fd,data,cyl_size) != cyl_size) PERROR("read");
        for (count = 0; count < cyl_size; count++)
            if (data[count] != FD_FILL_BYTE) {
                printf("bad data in cyl %d\nContinuing ... ",cyl);
                fflush(stdout);
                break;
            }
    }
    printf("done\n");
    if (close(fd) < 0) PERROR("close");
}


static void usage(char *name)
{
    char *this;

    if (this = strrchr(name,'/')) name = this+1;
    fprintf(stderr,"usage: %s [ -n ] device\n",name);
    exit(1);
}


main(int argc,char **argv)
{
    int verify;
    char *name;

    name = argv[0];
    verify = 1;
    if (argc > 1 && argv[1][0] == '-') {
        if (argv[1][1] != 'n') usage(name);
        verify = 0;
        argc--;
        argv++;
    }
    if (argc != 2) usage(name);
    if ((ctrl = open(argv[1],3)) < 0) PERROR(argv[1]);
    if (ioctl(ctrl,FDGETPRM,(int) &param) < 0) PERROR("ioctl(FDGETPRM)");
    printf("%sle-sided, %d tracks, %d sec/track. Total capacity %d kB.\n",
      param.head ? "Doub" : "Sing",param.track,param.sect,param.size >> 1);
    format_disk(argv[1]);
    if (verify) verify_disk(argv[1]);
    exit(0);		/* to get an correct exit stauts, Birko Bergt */
}
--------------- 8< -------------- 8< --------------- 8< --------------
diff --recursive --context mtools-2.05/Makefile mtools-2.05+/Makefile
*** mtools-2.05/Makefile	Sat Aug  8 19:05:54 1992
--- mtools-2.05+/Makefile	Fri May 28 10:18:18 1993
***************
*** 5,10 ****
--- 5,12 ----
  # Berkeley flavors of Unix should include -DBSD in the CFLAGS
  
  CC	= cc
+ # use the GERMAN define to create an german boot selector
+ # CFLAGS	= -O -DMERGED -DLINUX -DGERMAN
  CFLAGS	= -O -DMERGED -DLINUX
  LDFLAGS	= -s
  LD	= cc
***************
*** 117,123 ****
  		$(CC) -c $(CFLAGS) mdel.c -Dmain=mdel
  mdir.o:		msdos.h patchlevel.h mdir.c
  		$(CC) -c $(CFLAGS) mdir.c -Dmain=mdir
! mformat.o:	msdos.h patchlevel.h mformat.c
  		$(CC) -c $(CFLAGS) mformat.c -Dmain=mformat
  mlabel.o:	msdos.h patchlevel.h mlabel.c
  		$(CC) -c $(CFLAGS) mlabel.c -Dmain=mlabel
--- 119,125 ----
  		$(CC) -c $(CFLAGS) mdel.c -Dmain=mdel
  mdir.o:		msdos.h patchlevel.h mdir.c
  		$(CC) -c $(CFLAGS) mdir.c -Dmain=mdir
! mformat.o:	mboot.h msdos.h patchlevel.h mformat.c
  		$(CC) -c $(CFLAGS) mformat.c -Dmain=mformat
  mlabel.o:	msdos.h patchlevel.h mlabel.c
  		$(CC) -c $(CFLAGS) mlabel.c -Dmain=mlabel
diff --recursive --context mtools-2.05/Mformat.1 mtools-2.05+/Mformat.1
*** mtools-2.05/Mformat.1	Sat Aug  8 19:02:44 1992
--- mtools-2.05+/Mformat.1	Fri May 28 10:15:20 1993
***************
*** 1,6 ****
  .TH MFORMAT 1 local
  .SH NAME
! mformat \- add an MSDOS filesystem to a low-level formatted diskette.
  .SH SYNOPSIS
  .B mformat
  [
--- 1,6 ----
  .TH MFORMAT 1 local
  .SH NAME
! mformat \- format and add an MSDOS filesystem diskette.
  .SH SYNOPSIS
  .B mformat
  [
***************
*** 11,17 ****
  .B -s
  sectors ] [
  .B -l
! volume label ] drive:
  .SH DESCRIPTION
  .I Mformat
  adds a minimal MSDOS filesystem (boot sector, FAT, and root directory) to
--- 11,23 ----
  .B -s
  sectors ] [
  .B -l
! volume label ] [
! .B -b
! ] [
! .B -r
! ] [
! .B -n
! ] drive:
  .SH DESCRIPTION
  .I Mformat
  adds a minimal MSDOS filesystem (boot sector, FAT, and root directory) to
***************
*** 30,42 ****
  .TP
  .B l
  An optional volume label.
  .PP
  To format a diskette at a density other than the default, you must supply
  (at least) those command line parameters that are different from the
! default.
  .SH SEE ALSO
  mlabel(1)
  .SH BUGS
! Requires a low-level format utility from Unix.
  .PP
  Doesn't detect (or record) bad block information.
--- 36,61 ----
  .TP
  .B l
  An optional volume label.
+ .TP
+ .B b
+ A special bootselector is written to the diskette.
+ .TP
+ .B r
+ A fdformat is done to low-level format the disk.
+ .TP
+ .B n
+ The diskette is low-level checked.
  .PP
  To format a diskette at a density other than the default, you must supply
  (at least) those command line parameters that are different from the
! default. With the special bootselector you can do any interessting things.
! You can select your boot device and you can swap your floppy drives by
! software.
  .SH SEE ALSO
  mlabel(1)
  .SH BUGS
! The low-level format utility fdformat is required. If it not exists you can't
! use the -r and -n options.
! %Requires a low-level format utility from Unix.
  .PP
  Doesn't detect (or record) bad block information.
diff --recursive --context mtools-2.05/mformat.c mtools-2.05+/mformat.c
*** mtools-2.05/mformat.c	Thu May  7 12:38:01 1992
--- mtools-2.05+/mformat.c	Fri May 28 10:08:23 1993
***************
*** 12,17 ****
--- 12,18 ----
  #include <ctype.h>
  #include "msdos.h"
  #include "patchlevel.h"
+ #include "mboot.h"
  
  #ifndef MERGED
  int fd, dir_dirty, dir_entries;
***************
*** 28,38 ****
  	extern struct device devices[];
  	struct bootsector boot;
  	int i, c, oops, tracks, heads, sectors, fat_len, dir_len, clus_size;
! 	int tot_sectors, num_clus, fat_guess;
  	long time(), now, lseek();
  	char drive, *name, *expand();
  	char *strncpy(), *memset(), *memcpy();
! 	unsigned char media, label[12], buf[MSECTOR_SIZE];
  	struct device *dev;
  	struct directory *dir, *mk_entry();
  	void exit(), perror();
--- 29,39 ----
  	extern struct device devices[];
  	struct bootsector boot;
  	int i, c, oops, tracks, heads, sectors, fat_len, dir_len, clus_size;
! 	int tot_sectors, num_clus, fat_guess, bflag, rflag, nflag, estat;
  	long time(), now, lseek();
  	char drive, *name, *expand();
  	char *strncpy(), *memset(), *memcpy();
! 	unsigned char media, label[12], buf[MSECTOR_SIZE], fdcmd[40];
  	struct device *dev;
  	struct directory *dir, *mk_entry();
  	void exit(), perror();
***************
*** 42,50 ****
  	heads = 0;
  	sectors = 0;
  	label[0] = '\0';
  					/* get command line options */
! 	while ((c = getopt(argc, argv, "t:h:s:l:")) != EOF) {
  		switch (c) {
  			case 't':
  				tracks = atoi(optarg);
  				break;
--- 43,57 ----
  	heads = 0;
  	sectors = 0;
  	label[0] = '\0';
+ 	bflag = 0;
+ 	rflag = 0;
+ 	nflag = 0;
  					/* get command line options */
! 	while ((c = getopt(argc, argv, "bt:h:s:l:nr")) != EOF) {
  		switch (c) {
+ 			case 'b':
+ 				bflag++;
+ 				break;
  			case 't':
  				tracks = atoi(optarg);
  				break;
***************
*** 57,62 ****
--- 64,75 ----
  			case 'l':
  				sprintf((char *) label, "%-11.11s", optarg);
  				break;
+ 			case 'n':
+ 				nflag++;
+ 				break;
+ 			case 'r':
+ 				rflag++;
+ 				break;
  			default:
  				oops = 1;
  				break;
***************
*** 65,71 ****
  
  	if (oops || (argc - optind) != 1) {
  		fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE);
! 		fprintf(stderr, "Usage: %s [-t tracks] [-h heads] [-s sectors] [-l label] device\n", argv[0]);
  		exit(1);
  	}
  
--- 78,84 ----
  
  	if (oops || (argc - optind) != 1) {
  		fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE);
! 		fprintf(stderr, "Usage: %s [-t tracks] [-h heads] [-s sectors] [-l label] [-b] [-r] [-n] device\n", argv[0]);
  		exit(1);
  	}
  
***************
*** 100,108 ****
  		fprintf(stderr, "%s: Paramaters not supported\n", argv[0]);
  		exit(1);
  	}
- 					/* open the device */
  	name = expand(dev->name);
! 	if ((fd = open(name, 2 | dev->mode)) < 0) {
  		perror("init: open");
  		exit(1);
  	}
--- 113,133 ----
  		fprintf(stderr, "%s: Paramaters not supported\n", argv[0]);
  		exit(1);
  	}
  	name = expand(dev->name);
! 	if (rflag) {
! 		strcpy(fdcmd, "fdformat ");
! 		if (nflag)
! 			strcat(fdcmd, "-n ");
! 		strcat(fdcmd, name);
! 		fprintf(stderr, "Execute: %s ...\n", fdcmd);
! 		if ((estat = system(fdcmd)) != 0L) {
! 			fprintf(stderr, "fdformat: exit stat %.x\n", estat);
! 			fprintf(stderr, "%s: Execute %s failed\n", argv[0], fdcmd);
! 			exit(1);
! 		}
! 		fprintf(stderr, "... done with %d\n", estat);
! 	}
! 	if ((fd = open(name, 2 | dev->mode)) < 0) { /* open the device */
  		perror("init: open");
  		exit(1);
  	}
***************
*** 188,199 ****
  			fat_len = (num_clus / 341.0) + 1;
  			break;
  	}
- 					/* the boot sector */
  	memset((char *) &boot, '\0', MSECTOR_SIZE);
! 	boot.jump[0] = 0xeb;
! 	boot.jump[1] = 0x44;
! 	boot.jump[2] = 0x90;
! 	strncpy((char *) boot.banner, "Mtools  ", 8);
  	boot.secsiz[0] = 512 % 0x100;
  	boot.secsiz[1] = 512 / 0x100;
  	boot.clsiz = (unsigned char) clus_size;
--- 213,228 ----
  			fat_len = (num_clus / 341.0) + 1;
  			break;
  	}
  	memset((char *) &boot, '\0', MSECTOR_SIZE);
! 	if (bflag) {				/* the boot sector */
! 		memcpy((char *) &boot, &bbboot, MSECTOR_SIZE);
! 	}
! 	else {
! 		boot.jump[0] = 0xeb;
! 		boot.jump[1] = 0x44;
! 		boot.jump[2] = 0x90;
! 	}
! 	strncpy((char *) boot.banner, "Mtools+ ", 8);
  	boot.secsiz[0] = 512 % 0x100;
  	boot.secsiz[1] = 512 / 0x100;
  	boot.clsiz = (unsigned char) clus_size;
--------------- 8< -------------- 8< --------------- 8< --------------

--
+----------------------------------------------------------------------+
| \_        \_            Birko Bergt                                  |
|  \_        \_           Technical University of Chemnitz/Zwickau     |
|   \_\_\_    \_\_\_      Postbox 964, DO-9010 Chemnitz                |
|    \_  \_    \_  \_     Phone: +49/371/668379 (priv.)+49/371/254***  |
|     \_\_\_ \_ \_\_\_ \_ E-Mail: bergt@informatik.tu-chemnitz.de      |
+----------------------------------------------------------------------+
