ReactOS 0.4.16-dev-311-g9382aa2
tnconfig.h
Go to the documentation of this file.
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
26class TConfig {
27public:
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;}
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
120private:
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
138 char term[128];
139 char default_config[128];
140
141 // Terminal
160
161 // Colors
174
175 // Mouse
177
178 // Keyboard
179 char escape_key[2];
181 char dial_key[2];
184
185 // Scrollback
186 char scroll_mode[8];
189
190 // Scripting
193
194 // Pipes
197
198 // Host configration
199 char host[128];
200 const char *port;
201
202 // Aliases
203 char **aliases;
205
206};
207
208extern TConfig ini;
static int argc
Definition: ServiceArgs.c:12
int blink_fg
Definition: tnconfig.h:163
bool get_script_enable() const
Definition: tnconfig.h:95
int underline_fg
Definition: tnconfig.h:165
int ulblink_bg
Definition: tnconfig.h:166
const char * get_exename() const
Definition: tnconfig.h:33
int blink_bg
Definition: tnconfig.h:162
void print_groups()
Definition: tnconfig.cpp:426
int get_normal_fg() const
Definition: tnconfig.h:72
int get_scroll_size() const
Definition: tnconfig.h:91
bool get_keyboard_paste() const
Definition: tnconfig.h:86
int get_term_height() const
Definition: tnconfig.h:57
bool get_strip_redir() const
Definition: tnconfig.h:44
void set_string(char *dest, const char *src, const int length)
Definition: tnconfig.cpp:682
char host[128]
Definition: tnconfig.h:199
int normal_fg
Definition: tnconfig.h:169
bool dstrbksp
Definition: tnconfig.h:144
bool alt_erase
Definition: tnconfig.h:182
const char * get_printer_name() const
Definition: tnconfig.h:38
int get_output_redir() const
Definition: tnconfig.h:43
bool get_lock_linewrap() const
Definition: tnconfig.h:54
char startdir[MAX_PATH]
Definition: tnconfig.h:132
TConfig()
Definition: tnconfig.cpp:47
bool eightbit_ansi
Definition: tnconfig.h:145
~TConfig()
Definition: tnconfig.cpp:115
bool lock_linewrap
Definition: tnconfig.h:152
bool disable_break
Definition: tnconfig.h:147
void init_vars()
Definition: tnconfig.cpp:515
bool get_vt100_mode() const
Definition: tnconfig.h:47
bool set_value(const char *var, const char *value)
Definition: tnconfig.cpp:442
char escape_key[2]
Definition: tnconfig.h:179
int get_status_bg() const
Definition: tnconfig.h:75
const char * get_scriptname() const
Definition: tnconfig.h:94
int get_normal_bg() const
Definition: tnconfig.h:71
void init_aliases()
Definition: tnconfig.cpp:320
int ulblink_fg
Definition: tnconfig.h:167
void set_bool(bool *boolval, const char *str)
Definition: tnconfig.cpp:696
bool get_wide_enable() const
Definition: tnconfig.h:60
bool strip_redir
Definition: tnconfig.h:143
int normal_bg
Definition: tnconfig.h:168
int scroll_fg
Definition: tnconfig.h:171
int get_input_redir() const
Definition: tnconfig.h:42
int get_ulblink_fg() const
Definition: tnconfig.h:70
int underline_bg
Definition: tnconfig.h:164
int get_window_width() const
Definition: tnconfig.h:58
void init_varlist()
Definition: tnconfig.cpp:211
int get_status_fg() const
Definition: tnconfig.h:76
char keyfile[MAX_PATH *2]
Definition: tnconfig.h:134
int status_bg
Definition: tnconfig.h:172
bool enable_mouse
Definition: tnconfig.h:176
bool get_dstrbksp() const
Definition: tnconfig.h:45
char ** aliases
Definition: tnconfig.h:203
char get_escape_key() const
Definition: tnconfig.h:82
int get_underline_bg() const
Definition: tnconfig.h:67
bool ctrlbreak_as_ctrlc
Definition: tnconfig.h:158
int get_underline_fg() const
Definition: tnconfig.h:68
bool get_enable_mouse() const
Definition: tnconfig.h:79
bool script_enable
Definition: tnconfig.h:192
int status_fg
Definition: tnconfig.h:173
int term_height
Definition: tnconfig.h:155
bool get_disable_break() const
Definition: tnconfig.h:48
bool fast_write
Definition: tnconfig.h:153
char default_config[128]
Definition: tnconfig.h:139
bool get_set_title() const
Definition: tnconfig.h:55
bool get_eightbit_ansi() const
Definition: tnconfig.h:46
bool Process_Params(int argc, char *argv[])
Definition: tnconfig.cpp:619
char term[128]
Definition: tnconfig.h:138
const char * get_term() const
Definition: tnconfig.h:37
const char * get_inifile() const
Definition: tnconfig.h:35
bool scroll_enable
Definition: tnconfig.h:187
int get_ulblink_bg() const
Definition: tnconfig.h:69
int term_width
Definition: tnconfig.h:155
bool speaker_beep
Definition: tnconfig.h:148
void redir_init()
Definition: tnconfig.cpp:596
int buffer_size
Definition: tnconfig.h:159
bool find_alias(const char *alias_name)
char scriptname[MAX_PATH *2]
Definition: tnconfig.h:191
int get_buffer_size() const
Definition: tnconfig.h:62
int get_term_width() const
Definition: tnconfig.h:56
int window_width
Definition: tnconfig.h:156
const char * get_default_config() const
Definition: tnconfig.h:39
int output_redir
Definition: tnconfig.h:142
bool get_alt_erase() const
Definition: tnconfig.h:85
char netpipe[MAX_PATH *2]
Definition: tnconfig.h:195
char scrollback_key[2]
Definition: tnconfig.h:180
int scroll_size
Definition: tnconfig.h:188
bool preserve_colors
Definition: tnconfig.h:150
char inifile[MAX_PATH *2]
Definition: tnconfig.h:135
bool get_speaker_beep() const
Definition: tnconfig.h:49
const char * get_dumpfile() const
Definition: tnconfig.h:36
int get_blink_fg() const
Definition: tnconfig.h:66
bool get_control_break_as_c() const
Definition: tnconfig.h:61
int input_redir
Definition: tnconfig.h:142
int scroll_bg
Definition: tnconfig.h:170
char dial_key[2]
Definition: tnconfig.h:181
bool wide_enable
Definition: tnconfig.h:157
void print_vars()
Definition: tnconfig.cpp:383
const char * get_scroll_mode() const
Definition: tnconfig.h:89
void keyfile_init()
Definition: tnconfig.cpp:543
const char * get_keyfile() const
Definition: tnconfig.h:34
const char * get_netpipe() const
Definition: tnconfig.h:98
void print_aliases()
Definition: tnconfig.cpp:366
bool get_wrapline() const
Definition: tnconfig.h:52
char dumpfile[MAX_PATH *2]
Definition: tnconfig.h:136
const char * get_host() const
Definition: tnconfig.h:102
bool get_fast_write() const
Definition: tnconfig.h:53
int alias_total
Definition: tnconfig.h:204
bool get_do_beep() const
Definition: tnconfig.h:50
int window_height
Definition: tnconfig.h:156
bool do_beep
Definition: tnconfig.h:149
char get_dial_key() const
Definition: tnconfig.h:84
bool wrapline
Definition: tnconfig.h:151
const char * get_iopipe() const
Definition: tnconfig.h:99
char printer_name[MAX_PATH *2]
Definition: tnconfig.h:137
bool vt100_mode
Definition: tnconfig.h:146
const char * port
Definition: tnconfig.h:200
bool keyboard_paste
Definition: tnconfig.h:183
int get_scroll_fg() const
Definition: tnconfig.h:74
int get_blink_bg() const
Definition: tnconfig.h:65
bool get_scroll_enable() const
Definition: tnconfig.h:90
char get_scrollback_key() const
Definition: tnconfig.h:83
const char * get_port() const
Definition: tnconfig.h:103
bool set_title
Definition: tnconfig.h:154
int get_scroll_bg() const
Definition: tnconfig.h:73
char iopipe[MAX_PATH *2]
Definition: tnconfig.h:196
int get_window_height() const
Definition: tnconfig.h:59
char exename[MAX_PATH]
Definition: tnconfig.h:133
const char * get_startdir() const
Definition: tnconfig.h:32
bool get_preserve_colors() const
Definition: tnconfig.h:51
char scroll_mode[8]
Definition: tnconfig.h:186
int print_value(const char *var)
Definition: tnconfig.cpp:468
void inifile_init()
Definition: tnconfig.cpp:526
#define MAX_PATH
Definition: compat.h:34
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
__cdecl __MINGW_NOTHROW char * dirname(char *)
const char * var
Definition: shader.c:5666
static char * dest
Definition: rtl.c:135
#define argv
Definition: mplay32.c:18
const WCHAR * str
TConfig ini
Definition: tnconfig.cpp:45
Definition: pdh_main.c:94
static int init
Definition: wintirpc.c:33