-
Notifications
You must be signed in to change notification settings - Fork 154
/
util.h
49 lines (44 loc) · 1.51 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef INCLUDE_FM_UTIL_H
#define INCLUDE_FM_UTIL_H
#include <stdbool.h>
#define IS_PRINTABLE(x) (x>=' ' && x<='~')
char *fmu_jsonfilter(const char *s);
const char *fm_argstr(int type);
const char *fm_typestr(int type);
const char *fm_colorstr(int type);
void hexdump(const uint8_t *buf, unsigned int len, int w);
const char * get_proc_name(int pid, int *ppid);
bool is_directory (const char *str);
bool copy_file(const char *src, const char *dst);
/* plain colors */
#define Color_RESET "\x1b[0m"
#define Color_BLACK "\x1b[30m"
#define Color_BGBLACK "\x1b[40m"
#define Color_RED "\x1b[31m"
#define Color_BGRED "\x1b[41m"
#define Color_WHITE "\x1b[37m"
#define Color_BGWHITE "\x1b[47m"
#define Color_GREEN "\x1b[32m"
#define Color_BGGREEN "\x1b[42m"
#define Color_MAGENTA "\x1b[35m"
#define Color_BGMAGENTA "\x1b[45m"
#define Color_YELLOW "\x1b[33m"
#define Color_BGYELLOW "\x1b[43m"
#define Color_CYAN "\x1b[36m"
#define Color_BGCYAN "\x1b[46m"
#define Color_BLUE "\x1b[34m"
#define Color_BGBLUE "\x1b[44m"
#define Color_GRAY "\x1b[38m"
#define Color_BGGRAY "\x1b[48m"
/* bold colors */
#define Color_BBLACK "\x1b[1;30m"
#define Color_BRED "\x1b[1;31m"
#define Color_BBGRED "\x1b[1;41m"
#define Color_BWHITE "\x1b[1;37m"
#define Color_BGREEN "\x1b[1;32m"
#define Color_BMAGENTA "\x1b[1;35m"
#define Color_BYELLOW "\x1b[1;33m"
#define Color_BCYAN "\x1b[1;36m"
#define Color_BBLUE "\x1b[1;34m"
#define Color_BGRAY "\x1b[1;38m"
#endif