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