4
Fork 0

Added support of default ID

This commit is contained in:
R3ABM Artem 2016-04-13 14:18:53 +04:00
parent fd65ad7769
commit ebc4aa16bc
3 changed files with 22 additions and 7 deletions

View file

@ -9,6 +9,7 @@
#define VECTORS_COUNT 8
#define DEFAULT_USER_NUMBER 1
#define DEFAULT_LINK_NUMBER 10
int main(int argc, const char* argv[])
{
@ -25,6 +26,7 @@ int main(int argc, const char* argv[])
{ "connection", required_argument, NULL, 'c' },
{ "identity", required_argument, NULL, 'i' },
{ "network", required_argument, NULL, 'n' },
{ "unknown", required_argument, NULL, 'u' },
{ "link", required_argument, NULL, 'l' },
{ NULL, 0, NULL, 0 }
};
@ -32,13 +34,14 @@ int main(int argc, const char* argv[])
pcre* expression = NULL;
const char* file = NULL;
uint32_t network = 0;
uint32_t link = 10;
uint32_t unknown = DEFAULT_USER_NUMBER;
uint32_t link = DEFAULT_LINK_NUMBER;
int position = 0;
const char* error = NULL;
int selection = 0;
while ((selection = getopt_long(argc, const_cast<char* const*>(argv), "e:c:n:l:", options, NULL)) != EOF)
while ((selection = getopt_long(argc, const_cast<char* const*>(argv), "e:c:u:n:l:", options, NULL)) != EOF)
switch (selection)
{
case 'e':
@ -53,6 +56,10 @@ int main(int argc, const char* argv[])
openlog(optarg, 0, LOG_USER);
break;
case 'u':
unknown = atoi(optarg);
break;
case 'n':
network = atoi(optarg);
break;
@ -77,6 +84,7 @@ int main(int argc, const char* argv[])
"Usage: %s"
" --expression <regular expression>"
" --connection <path to configuration file>"
" [--unknown <ID for unknown call-signs>]"
" --network <network number>"
" --link <link number>"
" [--identity <identity>]"
@ -107,7 +115,7 @@ int main(int argc, const char* argv[])
uint32_t number = store.getPrivateIDForCall(call);
if (number == 0)
number = DEFAULT_USER_NUMBER;
number = unknown;
proxy.setTalkerID(number);
syslog(LOG_INFO, "*** Found call-sign: %s (ID: %d)", call, number);