summaryrefslogtreecommitdiff
path: root/sbin/disklabel
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2010-09-23 13:54:22 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2010-09-23 13:54:22 +0000
commit7fdd2f645f69259da6f3791bd23898d143e7391a (patch)
treef38cc4c3bc72b45a4fa4bb459142896610244be2 /sbin/disklabel
parent7220b65bf7241f5d37425a848327e4e14be63387 (diff)
Print disklabel UIDs using printf/fprintf instead of using the hand rolled
uid_print() function. ok krw@
Diffstat (limited to 'sbin/disklabel')
-rw-r--r--sbin/disklabel/disklabel.c19
-rw-r--r--sbin/disklabel/editor.c9
-rw-r--r--sbin/disklabel/extern.h3
3 files changed, 10 insertions, 21 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 7414d285141..a82360c05a6 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.171 2010/08/12 23:32:07 tedu Exp $ */
+/* $OpenBSD: disklabel.c,v 1.172 2010/09/23 13:54:21 jsing Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -773,9 +773,9 @@ display(FILE *f, struct disklabel *lp, char unit, int all)
lp->d_typename);
fprintf(f, "label: %.*s\n", (int)sizeof(lp->d_packname),
lp->d_packname);
- fprintf(f, "uid: ");
- uid_print(f, lp);
- fprintf(f, "\n");
+ fprintf(f, "uid: %02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx\n",
+ lp->d_uid[0], lp->d_uid[1], lp->d_uid[2], lp->d_uid[3],
+ lp->d_uid[4], lp->d_uid[5], lp->d_uid[6], lp->d_uid[7]);
fprintf(f, "flags:");
if (lp->d_flags & D_BADSECT)
fprintf(f, " badsect");
@@ -974,17 +974,6 @@ getnum(char *nptr, u_int64_t min, u_int64_t max, const char **errstr)
return (ret);
}
-void
-uid_print(FILE *f, struct disklabel *lp)
-{
- char hex[] = "0123456789abcdef";
- int i;
-
- for (i = 0; i < sizeof(lp->d_uid); i++)
- fprintf(f, "%c%c", hex[(lp->d_uid[i] >> 4) & 0xf],
- hex[lp->d_uid[i] & 0xf]);
-}
-
int
uid_parse(struct disklabel *lp, char *s)
{
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index a3349e30279..e84e2b67c91 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.244 2010/08/12 23:32:07 tedu Exp $ */
+/* $OpenBSD: editor.c,v 1.245 2010/09/23 13:54:21 jsing Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -1619,9 +1619,10 @@ set_uid(struct disklabel *lp)
char *s;
int i;
- printf("The disklabel UID is currently: ");
- uid_print(stdout, lp);
- printf("\n");
+ printf("The disklabel UID is currently: "
+ "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx\n",
+ lp->d_uid[0], lp->d_uid[1], lp->d_uid[2], lp->d_uid[3],
+ lp->d_uid[4], lp->d_uid[5], lp->d_uid[6], lp->d_uid[7]);
do {
s = getstring("uid", "The disklabel UID, given as a 16 "
diff --git a/sbin/disklabel/extern.h b/sbin/disklabel/extern.h
index 02230f3704d..0b134391b04 100644
--- a/sbin/disklabel/extern.h
+++ b/sbin/disklabel/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.19 2010/08/12 23:32:07 tedu Exp $ */
+/* $OpenBSD: extern.h,v 1.20 2010/09/23 13:54:21 jsing Exp $ */
/*
* Copyright (c) 2003 Theo de Raadt <deraadt@openbsd.org>
@@ -25,7 +25,6 @@ char canonical_unit(struct disklabel *, char);
double scale(u_int64_t, char, struct disklabel *);
void display(FILE *, struct disklabel *, char, int);
void display_partition(FILE *, struct disklabel *, int, char);
-void uid_print(FILE *, struct disklabel *);
int uid_parse(struct disklabel *, char *);
void readlabel(int);