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