wireless/wapi: Improve some output.
This commit is contained in:
parent
65d59f8458
commit
58da85523d
@ -47,29 +47,74 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define WAPI_IOCTL_STRERROR(cmd) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s():ioctl(%s): %s\n", \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
wapi_ioctl_command_name(cmd), strerror(errno))
|
||||
#ifdef DEBUG_WIRELESS_ERROR
|
||||
# ifdef CONFIG_LIBC_STRERROR
|
||||
# define WAPI_IOCTL_STRERROR(cmd) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s():ioctl(%s): %s\n", \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
wapi_ioctl_command_name(cmd), strerror(errno))
|
||||
|
||||
#define WAPI_STRERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s():" fmt ": %s\n", \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
## __VA_ARGS__, strerror(errno))
|
||||
# define WAPI_STRERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s():" fmt ": %s\n", \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
## __VA_ARGS__, strerror(errno))
|
||||
# else
|
||||
# define WAPI_IOCTL_STRERROR(cmd) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s():ioctl(%s): %d\n", \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
wapi_ioctl_command_name(cmd), errno)
|
||||
|
||||
#define WAPI_ERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s(): " fmt , \
|
||||
__FILE__, __LINE__, __func__, ## __VA_ARGS__)
|
||||
# define WAPI_STRERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s():" fmt ": %d\n", \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
## __VA_ARGS__, errno)
|
||||
# endif
|
||||
|
||||
# define WAPI_ERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, "%s:%d:%s(): " fmt , \
|
||||
__FILE__, __LINE__, __func__, ## __VA_ARGS__)
|
||||
|
||||
#else
|
||||
# ifdef CONFIG_LIBC_STRERROR
|
||||
# define WAPI_IOCTL_STRERROR(cmd) \
|
||||
fprintf( \
|
||||
stderr, "ioctl(%s): %s\n", \
|
||||
wapi_ioctl_command_name(cmd), strerror(errno))
|
||||
|
||||
# define WAPI_STRERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, fmt ": %s\n", \
|
||||
## __VA_ARGS__, strerror(errno))
|
||||
# else
|
||||
# define WAPI_IOCTL_STRERROR(cmd) \
|
||||
fprintf( \
|
||||
stderr, "ioctl(%s): %d\n", \
|
||||
wapi_ioctl_command_name(cmd), errno)
|
||||
|
||||
# define WAPI_STRERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, fmt ": %d\n", \
|
||||
## __VA_ARGS__, errno)
|
||||
# endif
|
||||
|
||||
# define WAPI_ERROR(fmt, ...) \
|
||||
fprintf( \
|
||||
stderr, fmt , \
|
||||
## __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
||||
#define WAPI_VALIDATE_PTR(ptr) \
|
||||
if (!ptr) \
|
||||
{ \
|
||||
WAPI_ERROR("Null pointer: %s.\n", #ptr); \
|
||||
return -1; \
|
||||
}
|
||||
if (ptr == NULL) \
|
||||
{ \
|
||||
WAPI_ERROR("Null pointer: %p\n", ptr); \
|
||||
return -EINVAL; \
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
|
@ -76,6 +76,8 @@ typedef void (*cmd3_t)(int sock, FAR const char *arg1,
|
||||
|
||||
static int wapi_str2int(FAR const char *str);
|
||||
static double wapi_str2double(FAR const char *str);
|
||||
static unsigned int wapi_str2ndx(FAR const char *name, FAR const char **list,
|
||||
unsigned int listlen);
|
||||
|
||||
static void wapi_show_cmd(int sock, FAR const char *ifname);
|
||||
static void wapi_ip_cmd(int sock, FAR const char *ifname,
|
||||
@ -196,7 +198,13 @@ static unsigned int wapi_str2ndx(FAR const char *name, FAR const char **list,
|
||||
}
|
||||
}
|
||||
|
||||
WAPI_ERROR("ERROR: Invalid string: %s\n", name);
|
||||
WAPI_ERROR("ERROR: Invalid option string: %s\n", name);
|
||||
WAPI_ERROR(" Valid options include:\n");
|
||||
for (ndx = 0; ndx < listlen; ndx++)
|
||||
{
|
||||
WAPI_ERROR(" - %s\n", list[ndx]);
|
||||
}
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user