diff options
Diffstat (limited to 'sbin/fdisk/cmd.c')
-rw-r--r-- | sbin/fdisk/cmd.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index db341992bdc..2bbfbfe9230 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.26 2000/07/01 21:49:12 mickey Exp $ */ +/* $OpenBSD: cmd.c,v 1.27 2001/01/01 21:05:33 angelos Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -193,6 +193,46 @@ Xedit(cmd, disk, mbr, tt, offset) } int +Xsetpid(cmd, disk, mbr, tt, offset) + cmd_t *cmd; + disk_t *disk; + mbr_t *mbr; + mbr_t *tt; + int offset; +{ + int pn, num, ret; + prt_t *pp; + + ret = CMD_CONT; + + if (!isdigit(cmd->args[0])) { + printf("Invalid argument: %s <partition number>\n", cmd->cmd); + return (ret); + } + pn = atoi(cmd->args); + + if (pn < 0 || pn > 3) { + printf("Invalid partition number.\n"); + return (ret); + } + + /* Print out current table entry */ + pp = &mbr->part[pn]; + PRT_print(0, NULL); + PRT_print(pn, pp); + +#define EDIT(p, f, v, n, m, h) \ + if ((num = ask_num(p, f, v, n, m, h)) != v) \ + ret = CMD_DIRTY; \ + v = num; + + /* Ask for partition type */ + EDIT("Partition id ('0' to disable) ", ASK_HEX, pp->id, 0, 0xFF, PRT_printall); + +#undef EDIT + return (ret); +} +int Xselect(cmd, disk, mbr, tt, offset) cmd_t *cmd; disk_t *disk; |