[NTOS]: Start using colored pages. This will help performance on real systems signifi...
[reactos.git] / base / applications / network / telnet / src / tnconfig.h
1 // Tnconfig.h
2 // Written by Paul Brannan <pbranna@clemson.edu>
3 //
4 // This is a class designed for use with Brad Johnson's Console Telnet
5 // It reads an ini file and keeps the settings for later retrieval.
6 // It does not store any information about the current settings, only default
7 // or recommended settings.
8
9 #pragma once
10
11 // Ioannou 2 June 98: Borland needs them - quick hack
12 #ifdef __BORLANDC__
13 #define bool BOOL
14 #define true TRUE
15 #define false FALSE
16 #endif // __BORLANDC__
17
18 #include "tnerror.h"
19
20 #define ENV_TELNET_CFG "TELNET_CFG"
21 #define ENV_TELNET_REDIR "TELNET_REDIR"
22 #define ENV_INPUT_REDIR "TELNET_INPUT_REDIR"
23 #define ENV_OUTPUT_REDIR "TENLET_OUTPUT_REDIR"
24 #define ENV_TELNET_INI "TELNET_INI"
25
26 class TConfig {
27 public:
28 TConfig();
29 ~TConfig();
30
31 // Miscellaneous strings
32 const char *get_startdir() const {return startdir;}
33 const char *get_exename() const {return exename;}
34 const char *get_keyfile() const {return keyfile;}
35 const char *get_inifile() const {return inifile;}
36 const char *get_dumpfile() const {return dumpfile;}
37 const char *get_term() const {return term;}
38 const char *get_printer_name() const {return printer_name;}
39 const char *get_default_config() const {return default_config;}
40
41 // Terminal settings
42 int get_input_redir() const {return input_redir;}
43 int get_output_redir() const {return output_redir;}
44 bool get_strip_redir() const {return strip_redir;}
45 bool get_dstrbksp() const {return dstrbksp;}
46 bool get_eightbit_ansi() const {return eightbit_ansi;}
47 bool get_vt100_mode() const {return vt100_mode;}
48 bool get_disable_break() const {return disable_break;}
49 bool get_speaker_beep() const {return speaker_beep;}
50 bool get_do_beep() const {return do_beep;}
51 bool get_preserve_colors() const {return preserve_colors;}
52 bool get_wrapline() const {return wrapline;}
53 bool get_fast_write() const {return fast_write;}
54 bool get_lock_linewrap() const {return lock_linewrap;}
55 bool get_set_title() const { return set_title;}
56 int get_term_width() const {return term_width;}
57 int get_term_height() const {return term_height;}
58 int get_window_width() const {return window_width;}
59 int get_window_height() const {return window_height;}
60 bool get_wide_enable() const {return wide_enable;}
61 bool get_control_break_as_c() const {return ctrlbreak_as_ctrlc;}
62 int get_buffer_size() const {return buffer_size;}
63
64 // Colors
65 int get_blink_bg() const {return blink_bg;}
66 int get_blink_fg() const {return blink_fg;}
67 int get_underline_bg() const {return underline_bg;}
68 int get_underline_fg() const {return underline_fg;}
69 int get_ulblink_bg() const {return ulblink_bg;}
70 int get_ulblink_fg() const {return ulblink_fg;}
71 int get_normal_bg() const {return normal_bg;}
72 int get_normal_fg() const {return normal_fg;}
73 int get_scroll_bg() const {return scroll_bg;}
74 int get_scroll_fg() const {return scroll_fg;}
75 int get_status_bg() const {return status_bg;}
76 int get_status_fg() const {return status_fg;}
77
78 // Mouse
79 bool get_enable_mouse() const {return enable_mouse;}
80
81 // Keyboard
82 char get_escape_key() const {return escape_key[0];}
83 char get_scrollback_key() const {return scrollback_key[0];}
84 char get_dial_key() const {return dial_key[0];}
85 bool get_alt_erase() const {return alt_erase;}
86 bool get_keyboard_paste() const {return keyboard_paste;}
87
88 // Scrollback
89 const char *get_scroll_mode() const {return scroll_mode;}
90 bool get_scroll_enable() const {return scroll_enable;}
91 int get_scroll_size() const {return scroll_size;}
92
93 // Scripting
94 const char *get_scriptname() const {return scriptname;}
95 bool get_script_enable() const {return script_enable;}
96
97 // Pipes
98 const char *get_netpipe() const {return netpipe;}
99 const char *get_iopipe() const {return iopipe;}
100
101 // Host configuration
102 const char *get_host() const {return host;}
103 const char *get_port() const {return port;}
104
105 // Initialization
106 void init(char *dirname, char *exename);
107 bool Process_Params(int argc, char *argv[]);
108
109 // Ini variables
110 void print_vars();
111 void print_vars(char *s);
112 void print_groups();
113 bool set_value(const char *var, const char *value);
114 int print_value(const char *var);
115
116 // Aliases
117 void print_aliases();
118 bool find_alias(const char *alias_name);
119
120 private:
121
122 void inifile_init();
123 void keyfile_init();
124 void redir_init();
125 void init_varlist();
126 void init_vars();
127 void init_aliases();
128 void set_string(char *dest, const char *src, const int length);
129 void set_bool(bool *boolval, const char *str);
130
131 // Miscellaneous strings
132 char startdir[MAX_PATH];
133 char exename[MAX_PATH];
134 char keyfile[MAX_PATH*2];
135 char inifile[MAX_PATH*2];
136 char dumpfile[MAX_PATH*2];
137 char printer_name[MAX_PATH*2];
138 char term[128];
139 char default_config[128];
140
141 // Terminal
142 int input_redir, output_redir;
143 bool strip_redir;
144 bool dstrbksp;
145 bool eightbit_ansi;
146 bool vt100_mode;
147 bool disable_break;
148 bool speaker_beep;
149 bool do_beep;
150 bool preserve_colors;
151 bool wrapline;
152 bool lock_linewrap;
153 bool fast_write;
154 bool set_title;
155 int term_width, term_height;
156 int window_width, window_height;
157 bool wide_enable;
158 bool ctrlbreak_as_ctrlc;
159 int buffer_size;
160
161 // Colors
162 int blink_bg;
163 int blink_fg;
164 int underline_bg;
165 int underline_fg;
166 int ulblink_bg;
167 int ulblink_fg;
168 int normal_bg;
169 int normal_fg;
170 int scroll_bg;
171 int scroll_fg;
172 int status_bg;
173 int status_fg;
174
175 // Mouse
176 bool enable_mouse;
177
178 // Keyboard
179 char escape_key[2];
180 char scrollback_key[2];
181 char dial_key[2];
182 bool alt_erase;
183 bool keyboard_paste;
184
185 // Scrollback
186 char scroll_mode[8];
187 bool scroll_enable;
188 int scroll_size;
189
190 // Scripting
191 char scriptname[MAX_PATH*2];
192 bool script_enable;
193
194 // Pipes
195 char netpipe[MAX_PATH*2];
196 char iopipe[MAX_PATH*2];
197
198 // Host configration
199 char host[128];
200 const char *port;
201
202 // Aliases
203 char **aliases;
204 int alias_total;
205
206 };
207
208 extern TConfig ini;