Bugfix/code clean using gcc warnings (#371)

* Enable extra GCC warnings to discover subtle bugs

* convert c++ comments to c comments

* cleanup pedantic compiler warnings

* Compile apps with GNU89 GNU99 GNU11 and GNU17

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-12-25 21:43:51 -06:00
committed by GitHub
parent 0728bc4390
commit b91735af13
66 changed files with 990 additions and 847 deletions
+42 -41
View File
@@ -108,44 +108,48 @@ static void print_help(char *filename)
{
printf("Send BACnet I-Am message for a device.\n");
printf("--mac A\n"
"Optional BACnet mac address."
"Valid ranges are from 00 to FF (hex) for MS/TP or ARCNET,\n"
"or an IP string with optional port number like 10.1.2.3:47808\n"
"or an Ethernet MAC in hex like 00:21:70:7e:32:bb\n"
"\n"
"--dnet N\n"
"Optional BACnet network number N for directed requests.\n"
"Valid range is from 0 to 65535 where 0 is the local connection\n"
"and 65535 is network broadcast.\n"
"\n"
"--dadr A\n"
"Optional BACnet mac address on the destination BACnet network "
"number.\n"
"Valid ranges are from 00 to FF (hex) for MS/TP or ARCNET,\n"
"or an IP string with optional port number like 10.1.2.3:47808\n"
"or an Ethernet MAC in hex like 00:21:70:7e:32:bb\n"
"--repeat\n"
"Send the message repeatedly until signalled to quit.\n"
"Default is to not repeat, sending only a single message.\n"
"\n"
"--retry C\n"
"Send the message C number of times\n"
"Default is retry 0, only sending one time.\n"
"\n"
"--delay\n"
"Delay, in milliseconds, between repeated messages.\n"
"Default delay is 100ms.\n"
"\n");
printf(
"device-instance:\n"
" BACnet device-ID 0..4194303\n"
"vendor-id:\n"
" Vendor Identifier 0..65535\n"
"max-apdu:\n"
" Maximum APDU size 50..65535\n"
"segmentation:\n"
" BACnet Segmentation 0=both, 1=transmit, 2=receive, 3=none\n"
"To send an I-Am message for instance=1234 vendor-id=260 max-apdu=480\n"
"Optional BACnet mac address."
"Valid ranges are from 00 to FF (hex) for MS/TP or ARCNET,\n"
"or an IP string with optional port number like 10.1.2.3:47808\n"
"or an Ethernet MAC in hex like 00:21:70:7e:32:bb\n");
printf("\n");
printf("--dnet N\n"
"Optional BACnet network number N for directed requests.\n"
"Valid range is from 0 to 65535 where 0 is the local connection\n"
"and 65535 is network broadcast.\n");
printf("\n");
printf("--dadr A\n"
"Optional BACnet mac address on the destination BACnet network number.\n"
"Valid ranges are from 00 to FF (hex) for MS/TP or ARCNET,\n"
"or an IP string with optional port number like 10.1.2.3:47808\n"
"or an Ethernet MAC in hex like 00:21:70:7e:32:bb\n");
printf("\n");
printf("--repeat\n"
"Send the message repeatedly until signalled to quit.\n"
"Default is to not repeat, sending only a single message.\n");
printf("\n");
printf("--retry C\n"
"Send the message C number of times\n"
"Default is retry 0, only sending one time.\n");
printf("\n");
printf("--delay\n"
"Delay, in milliseconds, between repeated messages.\n"
"Default delay is 100ms.\n");
printf("\n");
printf("device-instance:\n"
"BACnet device-ID 0..4194303\n");
printf("\n");
printf("vendor-id:\n"
"Vendor Identifier 0..65535\n");
printf("\n");
printf("max-apdu:\n"
"Maximum APDU size 50..65535\n");
printf("\n");
printf("segmentation:\n"
"BACnet Segmentation 0=both, 1=transmit, 2=receive, 3=none\n");
printf("\n");
printf("Example:\n"
"To send an I-Am message of instance=1234 vendor-id=260 max-apdu=480\n"
"%s 1234 260 480\n",
filename);
}
@@ -213,9 +217,6 @@ int main(int argc, char *argv[])
} else if (strcmp(argv[argi], "--delay") == 0) {
if (++argi < argc) {
timeout = strtol(argv[argi], NULL, 0);
if (timeout < 0) {
timeout = 0;
}
}
} else {
if (target_args == 0) {