Remove trailing whitespace
Signed-off-by: Stefan Wahren <info@lategoodbye.de>
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||
// All rights reserved.
|
||||
//
|
||||
// rSCADA
|
||||
// rSCADA
|
||||
// http://www.rSCADA.se
|
||||
// info@rscada.se
|
||||
//
|
||||
@ -20,10 +20,10 @@ static int debug = 0;
|
||||
//
|
||||
int
|
||||
init_slaves(mbus_handle *handle)
|
||||
{
|
||||
{
|
||||
if (debug)
|
||||
printf("%s: debug: sending init frame #1\n", __PRETTY_FUNCTION__);
|
||||
|
||||
|
||||
if (mbus_send_ping_frame(handle, MBUS_ADDRESS_NETWORK_LAYER, 1) == -1)
|
||||
{
|
||||
return 0;
|
||||
@ -35,7 +35,7 @@ init_slaves(mbus_handle *handle)
|
||||
|
||||
if (debug)
|
||||
printf("%s: debug: sending init frame #2\n", __PRETTY_FUNCTION__);
|
||||
|
||||
|
||||
if (mbus_send_ping_frame(handle, MBUS_ADDRESS_BROADCAST_NOREPLY, 1) == -1)
|
||||
{
|
||||
return 0;
|
||||
@ -55,58 +55,58 @@ main(int argc, char **argv)
|
||||
long baudrate = 9600;
|
||||
mbus_handle *handle = NULL;
|
||||
mbus_frame *frame = NULL, reply;
|
||||
|
||||
|
||||
memset((void *)&reply, 0, sizeof(mbus_frame));
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
device = argv[1];
|
||||
device = argv[1];
|
||||
addr_mask = strdup("FFFFFFFFFFFFFFFF");
|
||||
}
|
||||
else if (argc == 3 && strcmp(argv[1], "-d") == 0)
|
||||
{
|
||||
device = argv[2];
|
||||
device = argv[2];
|
||||
addr_mask = strdup("FFFFFFFFFFFFFFFF");
|
||||
debug = 1;
|
||||
}
|
||||
else if (argc == 3)
|
||||
{
|
||||
device = argv[1];
|
||||
device = argv[1];
|
||||
addr_mask = strdup(argv[2]);
|
||||
}
|
||||
else if (argc == 4 && strcmp(argv[1], "-d") == 0)
|
||||
{
|
||||
device = argv[2];
|
||||
device = argv[2];
|
||||
addr_mask = strdup(argv[3]);
|
||||
debug = 1;
|
||||
}
|
||||
else if (argc == 4 && strcmp(argv[1], "-b") == 0)
|
||||
{
|
||||
baudrate = atol(argv[2]);
|
||||
device = argv[3];
|
||||
device = argv[3];
|
||||
addr_mask = strdup("FFFFFFFFFFFFFFFF");
|
||||
}
|
||||
else if (argc == 5 && strcmp(argv[1], "-d") == 0 && strcmp(argv[2], "-b") == 0)
|
||||
{
|
||||
baudrate = atol(argv[3]);
|
||||
device = argv[4];
|
||||
device = argv[4];
|
||||
addr_mask = strdup("FFFFFFFFFFFFFFFF");
|
||||
debug = 1;
|
||||
}
|
||||
else if (argc == 5 && strcmp(argv[1], "-b") == 0)
|
||||
{
|
||||
baudrate = atol(argv[2]);
|
||||
device = argv[3];
|
||||
device = argv[3];
|
||||
addr_mask = strdup(argv[4]);
|
||||
}
|
||||
else if (argc == 6 && strcmp(argv[1], "-d") == 0)
|
||||
{
|
||||
baudrate = atol(argv[3]);
|
||||
device = argv[4];
|
||||
device = argv[4];
|
||||
addr_mask = strdup(argv[5]);
|
||||
debug = 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "usage: %s [-d] [-b BAUDRATE] device [address-mask]\n", argv[0]);
|
||||
fprintf(stderr, "\toptional flag -d for debug printout\n");
|
||||
@ -115,19 +115,19 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "\t'FFFFFFFFFFFFFFFF' where F is a wildcard character\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
mbus_register_send_event(&mbus_dump_send_event);
|
||||
mbus_register_recv_event(&mbus_dump_recv_event);
|
||||
}
|
||||
|
||||
|
||||
if (addr_mask == NULL)
|
||||
{
|
||||
fprintf(stderr, "Failed to allocate address mask.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (mbus_is_secondary_address(addr_mask) == 0)
|
||||
{
|
||||
fprintf(stderr, "Misformatted secondary address mask. Must be 16 character HEX number.\n");
|
||||
|
Reference in New Issue
Block a user