add a couple of more options
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10953 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
db6f99ba33
commit
0b976886fc
|
@ -236,9 +236,18 @@ int main(int argc, char *argv[])
|
||||||
{"host", 1, 0, 'H'},
|
{"host", 1, 0, 'H'},
|
||||||
{"port", 1, 0, 'P'},
|
{"port", 1, 0, 'P'},
|
||||||
{"password", 1, 0, 'p'},
|
{"password", 1, 0, 'p'},
|
||||||
|
{"debug", 1, 0, 'd'},
|
||||||
|
{"execute", 1, 0, 'x'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char temp_host[128];
|
||||||
|
int argv_host = 0;
|
||||||
|
char temp_pass[128];
|
||||||
|
int argv_pass = 0 ;
|
||||||
|
esl_port_t temp_port = 0;
|
||||||
|
int argv_port = 0;
|
||||||
|
|
||||||
strncpy(profiles[0].host, "127.0.0.1", sizeof(profiles[0].host));
|
strncpy(profiles[0].host, "127.0.0.1", sizeof(profiles[0].host));
|
||||||
strncpy(profiles[0].pass, "ClueCon", sizeof(profiles[0].pass));
|
strncpy(profiles[0].pass, "ClueCon", sizeof(profiles[0].pass));
|
||||||
strncpy(profiles[0].name, "default", sizeof(profiles[0].name));
|
strncpy(profiles[0].name, "default", sizeof(profiles[0].name));
|
||||||
|
@ -256,6 +265,46 @@ int main(int argc, char *argv[])
|
||||||
handle.debug = 0;
|
handle.debug = 0;
|
||||||
esl_global_set_default_logger(7);
|
esl_global_set_default_logger(7);
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
int option_index = 0;
|
||||||
|
opt = getopt_long(argc, argv, "H:U:P:S:p:d:x:h?", options, &option_index);
|
||||||
|
if (opt == -1) break;
|
||||||
|
switch (opt)
|
||||||
|
{
|
||||||
|
case 'H':
|
||||||
|
esl_set_string(temp_host, optarg);
|
||||||
|
argv_host = 1;
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
temp_port= (esl_port_t)atoi(optarg);
|
||||||
|
argv_port = 1;
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
esl_set_string(temp_pass, optarg);
|
||||||
|
argv_pass = 1;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
esl_global_set_default_logger(atoi(optarg));
|
||||||
|
break;
|
||||||
|
case 'x':
|
||||||
|
printf("Executing commands from the CLI is not complete.\n");
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
case '?':
|
||||||
|
printf("Usage: %s [-H <host>] [-P <port>] [-p <secret>] [-d <level>] [-x command] [profile]\n\n", argv[0]);
|
||||||
|
printf(" -?,-h --help Usage Information\n");
|
||||||
|
printf(" -H, --host=hostname Host to connect\n");
|
||||||
|
printf(" -P, --port=port Port to connect\n");
|
||||||
|
printf(" -p, --password=FILENAME Password\n");
|
||||||
|
printf(" -x, --execute=command Execute Command and exit (Work In Progress)\n");
|
||||||
|
printf(" -d, --debug=level Debug Level 0 - 7\n\n");
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
opt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (esl_config_open_file(&cfg, cfile)) {
|
if (esl_config_open_file(&cfg, cfile)) {
|
||||||
char *var, *val;
|
char *var, *val;
|
||||||
char cur_cat[128] = "";
|
char cur_cat[128] = "";
|
||||||
|
@ -286,36 +335,14 @@ int main(int argc, char *argv[])
|
||||||
esl_config_close_file(&cfg);
|
esl_config_close_file(&cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;) {
|
if (argv_host) {
|
||||||
int option_index = 0;
|
esl_set_string(profiles[cur].host, temp_host);
|
||||||
opt = getopt_long(argc, argv, "H:U:P:S:p:h?", options, &option_index);
|
}
|
||||||
if (opt == -1) break;
|
if (argv_port) {
|
||||||
switch (opt)
|
profiles[cur].port = temp_port;
|
||||||
{
|
}
|
||||||
case 'H':
|
if (argv_pass) {
|
||||||
printf("Host: %s\n", optarg);
|
esl_set_string(profiles[cur].pass, temp_pass);
|
||||||
esl_set_string(profile[0].host, optarg);
|
|
||||||
break;
|
|
||||||
case 'P':
|
|
||||||
printf("Port: %s\n", optarg);
|
|
||||||
profile[0].port= (esl_port_t)atoi(optarg);
|
|
||||||
break;
|
|
||||||
case 'p':
|
|
||||||
printf("password: %s\n", optarg);
|
|
||||||
esl_set_string(profile[0].pass, optarg);
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
case '?':
|
|
||||||
printf("Usage: %s [-H <host>] [-P <port>] [-p <secret>] [profile]\n\n", argv[0]);
|
|
||||||
printf(" -?,-h --help Usage Information\n");
|
|
||||||
printf(" -H, --host=hostname Host to connect\n");
|
|
||||||
printf(" -P, --port=port Port to connect\n");
|
|
||||||
printf(" -p, --password=FILENAME Password\n\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
opt = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
|
|
Loading…
Reference in New Issue