Merge branch 'master' into smgmaster

This commit is contained in:
Konrad Hammel
2011-03-15 10:53:35 -04:00
156 changed files with 6210 additions and 4304 deletions

View File

@@ -54,6 +54,7 @@ static unsigned char esl_console_complete(const char *buffer, const char *cursor
#endif
static char prompt_str[512] = "";
static int CONNECTED = 0;
typedef struct {
char name[128];
@@ -538,6 +539,11 @@ static void handle_SIGINT(int sig)
{
if (sig);
if (!CONNECTED) {
fprintf(stdout, "Interrupted.\n");
exit(1);
}
WARN_STOP = 1;
signal(SIGINT, handle_SIGINT);
@@ -572,6 +578,7 @@ static int usage(char *name){
printf(" -P, --port=port Port to connect (1 - 65535)\n");
printf(" -u, --user=user@domain user@domain\n");
printf(" -p, --password=password Password\n");
printf(" -i, --interrupt Allow Control-c to interrupt");
printf(" -x, --execute=command Execute Command and Exit\n");
printf(" -l, --loglevel=command Log Level\n");
printf(" -q, --quiet Disable logging\n");
@@ -1017,6 +1024,7 @@ int main(int argc, char *argv[])
{"loglevel", 1, 0, 'l'},
{"quiet", 0, 0, 'q'},
{"retry", 0, 0, 'r'},
{"interrupt", 0, 0, 'i'},
{"reconnect", 0, 0, 'R'},
{0, 0, 0, 0}
};
@@ -1032,6 +1040,7 @@ int main(int argc, char *argv[])
int temp_log = -1;
int argv_error = 0;
int argv_exec = 0;
int ctl_c = 0;
char argv_command[1024] = "";
char argv_loglevel[128] = "";
int argv_quiet = 0;
@@ -1060,7 +1069,7 @@ int main(int argc, char *argv[])
for(;;) {
int option_index = 0;
opt = getopt_long(argc, argv, "H:U:P:S:u:p:d:x:l:qrRh?", options, &option_index);
opt = getopt_long(argc, argv, "H:U:P:S:u:p:d:x:l:qrRhi?", options, &option_index);
if (opt == -1) break;
switch (opt)
{
@@ -1104,6 +1113,9 @@ int main(int argc, char *argv[])
case 'q':
argv_quiet = 1;
break;
case 'i':
ctl_c = 1;
break;
case 'r':
loops += 120;
break;
@@ -1229,6 +1241,8 @@ int main(int argc, char *argv[])
connect:
CONNECTED = 0;
while (--loops > 0) {
memset(&handle, 0, sizeof(handle));
if (esl_connect(&handle, profile->host, profile->port, profile->user, profile->pass)) {
@@ -1246,6 +1260,10 @@ int main(int argc, char *argv[])
esl_log(ESL_LOG_INFO, "Retrying\n");
}
} else {
if (!ctl_c) {
CONNECTED = 1;
}
if (temp_log < 0 ) {
esl_global_set_default_logger(profile->debug);
} else {