1*6f3aa0fcSscole /* $NetBSD: convtbl.h,v 1.2 2016/08/02 17:53:46 scole Exp $ */ 2*6f3aa0fcSscole 3bd7662dcSscole /* 4bd7662dcSscole * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>. 5bd7662dcSscole * All rights reserved. 6bd7662dcSscole * 7bd7662dcSscole * Redistribution and use in source and binary forms, with or without 8bd7662dcSscole * modification, are permitted provided that the following conditions 9bd7662dcSscole * are met: 10bd7662dcSscole * 1. Redistributions of source code must retain the above copyright 11bd7662dcSscole * notice, this list of conditions and the following disclaimer. 12bd7662dcSscole * 2. Redistributions in binary form must reproduce the above copyright 13bd7662dcSscole * notice, this list of conditions and the following disclaimer in the 14bd7662dcSscole * documentation and/or other materials provided with the distribution. 15bd7662dcSscole * 3. The name of the author may not be used to endorse or promote products 16bd7662dcSscole * derived from this software without specific prior written permission. 17bd7662dcSscole * 18bd7662dcSscole * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19bd7662dcSscole * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20bd7662dcSscole * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21bd7662dcSscole * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22bd7662dcSscole * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23bd7662dcSscole * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24bd7662dcSscole * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25bd7662dcSscole * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26bd7662dcSscole * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27bd7662dcSscole * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28bd7662dcSscole * SUCH DAMAGE. 29bd7662dcSscole * 30bd7662dcSscole * $FreeBSD: releng/10.1/usr.bin/systat/convtbl.h 164675 2006-11-27 16:33:44Z yar $ 31bd7662dcSscole */ 32bd7662dcSscole 33bd7662dcSscole #ifndef _CONVTBL_H_ 34bd7662dcSscole #define _CONVTBL_H_ 35bd7662dcSscole 36bd7662dcSscole #include <sys/types.h> 37bd7662dcSscole #include <stdint.h> 38bd7662dcSscole 39bd7662dcSscole /* 40bd7662dcSscole * Keep the order in the enum. 41bd7662dcSscole */ 42bd7662dcSscole enum scale { 43bd7662dcSscole SC_BYTE, 44bd7662dcSscole SC_KILOBYTE, 45bd7662dcSscole SC_MEGABYTE, 46bd7662dcSscole SC_GIGABYTE, 47bd7662dcSscole SC_TERABYTE, 48bd7662dcSscole SC_BIT, 49bd7662dcSscole SC_KILOBIT, 50bd7662dcSscole SC_MEGABIT, 51bd7662dcSscole SC_GIGABIT, 52bd7662dcSscole SC_TERABIT, 53bd7662dcSscole SC_AUTO /* KEEP THIS LAST */ 54bd7662dcSscole }; 55bd7662dcSscole 56bd7662dcSscole extern double convert(const uintmax_t, const int); 57bd7662dcSscole extern const char *get_helplist(void); 58bd7662dcSscole extern int get_scale(const char *); 59bd7662dcSscole extern const char *get_string(const uintmax_t, const int); 60bd7662dcSscole 61bd7662dcSscole #endif /* ! _CONVTBL_H_ */ 62