CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/hcitools/monitor/display.h
Views: 3959
1
/*
2
*
3
* BlueZ - Bluetooth protocol stack for Linux
4
*
5
* Copyright (C) 2011-2012 Intel Corporation
6
* Copyright (C) 2004-2010 Marcel Holtmann <[email protected]>
7
*
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program 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
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
*
23
*/
24
25
#include <stdbool.h>
26
27
bool use_color(void);
28
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;47m"
39
#define COLOR_HIGHLIGHT "\x1B[1;39m"
40
41
#define COLOR_ERROR "\x1B[1;31m"
42
43
#define print_indent(indent, color1, prefix, title, color2, fmt, args...) \
44
do { \
45
printf("%*c%s%s%s%s" fmt "%s\n", (indent), ' ', \
46
use_color() ? (color1) : "", prefix, title, \
47
use_color() ? (color2) : "", ## args, \
48
use_color() ? COLOR_OFF : ""); \
49
} while (0)
50
51
#define print_text(color, fmt, args...) \
52
print_indent(8, COLOR_OFF, "", "", color, fmt, ## args)
53
54
#define print_field(fmt, args...) \
55
print_indent(8, COLOR_OFF, "", "", COLOR_OFF, fmt, ## args)
56
57
int num_columns(void);
58
59
void open_pager(void);
60
void close_pager(void);
61
62