capture: allow reading data from standard input #198

This commit is contained in:
Kaian 2017-08-21 11:43:09 +02:00
parent 3c19342f25
commit 1b5149c6f8
2 changed files with 10 additions and 0 deletions

View File

@ -169,6 +169,11 @@ capture_offline(const char *infile, const char *outfile)
return 1;
}
// Check if file is standard input
if (strlen(infile) == 1 && *infile == '-') {
infile = "/dev/stdin";
}
// Set capture input file
capinfo->infile = infile;

View File

@ -68,9 +68,14 @@ ncurses_init()
{
int bg, fg;
const char *term;
FILE *fstdin;
// Set Locale
setlocale(LC_CTYPE, "");
// Allow reading from stdin
fstdin = freopen("/dev/tty", "r", stdin);
// Initialize curses
if (!initscr()) {
fprintf(stderr, "Unable to initialize ncurses mode.\n");