Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fdisk Use implicit -F for regular files, much like disk...



details:   https://anonhg.NetBSD.org/src/rev/b44890acc106
branches:  trunk
changeset: 750116:b44890acc106
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Dec 17 14:27:49 2009 +0000

description:
Use implicit -F for regular files, much like disklabel(8).

diffstat:

 sbin/fdisk/fdisk.8 |  9 +++++++--
 sbin/fdisk/fdisk.c |  7 +++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r bc062e681ed6 -r b44890acc106 sbin/fdisk/fdisk.8
--- a/sbin/fdisk/fdisk.8        Thu Dec 17 14:06:38 2009 +0000
+++ b/sbin/fdisk/fdisk.8        Thu Dec 17 14:27:49 2009 +0000
@@ -1,6 +1,6 @@
-.\"    $NetBSD: fdisk.8,v 1.67 2009/12/05 16:29:11 pooka Exp $
+.\"    $NetBSD: fdisk.8,v 1.68 2009/12/17 14:27:49 pooka Exp $
 .\"
-.Dd November 28, 2009
+.Dd December 17, 2009
 .Dt FDISK 8
 .Os
 .Sh NAME
@@ -242,6 +242,11 @@
 will count the 512-byte sectors in
 .Ar device
 and produce a fake geometry.
+If
+.Ar device
+is a regular file,
+.Fl F
+will be used implicitly.
 .It Fl i
 Explicitly request initialisation of the master boot code
 (similar to what
diff -r bc062e681ed6 -r b44890acc106 sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Thu Dec 17 14:06:38 2009 +0000
+++ b/sbin/fdisk/fdisk.c        Thu Dec 17 14:27:49 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdisk.c,v 1.125 2009/11/04 22:25:56 dsl Exp $ */
+/*     $NetBSD: fdisk.c,v 1.126 2009/12/17 14:27:49 pooka Exp $ */
 
 /*
  * Mach Operating System
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.125 2009/11/04 22:25:56 dsl Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.126 2009/12/17 14:27:49 pooka Exp $");
 #endif /* not lint */
 
 #define MBRPTYPENAMES
@@ -438,6 +438,9 @@
                initvar_disk(&disk);
        }
 
+       if (!F_flag && stat(disk, &sb) == 0 && S_ISREG(sb.st_mode))
+               F_flag = 1;
+
        if (open_disk(B_flag || a_flag || i_flag || u_flag) < 0)
                exit(1);
 



Home | Main Index | Thread Index | Old Index