diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-04 07:59:51 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-04 07:59:51 +0000 |
commit | 3b162ecdf6955e9610ec051e21b91a3efe48a030 (patch) | |
tree | b2b3e75e8dfb4e32fc4d67af5682ed4ea8b800bd | |
parent | 630a7f75e836b2d8669e571af9c5aa5b180c6ca8 (diff) | |
download | busybox-w32-3b162ecdf6955e9610ec051e21b91a3efe48a030.tar.gz busybox-w32-3b162ecdf6955e9610ec051e21b91a3efe48a030.tar.bz2 busybox-w32-3b162ecdf6955e9610ec051e21b91a3efe48a030.zip |
networking/interface.c: fix indentation
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | networking/ifconfig.c | 10 | ||||
-rw-r--r-- | networking/interface.c | 100 |
3 files changed, 52 insertions, 60 deletions
diff --git a/include/libbb.h b/include/libbb.h index c79cd8b20..492a561a9 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -934,6 +934,8 @@ extern smallint interface_opt_a; | |||
934 | int display_interfaces(char *ifname); | 934 | int display_interfaces(char *ifname); |
935 | #if ENABLE_FEATURE_HWIB | 935 | #if ENABLE_FEATURE_HWIB |
936 | int in_ib(const char *bufp, struct sockaddr *sap); | 936 | int in_ib(const char *bufp, struct sockaddr *sap); |
937 | #else | ||
938 | #define in_ib(a, b) 1 /* fail */ | ||
937 | #endif | 939 | #endif |
938 | const struct aftype *get_aftype(const char *name); | 940 | const struct aftype *get_aftype(const char *name); |
939 | const struct hwtype *get_hwtype(const char *name); | 941 | const struct hwtype *get_hwtype(const char *name); |
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 965fca344..e999741d1 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -252,20 +252,13 @@ static const struct options OptArray[] = { | |||
252 | /* | 252 | /* |
253 | * A couple of prototypes. | 253 | * A couple of prototypes. |
254 | */ | 254 | */ |
255 | |||
256 | #if ENABLE_FEATURE_IFCONFIG_HW | 255 | #if ENABLE_FEATURE_IFCONFIG_HW |
257 | static int in_ether(const char *bufp, struct sockaddr *sap); | 256 | static int in_ether(const char *bufp, struct sockaddr *sap); |
258 | # if ENABLE_FEATURE_HWIB | ||
259 | extern int in_ib(const char *bufp, struct sockaddr *sap); | ||
260 | # else | ||
261 | # define in_ib(a, b) 1 /* fail */ | ||
262 | # endif | ||
263 | #endif | 257 | #endif |
264 | 258 | ||
265 | /* | 259 | /* |
266 | * Our main function. | 260 | * Our main function. |
267 | */ | 261 | */ |
268 | |||
269 | int ifconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 262 | int ifconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
270 | int ifconfig_main(int argc, char **argv) | 263 | int ifconfig_main(int argc, char **argv) |
271 | { | 264 | { |
@@ -436,8 +429,7 @@ int ifconfig_main(int argc, char **argv) | |||
436 | bb_show_usage(); | 429 | bb_show_usage(); |
437 | /*safe_strncpy(host, *argv, sizeof(host));*/ | 430 | /*safe_strncpy(host, *argv, sizeof(host));*/ |
438 | host = *argv; | 431 | host = *argv; |
439 | if (hw_class == 1 ? in_ether(host, &sa) | 432 | if (hw_class == 1 ? in_ether(host, &sa) : in_ib(host, &sa)) |
440 | : in_ib(host, &sa)) | ||
441 | bb_error_msg_and_die("invalid hw-addr %s", host); | 433 | bb_error_msg_and_die("invalid hw-addr %s", host); |
442 | p = (char *) &sa; | 434 | p = (char *) &sa; |
443 | } | 435 | } |
diff --git a/networking/interface.c b/networking/interface.c index abd58b582..efae03bf3 100644 --- a/networking/interface.c +++ b/networking/interface.c | |||
@@ -680,7 +680,6 @@ static int if_fetch(struct interface *ife) | |||
680 | return 0; | 680 | return 0; |
681 | } | 681 | } |
682 | 682 | ||
683 | |||
684 | static int do_if_fetch(struct interface *ife) | 683 | static int do_if_fetch(struct interface *ife) |
685 | { | 684 | { |
686 | if (if_fetch(ife) < 0) { | 685 | if (if_fetch(ife) < 0) { |
@@ -1217,63 +1216,62 @@ static int if_print(char *ifname) | |||
1217 | /* Input an Infiniband address and convert to binary. */ | 1216 | /* Input an Infiniband address and convert to binary. */ |
1218 | int in_ib(const char *bufp, struct sockaddr *sap) | 1217 | int in_ib(const char *bufp, struct sockaddr *sap) |
1219 | { | 1218 | { |
1220 | unsigned char *ptr; | 1219 | unsigned char *ptr; |
1221 | char c; | 1220 | char c; |
1222 | const char *orig; | 1221 | const char *orig; |
1223 | int i; | 1222 | int i; |
1224 | unsigned val; | 1223 | unsigned val; |
1225 | 1224 | ||
1226 | sap->sa_family = ib_hwtype.type; | 1225 | sap->sa_family = ib_hwtype.type; |
1227 | ptr = (unsigned char *) sap->sa_data; | 1226 | ptr = (unsigned char *) sap->sa_data; |
1228 | 1227 | ||
1229 | i = 0; | 1228 | i = 0; |
1230 | orig = bufp; | 1229 | orig = bufp; |
1231 | while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) { | 1230 | while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) { |
1232 | val = 0; | 1231 | val = 0; |
1233 | c = *bufp++; | 1232 | c = *bufp++; |
1234 | if (isdigit(c)) | 1233 | if (isdigit(c)) |
1235 | val = c - '0'; | 1234 | val = c - '0'; |
1236 | else if (c >= 'a' && c <= 'f') | 1235 | else if (c >= 'a' && c <= 'f') |
1237 | val = c - 'a' + 10; | 1236 | val = c - 'a' + 10; |
1238 | else if (c >= 'A' && c <= 'F') | 1237 | else if (c >= 'A' && c <= 'F') |
1239 | val = c - 'A' + 10; | 1238 | val = c - 'A' + 10; |
1240 | else { | 1239 | else { |
1241 | errno = EINVAL; | 1240 | errno = EINVAL; |
1242 | return (-1); | 1241 | return -1; |
1243 | } | 1242 | } |
1244 | val <<= 4; | 1243 | val <<= 4; |
1245 | c = *bufp; | 1244 | c = *bufp; |
1246 | if (isdigit(c)) | 1245 | if (isdigit(c)) |
1247 | val |= c - '0'; | 1246 | val |= c - '0'; |
1248 | else if (c >= 'a' && c <= 'f') | 1247 | else if (c >= 'a' && c <= 'f') |
1249 | val |= c - 'a' + 10; | 1248 | val |= c - 'a' + 10; |
1250 | else if (c >= 'A' && c <= 'F') | 1249 | else if (c >= 'A' && c <= 'F') |
1251 | val |= c - 'A' + 10; | 1250 | val |= c - 'A' + 10; |
1252 | else if (c == ':' || c == 0) | 1251 | else if (c == ':' || c == 0) |
1253 | val >>= 4; | 1252 | val >>= 4; |
1254 | else { | 1253 | else { |
1255 | errno = EINVAL; | 1254 | errno = EINVAL; |
1256 | return (-1); | 1255 | return -1; |
1257 | } | 1256 | } |
1258 | if (c != 0) | 1257 | if (c != 0) |
1259 | bufp++; | 1258 | bufp++; |
1260 | *ptr++ = (unsigned char) (val & 0377); | 1259 | *ptr++ = (unsigned char) (val & 0377); |
1261 | i++; | 1260 | i++; |
1262 | 1261 | ||
1263 | /* We might get a semicolon here - not required. */ | 1262 | /* We might get a semicolon here - not required. */ |
1264 | if (*bufp == ':') { | 1263 | if (*bufp == ':') { |
1265 | bufp++; | 1264 | bufp++; |
1265 | } | ||
1266 | } | 1266 | } |
1267 | } | ||
1268 | #ifdef DEBUG | 1267 | #ifdef DEBUG |
1269 | fprintf(stderr, "in_ib(%s): %s\n", orig, UNSPEC_print(sap->sa_data)); | 1268 | fprintf(stderr, "in_ib(%s): %s\n", orig, UNSPEC_print(sap->sa_data)); |
1270 | #endif | 1269 | #endif |
1271 | return (0); | 1270 | return 0; |
1272 | } | 1271 | } |
1273 | #endif | 1272 | #endif |
1274 | 1273 | ||
1275 | 1274 | ||
1276 | |||
1277 | int display_interfaces(char *ifname) | 1275 | int display_interfaces(char *ifname) |
1278 | { | 1276 | { |
1279 | int status; | 1277 | int status; |