Add and use RTEMS_BSD_ARGC()

This commit is contained in:
Sebastian Huber 2014-01-20 15:27:13 +01:00
parent f8c3d6eacf
commit 7831313a17
4 changed files with 13 additions and 15 deletions

View File

@ -7,7 +7,7 @@
*/ */
/* /*
* Copyright (c) 2013 embedded brains GmbH. All rights reserved. * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
* *
* embedded brains GmbH * embedded brains GmbH
* Dornierstr. 4 * Dornierstr. 4
@ -42,6 +42,8 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#define RTEMS_BSD_ARGC(array) (sizeof(array) / sizeof((array)[0]) - 1)
__BEGIN_DECLS __BEGIN_DECLS
int rtems_bsd_command_ifconfig(int argc, char **argv); int rtems_bsd_command_ifconfig(int argc, char **argv);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013 embedded brains GmbH. All rights reserved. * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
* *
* embedded brains GmbH * embedded brains GmbH
* Dornierstr. 4 * Dornierstr. 4
@ -43,7 +43,7 @@
#define TEST_NAME "LIBBSD COMMANDS 1" #define TEST_NAME "LIBBSD COMMANDS 1"
#define ARGC(x) (nitems(x) - 1) #define ARGC(x) RTEMS_BSD_ARGC(x)
static void static void
test_route_without_if(void) test_route_without_if(void)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013 embedded brains GmbH. All rights reserved. * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
* *
* embedded brains GmbH * embedded brains GmbH
* Dornierstr. 4 * Dornierstr. 4
@ -41,8 +41,6 @@
#include <rtems/bsd/test/network-config.h> #include <rtems/bsd/test/network-config.h>
#include <rtems/bsd/bsd.h> #include <rtems/bsd/bsd.h>
#define DEFAULT_NETWORK_ARGC(x) (RTEMS_ARRAY_SIZE(x) - 1)
static void static void
default_network_set_self_prio(rtems_task_priority prio) default_network_set_self_prio(rtems_task_priority prio)
{ {
@ -75,10 +73,10 @@ default_network_ifconfig_lo0(void)
NULL NULL
}; };
exit_code = rtems_bsd_command_ifconfig(DEFAULT_NETWORK_ARGC(lo0), lo0); exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0), lo0);
assert(exit_code == EX_OK); assert(exit_code == EX_OK);
exit_code = rtems_bsd_command_ifconfig(DEFAULT_NETWORK_ARGC(lo0_inet6), lo0_inet6); exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0_inet6), lo0_inet6);
assert(exit_code == EX_OK); assert(exit_code == EX_OK);
} }
@ -96,7 +94,7 @@ default_network_ifconfig_interface_0(void)
NULL NULL
}; };
exit_code = rtems_bsd_command_ifconfig(DEFAULT_NETWORK_ARGC(iface0), iface0); exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(iface0), iface0);
assert(exit_code == EX_OK); assert(exit_code == EX_OK);
} }
@ -121,10 +119,10 @@ default_network_route(void)
NULL NULL
}; };
exit_code = rtems_bsd_command_route(DEFAULT_NETWORK_ARGC(dflt_route), dflt_route); exit_code = rtems_bsd_command_route(RTEMS_BSD_ARGC(dflt_route), dflt_route);
assert(exit_code == EXIT_SUCCESS); assert(exit_code == EXIT_SUCCESS);
exit_code = rtems_bsd_command_route(DEFAULT_NETWORK_ARGC(dflt_route2), dflt_route2); exit_code = rtems_bsd_command_route(RTEMS_BSD_ARGC(dflt_route2), dflt_route2);
assert(exit_code == EXIT_SUCCESS); assert(exit_code == EXIT_SUCCESS);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013 embedded brains GmbH. All rights reserved. * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
* *
* embedded brains GmbH * embedded brains GmbH
* Dornierstr. 4 * Dornierstr. 4
@ -41,8 +41,6 @@
#define TEST_NAME "LIBBSD PING 1" #define TEST_NAME "LIBBSD PING 1"
#define ARGC(x) (RTEMS_ARRAY_SIZE(x) - 1)
static void static void
test_ping(void) test_ping(void)
{ {
@ -55,7 +53,7 @@ test_ping(void)
NULL NULL
}; };
exit_code = rtems_bsd_command_ping(ARGC(ping), ping); exit_code = rtems_bsd_command_ping(RTEMS_BSD_ARGC(ping), ping);
assert(exit_code == EXIT_SUCCESS); assert(exit_code == EXIT_SUCCESS);
} }