From c218b967dc33cc25954bd376921268ed61b383f4 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Wed, 13 Jan 2010 21:08:48 -0800 Subject: [PATCH] Added back in the ability to use a getenv string for servers. --- clients/memcp.c | 2 ++ clients/memslap.c | 14 ++++++++++++-- clients/ms_setting.c | 1 + docs/memslap.pod | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/clients/memcp.c b/clients/memcp.c index 8109ea7e..1a3307cf 100644 --- a/clients/memcp.c +++ b/clients/memcp.c @@ -85,7 +85,9 @@ int main(int argc, char *argv[]) char *temp; if ((temp= getenv("MEMCACHED_SERVERS"))) + { opt_servers= strdup(temp); + } else { fprintf(stderr, "No Servers provided\n"); diff --git a/clients/memslap.c b/clients/memslap.c index 37e211a0..804d8b7b 100644 --- a/clients/memslap.c +++ b/clients/memslap.c @@ -298,6 +298,7 @@ void ms_help_command(const char *command_name, const char *description) { printf(" -%c, --%s%c\n", long_options[x].val, long_options[x].name, long_options[x].has_arg ? '=' : ' '); + if ((help_message= (char *)ms_lookup_help(long_options[x].val)) != NULL) { printf(" %s\n", help_message); @@ -613,8 +614,17 @@ static int ms_check_para() { if (ms_setting.srv_str == NULL) { - fprintf(stderr, "No Servers provided.\n\n"); - return -1; + char *temp; + + if ((temp= getenv("MEMCACHED_SERVERS"))) + { + ms_setting.srv_str= strdup(temp); + } + else + { + fprintf(stderr, "No Servers provided\n\n"); + return -1; + } } if (ms_setting.nconns % ms_setting.nthreads != 0) diff --git a/clients/ms_setting.c b/clients/ms_setting.c index d43356c7..d269e330 100644 --- a/clients/ms_setting.c +++ b/clients/ms_setting.c @@ -872,6 +872,7 @@ static void ms_init_random_block() */ static void ms_print_setting() { + fprintf(stdout, "servers : %s\n", ms_setting.srv_str); fprintf(stdout, "threads count: %d\n", ms_setting.nthreads); fprintf(stdout, "concurrency: %d\n", ms_setting.nconns); if (ms_setting.run_time > 0) diff --git a/docs/memslap.pod b/docs/memslap.pod index 2ddeed60..462f67fe 100644 --- a/docs/memslap.pod +++ b/docs/memslap.pod @@ -593,6 +593,8 @@ At the beginning, memslap displays some configuration information as follows: =over 4 +=item servers : 127.0.0.1:11211 + =item threads count: 1 =item concurrency: 16 @@ -611,6 +613,10 @@ At the beginning, memslap displays some configuration information as follows: =over 4 +=item servers : "servers" + +The servers used by memslap. + =item threads count The number of threads memslap runs with. -- 2.30.2