summaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-07-08 18:29:29 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-07-08 18:29:29 +0000
commit9976b83449e683ec2d905b9b86d6a1caf9cbbcec (patch)
tree52da207304517e142f2527a145943c3b44dce515 /sbin/fdisk
parentd3927209ff4aa7da13d774d61c3d0d2be101024e (diff)
set_pid() does not need prompt string, low or high parameters. These
are all constants. Independantly suggested by guenther@.
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/cmd.c4
-rw-r--r--sbin/fdisk/misc.c8
-rw-r--r--sbin/fdisk/misc.h4
3 files changed, 9 insertions, 7 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c
index 7d6fddfa118..ecf02a98326 100644
--- a/sbin/fdisk/cmd.c
+++ b/sbin/fdisk/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.52 2012/07/08 17:46:44 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.53 2012/07/08 18:29:28 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -241,7 +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_pid("Partition id ('0' to disable) ", pp->id, 0, 0xFF);
+ num = ask_pid(pp->id);
if (num != pp->id)
ret = CMD_DIRTY;
diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c
index 81bc99622d8..ec9b69e4a42 100644
--- a/sbin/fdisk/misc.c
+++ b/sbin/fdisk/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.24 2012/07/08 17:46:44 krw Exp $ */
+/* $OpenBSD: misc.c,v 1.25 2012/07/08 18:29:28 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -128,11 +128,12 @@ ask_num(const char *str, int dflt, int low, int high)
}
int
-ask_pid(const char *str, int dflt, int low, int high)
+ask_pid(int dflt)
{
char lbuf[100], *cp;
size_t lbuflen;
int num;
+ const int low = 0, high = 0xff;
if (dflt < low)
dflt = low;
@@ -141,7 +142,8 @@ ask_pid(const char *str, int dflt, int low, int high)
do {
again:
- printf("%s [%X - %X]: [%X] ", str, low, high, dflt);
+ printf("Partition id ('0' to disable) [%X - %X]: [%X] ", low,
+ high, dflt);
printf("(? for help) ");
if (fgets(lbuf, sizeof lbuf, stdin) == NULL)
diff --git a/sbin/fdisk/misc.h b/sbin/fdisk/misc.h
index ebdfe904c94..9564f2abc1d 100644
--- a/sbin/fdisk/misc.h
+++ b/sbin/fdisk/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.13 2012/07/08 17:46:44 krw Exp $ */
+/* $OpenBSD: misc.h,v 1.14 2012/07/08 18:29:28 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -53,7 +53,7 @@ extern struct unit_type unit_types[];
int unit_lookup(char *);
int ask_cmd(cmd_t *);
int ask_num(const char *, int, int, int);
-int ask_pid(const char *, int, int, int);
+int ask_pid(int);
int ask_yn(const char *);
u_int16_t getshort(void *);
u_int32_t getlong(void *);