brctl: optional support for "show" cmd (by L. Gabriel Somlo <somlo AT cmu.edu>)

function                                             old     new   delta
brctl_main                                           739    1186    +447
if_indextoname                                         -     104    +104
static.keywords                                      827     841     +14
static.ops                                             -       7      +7
packed_usage                                       23978   23976      -2
This commit is contained in:
Denis Vlasenko
2008-04-06 07:17:02 +00:00
parent ad4da989e3
commit 278a1c2264
5 changed files with 147 additions and 84 deletions

View File

@@ -704,17 +704,20 @@ int get_terminal_width_height(int fd, int *width, int *height)
return ret;
}
void ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,...)
int ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,...)
{
int ret;
va_list p;
if (ioctl(fd, request, argp) < 0) {
ret = ioctl(fd, request, argp);
if (ret < 0) {
va_start(p, fmt);
bb_verror_msg(fmt, p, strerror(errno));
/* xfunc_die can actually longjmp, so be nice */
va_end(p);
xfunc_die();
}
return ret;
}
int ioctl_or_perror(int fd, int request, void *argp, const char *fmt,...)
@@ -740,10 +743,14 @@ int bb_ioctl_or_warn(int fd, int request, void *argp, const char *ioctl_name)
bb_simple_perror_msg(ioctl_name);
return ret;
}
void bb_xioctl(int fd, int request, void *argp, const char *ioctl_name)
int bb_xioctl(int fd, int request, void *argp, const char *ioctl_name)
{
if (ioctl(fd, request, argp) < 0)
int ret;
ret = ioctl(fd, request, argp);
if (ret < 0)
bb_simple_perror_msg_and_die(ioctl_name);
return ret;
}
#else
int bb_ioctl_or_warn(int fd, int request, void *argp)
@@ -755,9 +762,13 @@ int bb_ioctl_or_warn(int fd, int request, void *argp)
bb_perror_msg("ioctl %#x failed", request);
return ret;
}
void bb_xioctl(int fd, int request, void *argp)
int bb_xioctl(int fd, int request, void *argp)
{
if (ioctl(fd, request, argp) < 0)
int ret;
ret = ioctl(fd, request, argp);
if (ret < 0)
bb_perror_msg_and_die("ioctl %#x failed", request);
return ret;
}
#endif