--loop option to read input file again and again.
This commit is contained in:
parent
07d194bbd5
commit
db9f5f34a3
10
dump1090.c
10
dump1090.c
@ -155,6 +155,7 @@ struct {
|
|||||||
|
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
char *filename; /* Input form file, --ifile option. */
|
char *filename; /* Input form file, --ifile option. */
|
||||||
|
int loop; /* Read input file again and again. */
|
||||||
int fix_errors; /* Single bit error correction if true. */
|
int fix_errors; /* Single bit error correction if true. */
|
||||||
int check_crc; /* Only display messages with good CRC. */
|
int check_crc; /* Only display messages with good CRC. */
|
||||||
int raw; /* Raw output format. */
|
int raw; /* Raw output format. */
|
||||||
@ -274,6 +275,7 @@ void modesInitConfig(void) {
|
|||||||
Modes.interactive_ttl = MODES_INTERACTIVE_TTL;
|
Modes.interactive_ttl = MODES_INTERACTIVE_TTL;
|
||||||
Modes.aggressive = 0;
|
Modes.aggressive = 0;
|
||||||
Modes.interactive_rows = getTermRows();
|
Modes.interactive_rows = getTermRows();
|
||||||
|
Modes.loop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void modesInit(void) {
|
void modesInit(void) {
|
||||||
@ -434,10 +436,11 @@ void readDataFromFile(void) {
|
|||||||
while(toread) {
|
while(toread) {
|
||||||
nread = read(Modes.fd, p, toread);
|
nread = read(Modes.fd, p, toread);
|
||||||
/* In --file mode, seek the file again from the start
|
/* In --file mode, seek the file again from the start
|
||||||
* and re-play it. */
|
* and re-play it if --loop was given. */
|
||||||
if (nread == 0 &&
|
if (nread == 0 &&
|
||||||
Modes.filename != NULL &&
|
Modes.filename != NULL &&
|
||||||
Modes.fd != STDIN_FILENO)
|
Modes.fd != STDIN_FILENO &&
|
||||||
|
Modes.loop)
|
||||||
{
|
{
|
||||||
if (lseek(Modes.fd,0,SEEK_SET) != -1) continue;
|
if (lseek(Modes.fd,0,SEEK_SET) != -1) continue;
|
||||||
}
|
}
|
||||||
@ -2440,6 +2443,7 @@ void showHelp(void) {
|
|||||||
"--enable-agc Enable the Automatic Gain Control (default: off).\n"
|
"--enable-agc Enable the Automatic Gain Control (default: off).\n"
|
||||||
"--freq <hz> Set frequency (default: 1090 Mhz).\n"
|
"--freq <hz> Set frequency (default: 1090 Mhz).\n"
|
||||||
"--ifile <filename> Read data from file (use '-' for stdin).\n"
|
"--ifile <filename> Read data from file (use '-' for stdin).\n"
|
||||||
|
"--loop With --ifile, read the same file in a loop.\n"
|
||||||
"--interactive Interactive mode refreshing data on screen.\n"
|
"--interactive Interactive mode refreshing data on screen.\n"
|
||||||
"--interactive-rows <num> Max number of rows in interactive mode (default: 15).\n"
|
"--interactive-rows <num> Max number of rows in interactive mode (default: 15).\n"
|
||||||
"--interactive-ttl <sec> Remove from list if idle for <sec> (default: 60).\n"
|
"--interactive-ttl <sec> Remove from list if idle for <sec> (default: 60).\n"
|
||||||
@ -2511,6 +2515,8 @@ int main(int argc, char **argv) {
|
|||||||
Modes.freq = strtoll(argv[++j],NULL,10);
|
Modes.freq = strtoll(argv[++j],NULL,10);
|
||||||
} else if (!strcmp(argv[j],"--ifile") && more) {
|
} else if (!strcmp(argv[j],"--ifile") && more) {
|
||||||
Modes.filename = strdup(argv[++j]);
|
Modes.filename = strdup(argv[++j]);
|
||||||
|
} else if (!strcmp(argv[j],"--loop")) {
|
||||||
|
Modes.loop = 1;
|
||||||
} else if (!strcmp(argv[j],"--no-fix")) {
|
} else if (!strcmp(argv[j],"--no-fix")) {
|
||||||
Modes.fix_errors = 0;
|
Modes.fix_errors = 0;
|
||||||
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user