minor updates.

This commit is contained in:
vvaltman 2015-07-30 15:24:17 +03:00
parent 2cc75016aa
commit 2052f4b381
3 changed files with 13 additions and 2 deletions

7
loop.c
View File

@ -75,6 +75,7 @@
int verbosity; int verbosity;
extern int readline_disabled; extern int readline_disabled;
extern char *bot_hash;
extern int bot_mode; extern int bot_mode;
int binlog_read; int binlog_read;
@ -235,6 +236,12 @@ void do_get_string (struct tgl_state *TLS) {
void do_get_values (struct tgl_state *TLS, enum tgl_value_type type, const char *prompt, int num_values, void do_get_values (struct tgl_state *TLS, enum tgl_value_type type, const char *prompt, int num_values,
void (*callback)(struct tgl_state *TLS, const char *string[], void *arg), void *arg) { void (*callback)(struct tgl_state *TLS, const char *string[], void *arg), void *arg) {
if (type == tgl_bot_hash && bot_hash) {
assert (num_values == 1);
one_string_results[0] = bot_hash;
callback (TLS, (void *)one_string_results, arg);
return;
}
one_string_cb = callback; one_string_cb = callback;
one_string_num = 0; one_string_num = 0;
one_string_total_args = num_values; one_string_total_args = num_values;

6
main.c
View File

@ -557,6 +557,7 @@ static void sighup_handler (const int sig) {
char *set_user_name; char *set_user_name;
char *set_group_name; char *set_group_name;
int accept_any_tcp; int accept_any_tcp;
char *bot_hash;
int change_user_group () { int change_user_group () {
char *username = set_user_name; char *username = set_user_name;
@ -642,7 +643,7 @@ void args_parse (int argc, char **argv) {
{"exec", required_argument, 0, 'e'}, {"exec", required_argument, 0, 'e'},
{"disable-names", no_argument, 0, 'I'}, {"disable-names", no_argument, 0, 'I'},
{"enable-ipv6", no_argument, 0, '6'}, {"enable-ipv6", no_argument, 0, '6'},
{"bot", no_argument, 0, 'b'}, {"bot", optional_argument, 0, 'b'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
{"accept-any-tcp", no_argument, 0, 1001}, {"accept-any-tcp", no_argument, 0, 1001},
{"disable-link-preview", no_argument, 0, 1002}, {"disable-link-preview", no_argument, 0, 1002},
@ -672,6 +673,9 @@ void args_parse (int argc, char **argv) {
switch (opt) { switch (opt) {
case 'b': case 'b':
bot_mode ++; bot_mode ++;
if (optarg) {
bot_hash = optarg;
}
break; break;
case 1000: case 1000:
tgl_allocator = &tgl_allocator_debug; tgl_allocator = &tgl_allocator_debug;

2
tgl

@ -1 +1 @@
Subproject commit e279fef0dc34c12d02e88f82a2fbde5917bc9c56 Subproject commit 418f81be448fdebb04c3809795f8c160ee13280c