diff options
author | phk <phk@FreeBSD.org> | 2002-12-11 17:36:34 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-12-11 17:36:34 +0000 |
commit | a3d0cd9e0b8ecfc5ed29e3b719aa7caa78c0be27 (patch) | |
tree | 74b7703758a5f26aee30a0545f6a8cb368be12ba /usr.sbin/sade | |
parent | 04ebe190316153e1c76292c39a70ed32cb76fd1f (diff) | |
download | FreeBSD-src-a3d0cd9e0b8ecfc5ed29e3b719aa7caa78c0be27.zip FreeBSD-src-a3d0cd9e0b8ecfc5ed29e3b719aa7caa78c0be27.tar.gz |
When things get bigger than 99GB our fields run over.
Use GB from 100GB and upwards.
Approved by: re
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r-- | usr.sbin/sade/label.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index 860e16a..fca61c1 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -611,10 +611,18 @@ print_label_chunks(void) if (i == pslice_focus) pslice_focus_found = -1; - mvprintw(srow++, 0, - "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", - label_chunk_info[i].c->disk->name, label_chunk_info[i].c->name, - sz, (sz / ONE_MEG)); + if (sz >= 100 * ONE_GIG) + mvprintw(srow++, 0, + "Disk: %s\tPartition name: %s\tFree: %d blocks (%dGB)", + label_chunk_info[i].c->disk->name, + label_chunk_info[i].c->name, + sz, (sz / ONE_GIG)); + else + mvprintw(srow++, 0, + "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", + label_chunk_info[i].c->disk->name, + label_chunk_info[i].c->name, + sz, (sz / ONE_MEG)); attrset(A_NORMAL); clrtoeol(); move(0, 0); @@ -703,7 +711,14 @@ print_label_chunks(void) strcpy(newfs, "*"); for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++) onestr[PART_MOUNT_COL + j] = mountpoint[j]; - snprintf(num, 10, "%5ldMB", label_chunk_info[i].c->size ? label_chunk_info[i].c->size / ONE_MEG : 0); + if (label_chunk_info[i].c->size == 0) + snprintf(num, 10, "%5ldMB", 0); + else if (label_chunk_info[i].c->size < (100 * ONE_GIG)) + snprintf(num, 10, "%5ldMB", + label_chunk_info[i].c->size / ONE_MEG); + else + snprintf(num, 10, "%5ldGB", + label_chunk_info[i].c->size / ONE_GIG); memcpy(onestr + PART_SIZE_COL, num, strlen(num)); memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs)); onestr[PART_NEWFS_COL + strlen(newfs)] = '\0'; |