Commit ecdec462 authored by vvaltman's avatar vvaltman

Added '-e' option

parent 59abeaa1
......@@ -91,6 +91,8 @@ static int delete_stdin_event;
extern volatile int sigterm_cnt;
extern char *start_command;
static void stdin_read_callback_all (int arg, short what, struct event *self) {
if (!readline_disabled) {
if (((long)arg) & 1) {
......@@ -852,6 +854,20 @@ int loop (void) {
lua_diff_end ();
#endif
if (start_command) {
safe_quit = 1;
while (*start_command) {
char *start = start_command;
while (*start_command && *start_command != '\n') {
start_command ++;
}
if (*start_command) {
*start_command = 0;
start_command ++;
}
interpreter_ex (start, 0);
}
}
/*tgl_do_get_dialog_list (get_dialogs_callback, 0);
if (wait_dialog_list) {
......
......@@ -111,6 +111,7 @@ int readline_disabled;
int disable_output;
int reset_authorization;
int port;
char *start_command;
void set_default_username (const char *s) {
if (default_username) {
......@@ -436,6 +437,7 @@ void usage (void) {
printf (" -D disable output\n");
printf (" -P <port> port to listen for input commands\n");
printf (" -S <socket-name> unix socket to create\n");
printf (" -e <commands> make commands end exit\n");
exit (1);
}
......@@ -538,7 +540,7 @@ char *unix_socket;
void args_parse (int argc, char **argv) {
int opt = 0;
while ((opt = getopt (argc, argv, "u:hk:vNl:fEwWCRdL:DU:G:qP:S:"
while ((opt = getopt (argc, argv, "u:hk:vNl:fEwWCRdL:DU:G:qP:S:e:"
#ifdef HAVE_LIBCONFIG
"c:p:"
#else
......@@ -627,6 +629,9 @@ void args_parse (int argc, char **argv) {
case 'S':
unix_socket = optarg;
break;
case 'e':
start_command = optarg;
break;
case 'h':
default:
usage ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment