/*
- * Copyright (C) 1998-2012 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1998-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
static unsigned scroll_position;
-static int cmd_died, curses_active;
+static int curses_active;
static pid_t cmd_pid;
static int command_fds[2];
ret = para_reap_child(&pid);
if (ret <= 0)
return;
- if (pid == cmd_pid) {
+ if (pid == cmd_pid)
cmd_pid = 0;
- cmd_died = 1;
- }
goto reap_next_child;
}
return ret;
}
-#define COMMAND_BUF_SIZE 4096
+#define COMMAND_BUF_SIZE 32768
/*
* This is the core select loop. Besides the (internal) signal
if (command_fds[1] >= 0)
para_fd_set(command_fds[1], &rfds, &max_fileno);
}
+ if (mode == GETCH_MODE || mode == COMMAND_MODE)
+ para_fd_set(STDIN_FILENO, &rfds, &max_fileno);
ret = para_select(max_fileno + 1, &rfds, NULL, &tv);
if (ret <= 0)
goto check_return; /* skip fd checks */
if (command_fds[!i] < 0) /* both fds closed */
return 0;
}
+ if (cbo[i] == COMMAND_BUF_SIZE - 1) {
+ PARA_NOTICE_LOG("discarding overlong line");
+ cbo[i] = 0;
+ }
}
}
ret = read_stat_pipe(&rfds);
return ret;
break;
case EXTERNAL_MODE:
- if (cmd_died) {
- cmd_died = 0;
+ if (cmd_pid == 0)
return 0;
- }
}
goto repeat;
}
shutdown_curses();
if (para_exec_cmdline_pid(&cmd_pid, cmd, fds) < 0)
return;
- cmd_died = 0;
do_select(EXTERNAL_MODE);
init_curses();
}
_argc = argc;
_argv = argv;
- if (gui_cmdline_parser(argc, argv, &conf) != 0)
- exit(EXIT_FAILURE);
+ gui_cmdline_parser(argc, argv, &conf); /* exits on errors */
HANDLE_VERSION_FLAG("gui", conf);
cf = configfile_exists();
if (!cf && conf.config_file_given) {