mirror of
https://github.com/ShaYmez/P25Clients.git
synced 2026-08-13 23:23:33 -04:00
Allow the programs to build on Windows again.
This commit is contained in:
+26
-15
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016,2018,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016,2018,2020,2024 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Version.h"
|
||||
#include "Thread.h"
|
||||
#include "Timer.h"
|
||||
#include "GitVersion.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -30,21 +31,31 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc == 1) {
|
||||
::fprintf(stderr, "Usage: P25Parrot <port>\n");
|
||||
return 1;
|
||||
if (argc > 1) {
|
||||
for (int currentArg = 1; currentArg < argc; ++currentArg) {
|
||||
std::string arg = argv[currentArg];
|
||||
if ((arg == "-v") || (arg == "--version")) {
|
||||
::fprintf(stdout, "P25Parrot version %s git #%.7s\n", VERSION, gitversion);
|
||||
return 0;
|
||||
}
|
||||
else if (arg.substr(0, 1) == "-") {
|
||||
::fprintf(stderr, "Usage: P25Parrot [-v|--version] [-d|--debug] <port>\n");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
unsigned short port = (unsigned short)::atoi(argv[1U]);
|
||||
if (port == 0U) {
|
||||
::fprintf(stderr, "P25Parrot: invalid port number - %s\n", argv[1U]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
CP25Parrot parrot(port);
|
||||
parrot.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short port = (unsigned short)::atoi(argv[1U]);
|
||||
if (port == 0U) {
|
||||
::fprintf(stderr, "P25Parrot: invalid port number - %s\n", argv[1U]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
CP25Parrot parrot(port);
|
||||
parrot.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CP25Parrot::CP25Parrot(unsigned short port) :
|
||||
|
||||
Reference in New Issue
Block a user