forked from Mirrors/sngrep
capture: allow reading data from standard input #198
This commit is contained in:
parent
3c19342f25
commit
1b5149c6f8
|
@ -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;
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue