summaryrefslogtreecommitdiff
path: root/sbin/fdisk/misc.h
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2002-01-18 08:38:27 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2002-01-18 08:38:27 +0000
commit7598f41630e91a2ab9de9e4ef1f14f7f1e311e40 (patch)
treecfac9ede494d0071811937f4993f29e30d4a47ac /sbin/fdisk/misc.h
parent3e97ac4c2b74886909fff64ecfda1d924d59d547 (diff)
Allow size values to be displayed in the user's choice of units.
Idea borrowed from disklabel. i.e. Users can now type "print M" and be rewarded with partition sizes in Megs
Diffstat (limited to 'sbin/fdisk/misc.h')
-rw-r--r--sbin/fdisk/misc.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/sbin/fdisk/misc.h b/sbin/fdisk/misc.h
index 92e82e83a42..3a17487321e 100644
--- a/sbin/fdisk/misc.h
+++ b/sbin/fdisk/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.5 2002/01/18 08:33:10 kjell Exp $ */
+/* $OpenBSD: misc.h,v 1.6 2002/01/18 08:38:26 kjell Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -34,15 +34,33 @@
#define _MISC_H
#include <sys/types.h>
+#include <machine/param.h>
#include "cmd.h"
+/* typedefs */
+
+static const struct unit_type {
+ char *abbr;
+ int conversion;
+ char *lname;
+} unit_types[] = {
+ {"b", 1 , "Bytes"},
+ {" ", DEV_BSIZE , "Sectors"},
+ {"K", 1024 , "Kilobytes"},
+ {"M", 1024 * 1024 , "Megabytes"},
+ {"G", 1024 * 1024 *1024 , "Gigabytes"},
+ {NULL, 0 , NULL },
+};
+
/* Constants */
#define ASK_HEX 0x01
#define ASK_DEC 0x02
+#define UNIT_TYPE_DEFAULT 1
#define DO_CONVERSIONS 0x00000001
#define DO_ROUNDING 0x00000002
/* Prototypes */
+int unit_lookup __P((char *));
int ask_cmd __P((cmd_t *));
int ask_num __P((const char *, int, int, int, int, void (*help) __P((void))));
int ask_yn __P((const char *));