mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-16 07:24:47 +08:00
71 lines
2.2 KiB
C
71 lines
2.2 KiB
C
/*
|
|
*
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
*
|
|
* Copyright (C) 2011-2014 Intel Corporation
|
|
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
|
*
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
|
|
bool use_color(void);
|
|
|
|
#define COLOR_OFF "\x1B[0m"
|
|
#define COLOR_BLACK "\x1B[0;30m"
|
|
#define COLOR_RED "\x1B[0;31m"
|
|
#define COLOR_GREEN "\x1B[0;32m"
|
|
#define COLOR_YELLOW "\x1B[0;33m"
|
|
#define COLOR_BLUE "\x1B[0;34m"
|
|
#define COLOR_MAGENTA "\x1B[0;35m"
|
|
#define COLOR_CYAN "\x1B[0;36m"
|
|
#define COLOR_WHITE "\x1B[0;37m"
|
|
#define COLOR_WHITE_BG "\x1B[0;47;30m"
|
|
#define COLOR_HIGHLIGHT "\x1B[1;39m"
|
|
|
|
#define COLOR_RED_BOLD "\x1B[1;31m"
|
|
#define COLOR_GREEN_BOLD "\x1B[1;32m"
|
|
#define COLOR_BLUE_BOLD "\x1B[1;34m"
|
|
#define COLOR_MAGENTA_BOLD "\x1B[1;35m"
|
|
|
|
#define COLOR_ERROR "\x1B[1;31m"
|
|
#define COLOR_WARN "\x1B[1m"
|
|
#define COLOR_INFO COLOR_OFF
|
|
#define COLOR_DEBUG COLOR_WHITE
|
|
|
|
#define FALLBACK_TERMINAL_WIDTH 80
|
|
|
|
#define print_indent(indent, color1, prefix, title, color2, fmt, args...) \
|
|
do { \
|
|
printf("%*c%s%s%s%s" fmt "%s\n", (indent), ' ', \
|
|
use_color() ? (color1) : "", prefix, title, \
|
|
use_color() ? (color2) : "", ## args, \
|
|
use_color() ? COLOR_OFF : ""); \
|
|
} while (0)
|
|
|
|
#define print_text(color, fmt, args...) \
|
|
print_indent(8, COLOR_OFF, "", "", color, fmt, ## args)
|
|
|
|
#define print_field(fmt, args...) \
|
|
print_indent(8, COLOR_OFF, "", "", COLOR_OFF, fmt, ## args)
|
|
|
|
int num_columns(void);
|
|
|
|
void open_pager(void);
|
|
void close_pager(void);
|