1 #define _LARGEFILE64_SOURCE     /* required for GLIBC to enable stat64 and friends */
2 #include <regex.h>
3 #include <string.h>
4 #include <time.h>
5 #include <unistd.h>
6 #include <netinet/in.h>
7 #include <sys/socket.h>
8 #include <sys/stat.h>
9 #include <sys/types.h>
10 
11 #include "mt.h"
12 #include "mem.h"
13 
14 NEWWIN **splitlines = NULL;
15 NEWWIN *menu_win = NULL;
16 buffer *lb = NULL;
17 char *config_file = NULL;
18 char *mail_spool_file = NULL;
19 char *nsubwindows = NULL;
20 char *set_title = NULL;
21 char *shell = NULL;
22 char *tail = NULL;
23 char *ts_format = NULL;
24 char *statusline_ts_format = NULL;
25 char *syslog_ts_format = NULL;
26 char *cnv_ts_format = NULL;
27 char *line_ts_format = NULL;
28 char *window_number = NULL;
29 char *subwindow_number = NULL;
30 char **color_names = NULL;
31 char *replace_by_markerline = NULL;
32 const char *F1 = "For help at any time press F1.";
33 int *n_win_per_col = NULL;
34 int *vertical_split = NULL;
35 color_scheme *cschemes = NULL;
36 const char *version_str = " --*- multitail " VERSION " (C) 2003-2019 by folkert@vanheusden.com -*--";
37 conversion *conversions = NULL;
38 keybinding *keybindings = NULL;
39 pars_per_file *ppf = NULL;
40 proginfo *pi = NULL;
41 check_dir_glob *cdg = NULL;
42 int n_cdg = 0;
43 editscheme *pes = NULL;
44 int n_es = 0;
45 char *defaultcscheme = NULL;
46 proginfo *terminal_index = NULL;
47 char *global_find = NULL;
48 
49 int terminal_main_index = -1;
50 int default_color_scheme = -1;
51 int max_y, max_x;
52 int min_n_bufferlines = -1;
53 int mode_statusline = 1;
54 int n_children = 0;
55 int n_conversions = 0;
56 int n_cschemes = 0;
57 int n_keybindings = 0;
58 int n_pars_per_file = 0;
59 int n_splitlines = 0;
60 int nfd = 0;
61 int update_interval = 0;
62 int n_colors_defined = 0;
63 int check_for_mail = 5;	/* check for mail every 5 seconds */
64 int default_maxnlines = 0;
65 int default_maxbytes = 0;
66 int popup_refresh_interval = 5; /* every 5 seconds */
67 int default_line_wrap_offset = 0;
68 int inverse_attrs = A_REVERSE;
69 int beep_interval = -1;
70 int linecounter_for_beep = 0;
71 int did_n_beeps = 0;
72 int default_min_shrink = 10;
73 int wordwrapmaxlength = 10;
74 int default_bg_color = -1;
75 int total_wakeups = 0;
76 int split = 0;
77 int syslog_port = 514;
78 
79 double heartbeat_interval = 0.0;
80 double heartbeat_t = 0.0;
81 off64_t msf_prev_size = 0;
82 
83 dtime_t msf_last_check = 0;
84 dtime_t mt_started;
85 
86 pid_t children_list[MAX_N_SPAWNED_PROCESSES];
87 pid_t tail_proc = 0;	/* process used by checker-proc */
88 struct stat64 msf_info;
89 term_t term_type = TERM_IGNORE;
90 myattr_t markerline_attrs = { -1, -1 };
91 myattr_t changeline_attrs = { -1, -1 };
92 myattr_t idleline_attrs   = { -1, -1 };
93 myattr_t msgline_attrs    = { -1, -1 };
94 myattr_t statusline_attrs = { -1, -1 };
95 myattr_t splitline_attrs  = { -1, -1 };
96 colorpairs cp;
97 mode_t def_umask = 0022;
98 history_t search_h = { NULL, 0, NULL };
99 history_t cmdfile_h = { NULL, 0, NULL };
100 mybool_t re_case_insensitive = MY_FALSE;
101 chtype box_bottom_left_hand_corner=0;
102 chtype box_bottom_right_hand_corner=0;
103 chtype box_bottom_side=0;
104 chtype box_left_side=0;
105 chtype box_right_side=0;
106 chtype box_top_left_hand_corner=0;
107 chtype box_top_right_hand_corner=0;
108 chtype box_top_side=0;
109 
110 beeb_t beep_method = BEEP_BEEP;
111 double beep_popup_length = 0.0;
112 
113 char afs = 0;	/* abbreviate filesize */
114 char allow_8bit = 0; /* allow 8 bits ascii*/
115 char banner = 1;
116 char bright_colors = 0;
117 char do_refresh = 0;
118 char filename_only = 0;
119 char got_sigusr1 = 0;
120 char mail = 0;
121 char no_linewrap = 0;
122 char prev_term_char = -1;
123 char show_subwindow_id = 0;
124 char tab_width = 4;		/* some people use 8 */
125 char terminal_changed = 0;
126 char timestamp_in_markerline = 0;
127 char use_colors = 0;
128 char warn_closed = 1;
129 char caret_notation = 0;
130 char statusline_above_data = 0;
131 char global_marker_of_other_window = 0;
132 char markerline_char = '-';
133 char changeline_char = '-';
134 char idleline_char   = '-';
135 char msgline_char   = '-';
136 char default_bufferwhat = 'f';
137 char load_global_config = 1;
138 char default_linewrap = 'a';
139 char default_follow_filename = 0;
140 char do_not_close_closed_windows = 0;
141 char suppress_empty_lines = 1;
142 char splitline_mode = SL_REGULAR;
143 char abort_key = 7;
144 char exit_key = 3;
145 char default_sb_showwinnr = 0;
146 char reuse_searchstring = 1;
147 char need_died_procs_check = 0;
148 char scrollback_fullscreen_default = 0;
149 char scrollback_no_colors = 0;
150 char scrollback_search_new_window = 1;
151 mybool_t posix_tail = 0;
152 mybool_t resolv_ip_addresses = 1;
153 mybool_t show_severity_facility = 1;
154 mybool_t gnu_tail = 0;
155 mybool_t map_delete_as_backspace = MY_FALSE;
156 
157 regex_t global_highlight_re;
158 char *global_highlight_str = NULL;
159 
160 filterscheme *pfs = NULL;
161 int n_fs = 0;
162 
163 char *sigs[] = { NULL, "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT/SIGIOT", "SIGIOT", "SIGBUS", "SIGFPE", "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO/SIGPOLL", "SIGPWR", "SIGSYS/SIGUNUSED" };
164 int n_known_sigs = 32;
165 char *severities[8] = { "emerg", "alert", "crit", "err", "warning", "notice", "info", "debug" };
166 char *facilities[24] = { "kern", "user", "mail", "daemon", "auth", "syslog", "lpr", "news", "uucp", "cron", "authpriv", "ftp", "?", "?", "?", "?", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7" };
167 
set_do_refresh(char val)168 void set_do_refresh(char val)
169 {
170 	do_refresh = val;
171 }
172 
get_do_refresh()173 char get_do_refresh()
174 {
175 	return do_refresh;
176 }
177