aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2023-12-04 07:01:56 -0600
committerRob Landley <rob@landley.net>2023-12-04 07:01:56 -0600
commit82f62a8d86a19b91cff1e264e144dd695784843c (patch)
tree26fbc6726ff2ddb5ba01e8f76833749d0f9566b8
parent992a1071e5d75e3311ccf6ccce9c2d17be157115 (diff)
downloadtoybox-82f62a8d86a19b91cff1e264e144dd695784843c.tar.gz
Minor cleanup.
-rw-r--r--toys/other/blkid.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/toys/other/blkid.c b/toys/other/blkid.c
index 951f8487..e78f20d8 100644
--- a/toys/other/blkid.c
+++ b/toys/other/blkid.c
@@ -197,17 +197,14 @@ static void do_blkid(int fd, char *name)
if (!strcmp(type, "ntfs")) {
for (j = 7; j >= 0; --j) s += sprintf(s, "%02X", toybuf[uoff+j]);
} else if (!strcmp(type, "vfat")) {
- s += sprintf(s, "%02X%02X-%02X%02X", toybuf[uoff+3], toybuf[uoff+2],
- toybuf[uoff+1], toybuf[uoff]);
+ s += sprintf(s, "%02X%02X-%02X%02X", toybuf[uoff+3], toybuf[uoff+2],
+ toybuf[uoff+1], toybuf[uoff]);
} else if (!strcmp(type, "iso9660")) {
- s += sprintf(s, "%c%c%c%c-", toybuf[uoff], toybuf[uoff+1],
- toybuf[uoff+2], toybuf[uoff+3]);
- s += sprintf(s, "%c%c-", toybuf[uoff+4], toybuf[uoff+5]);
- s += sprintf(s, "%c%c-", toybuf[uoff+6], toybuf[uoff+7]);
- s += sprintf(s, "%c%c-", toybuf[uoff+8], toybuf[uoff+9]);
- s += sprintf(s, "%c%c-", toybuf[uoff+10], toybuf[uoff+11]);
- s += sprintf(s, "%c%c-", toybuf[uoff+12], toybuf[uoff+13]);
- s += sprintf(s, "%c%c", toybuf[uoff+14], toybuf[uoff+15]);
+ s = stpncpy(s, toybuf+uoff, 4);
+ for (i = 0, uoff += 4; i<12; i++) {
+ if (!(i&1)) *s++ = '-';
+ *s++ = toybuf[uoff++];
+ }
} else {
for (j = 0; j < 16; j++)
s += sprintf(s, "-%02x"+!(0x550 & (1<<j)), toybuf[uoff+j]);