From 2052f4b381337d75e783facdbfad56b04dec1a9c Mon Sep 17 00:00:00 2001 From: vvaltman Date: Thu, 30 Jul 2015 15:24:17 +0300 Subject: [PATCH] minor updates. --- loop.c | 7 +++++++ main.c | 6 +++++- tgl | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/loop.c b/loop.c index 6c1d4e9..54f012e 100644 --- a/loop.c +++ b/loop.c @@ -75,6 +75,7 @@ int verbosity; extern int readline_disabled; +extern char *bot_hash; extern int bot_mode; 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 (*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_num = 0; one_string_total_args = num_values; diff --git a/main.c b/main.c index 5dcc687..fcdaca7 100644 --- a/main.c +++ b/main.c @@ -557,6 +557,7 @@ static void sighup_handler (const int sig) { char *set_user_name; char *set_group_name; int accept_any_tcp; +char *bot_hash; int change_user_group () { char *username = set_user_name; @@ -642,7 +643,7 @@ void args_parse (int argc, char **argv) { {"exec", required_argument, 0, 'e'}, {"disable-names", no_argument, 0, 'I'}, {"enable-ipv6", no_argument, 0, '6'}, - {"bot", no_argument, 0, 'b'}, + {"bot", optional_argument, 0, 'b'}, {"help", no_argument, 0, 'h'}, {"accept-any-tcp", no_argument, 0, 1001}, {"disable-link-preview", no_argument, 0, 1002}, @@ -672,6 +673,9 @@ void args_parse (int argc, char **argv) { switch (opt) { case 'b': bot_mode ++; + if (optarg) { + bot_hash = optarg; + } break; case 1000: tgl_allocator = &tgl_allocator_debug; diff --git a/tgl b/tgl index e279fef..418f81b 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit e279fef0dc34c12d02e88f82a2fbde5917bc9c56 +Subproject commit 418f81be448fdebb04c3809795f8c160ee13280c