faup1090 startup and logging improvements

* If faup1090 can't start because the 10001 port is already in use it will now
exit with an exit status of 98 (EADDRINUSE).

* Emit the faup1090 version number if faup1090 is run with the --help argument.

* Make wicked sure we don't come up on any other ports that we shouldn't be on.

* Add "install" argument to faup1090 makefile makefaup1090.
BUGZID:
This commit is contained in:
Karl Lehenbauer 2014-08-18 17:59:46 -05:00
parent 2ede6fb51f
commit 298afdaa8f
3 changed files with 19 additions and 12 deletions

View File

@ -160,7 +160,7 @@ void faupInitNet(void) {
// {"Beast TCP input", &Modes.bis, Modes.net_input_beast_port, 0},
// {"HTTP server", &Modes.https, Modes.net_http_port, 0},
// {"Basestation TCP output", &Modes.sbsos, Modes.net_output_sbs_port, 0},
{"FlightAware TSV output", &Modes.fatsvos, MODES_NET_OUTPUT_FA_TSV_PORT, 1}
{"FlightAware TSV output", &Modes.fatsvos, Modes.net_fatsv_port, 1}
};
memcpy(&services, &svc, sizeof(svc));//services = svc;
@ -183,8 +183,11 @@ void faupInitNet(void) {
if (services[j].enabled) {
int s = anetTcpServer(Modes.aneterr, services[j].port, NULL);
if (s == -1) {
fprintf(stderr, "Error opening the listening port %d (%s): %s\n",
fprintf(stderr, "faup1090: error opening the listening port %d (%s): %s\n",
services[j].port, services[j].descr, strerror(errno));
if (errno == EADDRINUSE) {
exit(98);
}
exit(1);
}
anetNonBlock(Modes.aneterr, s);
@ -205,9 +208,8 @@ void faupInitNet(void) {
void showHelp(void) {
printf(
"-----------------------------------------------------------------------------\n"
"| faup1090 ModeS Forwarder Ver : " FAUP1090_VERSION " |\n"
" \n"
"| dump1090 reference build Ver : " MODES_DUMP1090_VERSION " |\n"
"| FlightAware faup1090 Ver : "FAUP1090_VERSION " |\n"
"| dump1090 ModeS Receiver Ver : " MODES_DUMP1090_VERSION " |\n"
"-----------------------------------------------------------------------------\n"
"--interactive Interactive mode refreshing data on screen\n"
"--interactive-rows <num> Max number of rows in interactive mode (default: 15)\n"
@ -235,9 +237,7 @@ void showCopyright(void) {
printf(
"-----------------------------------------------------------------------------\n"
"| faup1090 ModeS Forwarder Ver : " FAUP1090_VERSION " |\n"
" \n"
"| dump1090 reference build Ver : " MODES_DUMP1090_VERSION " |\n"
"| dump1090 ModeS Receiver Ver : " MODES_DUMP1090_VERSION " |\n"
"-----------------------------------------------------------------------------\n"
"\n"
" Copyright (C) 2012 by Salvatore Sanfilippo <antirez@gmail.com>\n"

View File

@ -1,16 +1,17 @@
#define FAUP1090_VERSION 1.4
#include "dump1090.h"
#define FAUP1090_VERSION "1.6"
#undef MODES_NET_INPUT_RAW_PORT
#define MODES_NET_INPUT_RAW_PORT 20001
#define MODES_NET_INPUT_RAW_PORT 0
#undef MODES_NET_INPUT_BEAST_PORT
#define MODES_NET_INPUT_BEAST_PORT 20004
#define MODES_NET_INPUT_BEAST_PORT 0
#undef MODES_NET_OUTPUT_FA_TSV_PORT
#define MODES_NET_OUTPUT_FA_TSV_PORT 10002
#define MODES_NET_OUTPUT_FA_TSV_PORT 10001
struct {
char net_input_beast_ipaddr[32];

View File

@ -20,8 +20,14 @@ all: faup1090
%.o: %.c
$(CC) $(CFLAGS) $(EXTRACFLAGS) -c $<
faup1090.o: faup1090.c faup1090.h
faup1090: faup1090.o
faup1090: faup1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o
$(CC) -g -o faup1090 faup1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o coaa1090.obj $(LIBS) $(LDFLAGS)
install: faup1090
install faup1090 /usr/bin/faup1090
clean:
rm -f *.o faup1090