-/* $OpenBSD: cmd.c,v 1.111 2021/06/11 14:02:22 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.112 2021/06/11 16:22:46 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
int reinited;
int gedit(int);
+int edit(int, struct mbr *);
int gsetpid(int);
+int setpid(int, struct mbr *);
int parsepn(char *);
int
}
int
-Xedit(char *args, struct mbr *mbr)
+edit(int pn, struct mbr *mbr)
{
struct prt oldpp;
struct prt *pp;
- int pn;
-
- pn = parsepn(args);
- if (pn == -1)
- return (CMD_CONT);
-
- if (letoh64(gh.gh_sig) == GPTSIGNATURE)
- return (gedit(pn));
pp = &mbr->part[pn];
oldpp = *pp;
- Xsetpid(args, mbr);
+ setpid(pn, mbr);
if (pp->id == DOSPTYP_UNUSED) {
if (oldpp.id != DOSPTYP_UNUSED) {
memset(pp, 0, sizeof(*pp));
return (CMD_CONT);
}
+int
+Xedit(char *args, struct mbr *mbr)
+{
+ int pn;
+
+ pn = parsepn(args);
+ if (pn == -1)
+ return (CMD_CONT);
+
+ if (letoh64(gh.gh_sig) == GPTSIGNATURE)
+ return (gedit(pn));
+ else
+ return (edit(pn, mbr));
+}
+
int
gsetpid(int pn)
{
}
int
-Xsetpid(char *args, struct mbr *mbr)
+setpid(int pn, struct mbr *mbr)
{
struct prt *pp;
- int pn, num;
-
- pn = parsepn(args);
- if (pn == -1)
- return (CMD_CONT);
-
- if (letoh64(gh.gh_sig) == GPTSIGNATURE)
- return (gsetpid(pn));
+ int num;
pp = &mbr->part[pn];
return (CMD_DIRTY);
}
+int
+Xsetpid(char *args, struct mbr *mbr)
+{
+ int pn;
+
+ pn = parsepn(args);
+ if (pn == -1)
+ return (CMD_CONT);
+
+ if (letoh64(gh.gh_sig) == GPTSIGNATURE)
+ return (gsetpid(pn));
+ else
+ return (setpid(pn, mbr));
+}
+
int
Xselect(char *args, struct mbr *mbr)
{