summaryrefslogtreecommitdiff
path: root/sbin/fdisk/cmd.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-07-08 17:46:45 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-07-08 17:46:45 +0000
commit1416753cd220ebfd02ade01e94570b11fd6d1816 (patch)
tree1b502de55916ada3567220f421e9bf7446226a9a /sbin/fdisk/cmd.c
parentc4db1c74a810e872f25999b27dc35359ad1eccd0 (diff)
Split out an ask_pid() function rather than over-parameterizing the
ask_num() function. Remove now unneeded 'flags' and 'help' parameters from both. Display out of range values in hex in ask_pid(), since we are seeking hex input. ok guenther@
Diffstat (limited to 'sbin/fdisk/cmd.c')
-rw-r--r--sbin/fdisk/cmd.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c
index d20ac3e1708..7d6fddfa118 100644
--- a/sbin/fdisk/cmd.c
+++ b/sbin/fdisk/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.51 2012/07/08 12:29:04 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.52 2012/07/08 17:46:44 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -82,12 +82,12 @@ Xdisk(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset)
/* Ask for new info */
if (ask_yn("Change disk geometry?")) {
- disk->real->cylinders = ask_num("BIOS Cylinders", ASK_DEC,
- disk->real->cylinders, 1, maxcyl, NULL);
- disk->real->heads = ask_num("BIOS Heads", ASK_DEC,
- disk->real->heads, 1, maxhead, NULL);
- disk->real->sectors = ask_num("BIOS Sectors", ASK_DEC,
- disk->real->sectors, 1, maxsec, NULL);
+ disk->real->cylinders = ask_num("BIOS Cylinders",
+ disk->real->cylinders, 1, maxcyl);
+ disk->real->heads = ask_num("BIOS Heads",
+ disk->real->heads, 1, maxhead);
+ disk->real->sectors = ask_num("BIOS Sectors",
+ disk->real->sectors, 1, maxsec);
disk->real->size = disk->real->cylinders * disk->real->heads
* disk->real->sectors;
@@ -112,8 +112,7 @@ Xswap(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset)
return (ret);
}
- pt = ask_num("Swap with what partition?", ASK_DEC,
- -1, 0, 3, NULL);
+ pt = ask_num("Swap with what partition?", -1, 0, 3);
if (pt < 0 || pt > 3) {
printf("Invalid partition number %d.\n", pt);
return (ret);
@@ -152,7 +151,7 @@ Xedit(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset)
ret = Xsetpid(cmd, disk, mbr, tt, offset);
#define EDIT(p, v, n, m) \
- if ((num = ask_num(p, ASK_DEC, v, n, m, NULL)) != v) \
+ if ((num = ask_num(p, v, n, m)) != v) \
ret = CMD_DIRTY; \
v = num;
@@ -242,8 +241,7 @@ Xsetpid(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset)
PRT_print(pn, pp, NULL);
/* Ask for partition type */
- num = ask_num("Partition id ('0' to disable) ", ASK_HEX, pp->id, 0,
- 0xFF, PRT_printall);
+ num = ask_pid("Partition id ('0' to disable) ", pp->id, 0, 0xFF);
if (num != pp->id)
ret = CMD_DIRTY;