ports/comms/dump1090/patches/patch-dump1090_c

57 lines
2.6 KiB
Text

Clang says this abs should be llabs.
Cherry pick quiet mode from PR #17.
Index: dump1090.c
--- dump1090.c.orig
+++ dump1090.c
@@ -162,6 +162,7 @@ struct {
int debug; /* Debugging mode. */
int net; /* Enable networking. */
int net_only; /* Enable just networking. */
+ int quiet; /* Suppress stdout. */
int interactive; /* Interactive mode */
int interactive_rows; /* Interactive mode: max number of rows. */
int interactive_ttl; /* Interactive mode: TTL before deletion. */
@@ -273,6 +274,7 @@ void modesInitConfig(void) {
Modes.interactive = 0;
Modes.interactive_rows = MODES_INTERACTIVE_ROWS;
Modes.interactive_ttl = MODES_INTERACTIVE_TTL;
+ Modes.quiet = 0;
Modes.aggressive = 0;
Modes.interactive_rows = getTermRows();
Modes.loop = 0;
@@ -1568,7 +1570,7 @@ void useModesMessage(struct modesMessage *mm) {
if (a && Modes.stat_sbs_connections > 0) modesSendSBSOutput(mm, a); /* Feed SBS output clients. */
}
/* In non-interactive way, display messages on standard output. */
- if (!Modes.interactive) {
+ if (!Modes.interactive && !Modes.quiet) {
displayModesMessage(mm);
if (!Modes.raw && !Modes.onlyaddr) printf("\n");
}
@@ -1801,7 +1803,7 @@ struct aircraft *interactiveReceiveData(struct modesMe
}
/* If the two data is less than 10 seconds apart, compute
* the position. */
- if (abs(a->even_cprtime - a->odd_cprtime) <= 10000) {
+ if (llabs(a->even_cprtime - a->odd_cprtime) <= 10000) {
decodeCPR(a);
}
} else if (mm->metype == 19) {
@@ -2462,6 +2464,7 @@ void showHelp(void) {
"--metric Use metric units (meters, km/h, ...).\n"
"--snip <level> Strip IQ file removing samples < level.\n"
"--debug <flags> Debug mode (verbose), see README for details.\n"
+"--quiet Disable output to stdout. Use for daemon applications.\n"
"--help Show this help.\n"
"\n"
"Debug mode flags: d = Log frames decoded with errors\n"
@@ -2568,6 +2571,8 @@ int main(int argc, char **argv) {
}
} else if (!strcmp(argv[j],"--stats")) {
Modes.stats = 1;
+ } else if (!strcmp(argv[j],"--quiet")) {
+ Modes.quiet = 1;
} else if (!strcmp(argv[j],"--snip") && more) {
snipMode(atoi(argv[++j]));
exit(0);