projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
init: fix logically inverted FEATURE_EXTRA_QUIET check
[oweals/busybox.git]
/
networking
/
ipcalc.c
diff --git
a/networking/ipcalc.c
b/networking/ipcalc.c
index 2a099eff012b4b636dfd4ca61c42efca0089f8f7..18abc12eb405a07d8ae6aae342cab8d62a99d5fb 100644
(file)
--- a/
networking/ipcalc.c
+++ b/
networking/ipcalc.c
@@
-12,7
+12,6
@@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <getopt.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <arpa/inet.h>
@@
-36,7
+35,7
@@
static unsigned long get_netmask(unsigned long ipaddr)
return 0;
}
return 0;
}
-#if
def CONFIG
_FEATURE_IPCALC_FANCY
+#if
ENABLE
_FEATURE_IPCALC_FANCY
static int get_prefix(unsigned long netmask)
{
unsigned long msk = 0x80000000;
static int get_prefix(unsigned long netmask)
{
unsigned long msk = 0x80000000;
@@
-75,7
+74,7
@@
int get_prefix(unsigned long netmask);
;
#endif
;
#endif
-int ipcalc_main(int argc, char **argv);
+int ipcalc_main(int argc, char **argv)
MAIN_EXTERNALLY_VISIBLE
;
int ipcalc_main(int argc, char **argv)
{
unsigned opt;
int ipcalc_main(int argc, char **argv)
{
unsigned opt;
@@
-87,7
+86,7
@@
int ipcalc_main(int argc, char **argv)
#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
applet_long_options = ipcalc_longopts;
#endif
#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
applet_long_options = ipcalc_longopts;
#endif
- opt = getopt32(arg
c, argv, "mbn" USE
_FEATURE_IPCALC_FANCY("phs"));
+ opt = getopt32(arg
v, "mbn" IF
_FEATURE_IPCALC_FANCY("phs"));
argc -= optind;
argv += optind;
if (opt & (BROADCAST | NETWORK | NETPREFIX)) {
argc -= optind;
argv += optind;
if (opt & (BROADCAST | NETWORK | NETPREFIX)) {
@@
-176,15
+175,12
@@
int ipcalc_main(int argc, char **argv)
if (opt & HOSTNAME) {
struct hostent *hostinfo;
if (opt & HOSTNAME) {
struct hostent *hostinfo;
- int x;
hostinfo = gethostbyaddr((char *) &ipaddr, sizeof(ipaddr), AF_INET);
if (!hostinfo) {
hostinfo = gethostbyaddr((char *) &ipaddr, sizeof(ipaddr), AF_INET);
if (!hostinfo) {
- bb_herror_msg_and_die("cannot find hostname for %s", argv[0]);
- }
- for (x = 0; hostinfo->h_name[x]; x++) {
- hostinfo->h_name[x] = tolower(hostinfo->h_name[x]);
+ bb_herror_msg_and_die("can't find hostname for %s", argv[0]);
}
}
+ str_tolower(hostinfo->h_name);
printf("HOSTNAME=%s\n", hostinfo->h_name);
}
printf("HOSTNAME=%s\n", hostinfo->h_name);
}