1
0
Fork 0

Merge pull request #280 from W0CHP/master

master
Jonathan Naylor 3 years ago committed by GitHub
commit 15247d0c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

1
.gitignore vendored

@ -17,3 +17,4 @@ DGIdGateway/DGIdGateway
YSFGateway/YSFGateway YSFGateway/YSFGateway
YSFParrot/YSFParrot YSFParrot/YSFParrot
YSFReflector/YSFReflector YSFReflector/YSFReflector
GitVersion.h

@ -30,6 +30,7 @@
#include "Timer.h" #include "Timer.h"
#include "Utils.h" #include "Utils.h"
#include "Log.h" #include "Log.h"
#include "GitVersion.h"
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
@ -69,7 +70,7 @@ int main(int argc, char** argv)
for (int currentArg = 1; currentArg < argc; ++currentArg) { for (int currentArg = 1; currentArg < argc; ++currentArg) {
std::string arg = argv[currentArg]; std::string arg = argv[currentArg];
if ((arg == "-v") || (arg == "--version")) { if ((arg == "-v") || (arg == "--version")) {
::fprintf(stdout, "DGIdGateway version %s\n", VERSION); ::fprintf(stdout, "DGIdGateway version %s git #%.7s\n", VERSION, gitversion);
return 0; return 0;
} else if (arg.substr(0, 1) == "-") { } else if (arg.substr(0, 1) == "-") {
::fprintf(stderr, "Usage: DGIdGateway [-v|--version] [filename]\n"); ::fprintf(stderr, "Usage: DGIdGateway [-v|--version] [filename]\n");
@ -407,7 +408,8 @@ int CDGIdGateway::run()
CStopWatch stopWatch; CStopWatch stopWatch;
stopWatch.start(); stopWatch.start();
LogMessage("Starting DGIdGateway-%s", VERSION); LogMessage("DGIdGateway-%s is starting", VERSION);
LogMessage("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);
DGID_STATUS state = DS_NOTLINKED; DGID_STATUS state = DS_NOTLINKED;
unsigned int nPips = 0U; unsigned int nPips = 0U;

@ -23,9 +23,22 @@ DGIdGateway: $(OBJECTS)
%.o: %.cpp %.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $< $(CXX) $(CFLAGS) -c -o $@ $<
DGIdGateway.o: GitVersion.h FORCE
.PHONY: GitVersion.h
FORCE:
install: install:
install -m 755 DGIdGateway /usr/local/bin/ install -m 755 DGIdGateway /usr/local/bin/
clean: clean:
$(RM) DGIdGateway *.o *.d *.bak *~ $(RM) DGIdGateway *.o *.d *.bak *~ GitVersion.h
GitVersion.h:
ifneq ("$(wildcard ../.git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif

@ -22,9 +22,22 @@ YSFGateway: $(OBJECTS)
%.o: %.cpp %.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $< $(CXX) $(CFLAGS) -c -o $@ $<
YSFGateway.o: GitVersion.h FORCE
.PHONY: GitVersion.h
FORCE:
install: install:
install -m 755 YSFGateway /usr/local/bin/ install -m 755 YSFGateway /usr/local/bin/
clean: clean:
$(RM) YSFGateway *.o *.d *.bak *~ $(RM) YSFGateway *.o *.d *.bak *~ GitVersion.h
# Export the current git version if the index file exists, else 000...
GitVersion.h:
ifneq ("$(wildcard ../.git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif

@ -25,6 +25,7 @@
#include "Timer.h" #include "Timer.h"
#include "Utils.h" #include "Utils.h"
#include "Log.h" #include "Log.h"
#include "GitVersion.h"
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
@ -56,7 +57,7 @@ int main(int argc, char** argv)
for (int currentArg = 1; currentArg < argc; ++currentArg) { for (int currentArg = 1; currentArg < argc; ++currentArg) {
std::string arg = argv[currentArg]; std::string arg = argv[currentArg];
if ((arg == "-v") || (arg == "--version")) { if ((arg == "-v") || (arg == "--version")) {
::fprintf(stdout, "YSFGateway version %s\n", VERSION); ::fprintf(stdout, "YSFGateway version %s git #%.7s\n", VERSION, gitversion);
return 0; return 0;
} else if (arg.substr(0, 1) == "-") { } else if (arg.substr(0, 1) == "-") {
::fprintf(stderr, "Usage: YSFGateway [-v|--version] [filename]\n"); ::fprintf(stderr, "Usage: YSFGateway [-v|--version] [filename]\n");
@ -266,7 +267,8 @@ int CYSFGateway::run()
CStopWatch stopWatch; CStopWatch stopWatch;
stopWatch.start(); stopWatch.start();
LogMessage("Starting YSFGateway-%s", VERSION); LogMessage("YSFGateway-%s is starting", VERSION);
LogMessage("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);
for (;;) { for (;;) {
unsigned char buffer[200U]; unsigned char buffer[200U];

@ -14,9 +14,21 @@ YSFParrot: $(OBJECTS)
%.o: %.cpp %.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $< $(CXX) $(CFLAGS) -c -o $@ $<
YSFParrot.o: GitVersion.h FORCE
.PHONY: GitVersion.h
FORCE:
install: install:
install -m 755 YSFParrot /usr/local/bin/ install -m 755 YSFParrot /usr/local/bin/
clean: clean:
$(RM) YSFParrot *.o *.d *.bak *~ $(RM) YSFParrot *.o *.d *.bak *~ GitVersion.h
GitVersion.h:
ifneq ("$(wildcard ../.git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif

@ -23,6 +23,7 @@
#include "Version.h" #include "Version.h"
#include "Thread.h" #include "Thread.h"
#include "Timer.h" #include "Timer.h"
#include "GitVersion.h"
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
@ -30,11 +31,16 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
if (argc == 1) { if (argc > 1) {
::fprintf(stderr, "Usage: YSFParrot [-d|--debug] <port>\n"); for (int currentArg = 1; currentArg < argc; ++currentArg) {
std::string arg = argv[currentArg];
if ((arg == "-v") || (arg == "--version")) {
::fprintf(stdout, "YSFParrot version %s git #%.7s\n", VERSION, gitversion);
return 0;
} else if (arg.substr(0, 1) == "-") {
::fprintf(stderr, "Usage: YSFParrot [-v|--version] [-d|--debug] <port>\n");
return 1; return 1;
} } else {
unsigned short port = (unsigned short)::atoi(argv[1U]); unsigned short port = (unsigned short)::atoi(argv[1U]);
if (port == 0U) { if (port == 0U) {
::fprintf(stderr, "YSFParrot: invalid port number - %s\n", argv[1U]); ::fprintf(stderr, "YSFParrot: invalid port number - %s\n", argv[1U]);
@ -46,6 +52,9 @@ int main(int argc, char** argv)
return 0; return 0;
} }
}
}
}
CYSFParrot::CYSFParrot(unsigned short port) : CYSFParrot::CYSFParrot(unsigned short port) :
m_port(port) m_port(port)
@ -77,7 +86,8 @@ void CYSFParrot::run()
unsigned int count = 0U; unsigned int count = 0U;
bool playing = false; bool playing = false;
::fprintf(stdout, "Starting YSFParrot-%s\n", VERSION); ::fprintf(stdout, "YSFParrot-%s is starting", VERSION);
::fprintf(stdout, "Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);
for (;;) { for (;;) {
unsigned char buffer[200U]; unsigned char buffer[200U];

@ -14,9 +14,22 @@ YSFReflector: $(OBJECTS)
%.o: %.cpp %.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $< $(CXX) $(CFLAGS) -c -o $@ $<
YSFReflector.o: GitVersion.h FORCE
.PHONY: GitVersion.h
FORCE:
install: install:
install -m 755 YSFReflector /usr/local/bin/ install -m 755 YSFReflector /usr/local/bin/
clean: clean:
$(RM) YSFReflector *.o *.d *.bak *~ $(RM) YSFReflector *.o *.d *.bak *~ GitVersion.h
# Export the current git version if the index file exists, else 000...
GitVersion.h:
ifneq ("$(wildcard ../.git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif

@ -23,6 +23,7 @@
#include "Version.h" #include "Version.h"
#include "Thread.h" #include "Thread.h"
#include "Log.h" #include "Log.h"
#include "GitVersion.h"
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
@ -58,7 +59,7 @@ int main(int argc, char** argv)
for (int currentArg = 1; currentArg < argc; ++currentArg) { for (int currentArg = 1; currentArg < argc; ++currentArg) {
std::string arg = argv[currentArg]; std::string arg = argv[currentArg];
if ((arg == "-v") || (arg == "--version")) { if ((arg == "-v") || (arg == "--version")) {
::fprintf(stdout, "YSFReflector version %s\n", VERSION); ::fprintf(stdout, "YSFReflector version %s git #%.7s\n", VERSION, gitversion);
return 0; return 0;
} else if (arg.substr(0, 1) == "-") { } else if (arg.substr(0, 1) == "-") {
::fprintf(stderr, "Usage: YSFReflector [-v|--version] [filename]\n"); ::fprintf(stderr, "Usage: YSFReflector [-v|--version] [filename]\n");
@ -191,7 +192,8 @@ void CYSFReflector::run()
CTimer pollTimer(1000U, 5U); CTimer pollTimer(1000U, 5U);
pollTimer.start(); pollTimer.start();
LogMessage("Starting YSFReflector-%s", VERSION); LogMessage("YSFReflector-%s is starting", VERSION);
LogMessage("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);
CTimer watchdogTimer(1000U, 0U, 1500U); CTimer watchdogTimer(1000U, 0U, 1500U);

Loading…
Cancel
Save