3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2011-2014 Intel Corporation
6 * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #define COLOR_OFF "\x1B[0m"
30 #define COLOR_BLACK "\x1B[0;30m"
31 #define COLOR_RED "\x1B[0;31m"
32 #define COLOR_GREEN "\x1B[0;32m"
33 #define COLOR_YELLOW "\x1B[0;33m"
34 #define COLOR_BLUE "\x1B[0;34m"
35 #define COLOR_MAGENTA "\x1B[0;35m"
36 #define COLOR_CYAN "\x1B[0;36m"
37 #define COLOR_WHITE "\x1B[0;37m"
38 #define COLOR_WHITE_BG "\x1B[0;47;30m"
39 #define COLOR_HIGHLIGHT "\x1B[1;39m"
41 #define COLOR_ERROR "\x1B[1;31m"
42 #define COLOR_WARN "\x1B[1m"
43 #define COLOR_INFO COLOR_OFF
44 #define COLOR_DEBUG COLOR_WHITE
46 #define FALLBACK_TERMINAL_WIDTH 80
48 #define print_indent(indent, color1, prefix, title, color2, fmt, args...) \
50 printf("%*c%s%s%s%s" fmt "%s\n", (indent), ' ', \
51 use_color() ? (color1) : "", prefix, title, \
52 use_color() ? (color2) : "", ## args, \
53 use_color() ? COLOR_OFF : ""); \
56 #define print_text(color, fmt, args...) \
57 print_indent(8, COLOR_OFF, "", "", color, fmt, ## args)
59 #define print_field(fmt, args...) \
60 print_indent(8, COLOR_OFF, "", "", COLOR_OFF, fmt, ## args)
62 int num_columns(void);
64 void open_pager(void);
65 void close_pager(void);