-
Notifications
You must be signed in to change notification settings - Fork 23
/
common.h
64 lines (51 loc) · 1.48 KB
/
common.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef _HSS_COMMON_H_
#define _HSS_COMMON_H_
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <stdbool.h>
#include <readline/readline.h>
#include <readline/history.h>
#ifndef NOT_USER_COLOR
// RL_PROMPT_START_IGNORE RL_PROMPT_END_IGNORE
#define ANSI_COLOR_RED "\033[0;31m"
#define ANSI_COLOR_GREEN "\033[0;32m"
#define ANSI_COLOR_YELLOW "\033[0;33m"
#define ANSI_COLOR_BLUE "\033[0;34m"
#define ANSI_COLOR_MAGENTA "\033[0;35m"
#define ANSI_COLOR_CYAN "\033[0;36m"
#define ANSI_COLOR_BOLD "\033[1m"
#define ANSI_COLOR_RED_BOLD "\033[1;31m"
#define ANSI_COLOR_GREEN_BOLD "\033[1;31m"
#define ANSI_COLOR_YELLOW_BOLD "\033[1;31m"
#define ANSI_COLOR_BLUE_BOLD "\033[1;31m"
#define ANSI_COLOR_MAGENTA_BOLD "\033[1;31m"
#define ANSI_COLOR_CYAN_BOLD "\033[1;31m"
#define ANSI_COLOR_RESET "\033[0m"
#else
#define ANSI_COLOR_RED
#define ANSI_COLOR_GREEN
#define ANSI_COLOR_YELLOW
#define ANSI_COLOR_BLUE
#define ANSI_COLOR_MAGENTA
#define ANSI_COLOR_CYAN
#define ANSI_COLOR_RESET
#endif
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define SAVE_ERRNO int saved_errno = errno
#define RESTORE_ERRNO errno = saved_errno
extern struct slot *slots;
extern struct hss_config {
bool verbose;
char *user;
int common_options_argc;
const char **common_options_argv;
char *output_file;
int concurrency;
} *pconfig;
extern int stdout_isatty;
#endif //_HSS_COMMON_H_