convtbl.c (164672) | convtbl.c (164673) |
---|---|
1/* 2 * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/* 2 * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/usr.bin/systat/convtbl.c 164672 2006-11-27 16:14:32Z yar $ | 28 * $FreeBSD: head/usr.bin/systat/convtbl.c 164673 2006-11-27 16:23:09Z yar $ |
29 */ 30 31#include <sys/types.h> 32#include <stdlib.h> 33#include <string.h> 34#include "convtbl.h" 35 | 29 */ 30 31#include <sys/types.h> 32#include <stdlib.h> 33#include <string.h> 34#include "convtbl.h" 35 |
36struct convtbl convtbl[] = { | 36#define BIT (8) 37#define BYTE (1) 38 39#define BITS (1) 40#define BYTES (1) 41#define KILO (1024LL) 42#define MEGA (KILO * 1024) 43#define GIGA (MEGA * 1024) 44 45struct convtbl { 46 uintmax_t mul; 47 uintmax_t scale; 48 const char *str; 49 const char *name; 50}; 51 52static struct convtbl convtbl[] = { |
37 /* mul, scale, str, name */ 38 [SC_BYTE] = { BYTE, BYTES, "B", "byte" }, 39 [SC_KILOBYTE] = { BYTE, KILO, "KB", "kbyte" }, 40 [SC_MEGABYTE] = { BYTE, MEGA, "MB", "mbyte" }, 41 [SC_GIGABYTE] = { BYTE, GIGA, "GB", "gbyte" }, 42 43 [SC_BIT] = { BIT, BITS, "b", "bit" }, 44 [SC_KILOBIT] = { BIT, KILO, "Kb", "kbit" }, --- 83 unchanged lines hidden --- | 53 /* mul, scale, str, name */ 54 [SC_BYTE] = { BYTE, BYTES, "B", "byte" }, 55 [SC_KILOBYTE] = { BYTE, KILO, "KB", "kbyte" }, 56 [SC_MEGABYTE] = { BYTE, MEGA, "MB", "mbyte" }, 57 [SC_GIGABYTE] = { BYTE, GIGA, "GB", "gbyte" }, 58 59 [SC_BIT] = { BIT, BITS, "b", "bit" }, 60 [SC_KILOBIT] = { BIT, KILO, "Kb", "kbit" }, --- 83 unchanged lines hidden --- |