Index: fdisk.8 =================================================================== RCS file: /base/FreeBSD-tsc-4/sbin/i386/fdisk/fdisk.8,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fdisk.8 1999/09/30 00:59:00 1.1 +++ fdisk.8 2000/03/03 23:27:41 1.2 @@ -8,7 +8,7 @@ .Nd PC partition table maintenance program .Sh SYNOPSIS .Nm fdisk -.Op Fl Baeitu +.Op Fl BIaistu .Op Fl b Ar bootcode .Op Fl 1234 .Op Ar disk @@ -62,7 +62,7 @@ if .Fl f is given. -.It Fl e +.It Fl I Initialize the contents of sector 0 with one FreeBSD slice covering the entire disk. .It Fl f Ar configfile Set partition values using the file @@ -93,6 +93,8 @@ unless .Fl f is given. +.It Fl s +Print summary information and exit. .It Fl t Test mode; do not write partition values. Generally used with the .Fl f Index: fdisk.c =================================================================== RCS file: /base/FreeBSD-tsc-4/sbin/i386/fdisk/fdisk.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fdisk.c 1999/09/30 00:59:00 1.1 +++ fdisk.c 2000/03/03 23:27:41 1.2 @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$FreeBSD: src/sbin/i386/fdisk/fdisk.c,v 1.33 1999/09/25 02:11:30 billf Exp $"; + "$FreeBSD: src/sbin/i386/fdisk/fdisk.c,v 1.34 2000/02/11 11:25:23 ru Exp $"; #endif /* not lint */ #include @@ -67,7 +67,7 @@ const char *disk; const char *disks[] = { - "/dev/rwd0", "/dev/rda0", "/dev/rod0", 0 + "/dev/rad0", "/dev/rwd0", "/dev/rda0", "/dev/rod0", 0 }; struct disklabel disklabel; /* disk parameters */ @@ -118,11 +118,12 @@ static int B_flag = 0; /* replace boot code */ +static int I_flag = 0; /* use entire disk for FreeBSD */ static int a_flag = 0; /* set active partition */ static char *b_flag = NULL; /* path to boot code */ -static int e_flag = 0; /* use entire disk for FreeBSD */ static int i_flag = 0; /* replace partition data */ static int u_flag = 0; /* update partition data */ +static int s_flag = 0; /* Print a summary and exit */ static int t_flag = 0; /* test only, if f_flag is given */ static char *f_flag = NULL; /* Read config info from file */ static int v_flag = 0; /* Be verbose */ @@ -216,26 +217,29 @@ { int c, i; - while ((c = getopt(argc, argv, "Bab:ef:ituv1234")) != -1) + while ((c = getopt(argc, argv, "BIab:f:istuv1234")) != -1) switch (c) { case 'B': B_flag = 1; break; + case 'I': + I_flag = 1; + break; case 'a': a_flag = 1; break; case 'b': b_flag = optarg; break; - case 'e': - e_flag = 1; - break; case 'f': f_flag = optarg; break; case 'i': i_flag = 1; break; + case 's': + s_flag = 1; + break; case 't': t_flag = 1; break; @@ -289,10 +293,31 @@ if(rv < 0) err(1, "cannot open any disk"); } + if (s_flag) + { + int i; + struct dos_partition *partp; + + if (read_s0()) + err(1, "read_s0"); + printf("%s: %d cyl %d hd %d sec\n", disk, dos_cyls, dos_heads, + dos_sectors); + printf("Part %11s %11s Type Flags\n", "Start", "Size"); + for (i = 0; i < NDOSPART; i++) { + partp = ((struct dos_partition *) &mboot.parts) + i; + if (partp->dp_start == 0 && partp->dp_size == 0) + continue; + printf("%4d: %11lu %11lu 0x%02x 0x%02x\n", i + 1, + (u_long) partp->dp_start, + (u_long) partp->dp_size, partp->dp_typ, + partp->dp_flag); + } + exit(0); + } printf("******* Working on device %s *******\n",disk); - if (e_flag) + if (I_flag) { struct dos_partition *partp; @@ -648,7 +673,7 @@ if ( !(st.st_mode & S_IFCHR) ) warnx("device %s is not character special", disk); if ((fd = open(disk, - a_flag || e_flag || B_flag || u_flag ? O_RDWR : O_RDONLY)) == -1) { + a_flag || I_flag || B_flag || u_flag ? O_RDWR : O_RDONLY)) == -1) { if(errno == ENXIO) return -2; warnx("can't open device %s", disk);