svn commit: trunk/busybox: include networking

vda at busybox.net vda at busybox.net
Wed Jun 4 07:59:52 UTC 2008


Author: vda
Date: 2008-06-04 00:59:51 -0700 (Wed, 04 Jun 2008)
New Revision: 22208

Log:
networking/interface.c: fix indentation



Modified:
   trunk/busybox/include/libbb.h
   trunk/busybox/networking/ifconfig.c
   trunk/busybox/networking/interface.c


Changeset:
Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2008-06-03 23:28:43 UTC (rev 22207)
+++ trunk/busybox/include/libbb.h	2008-06-04 07:59:51 UTC (rev 22208)
@@ -934,6 +934,8 @@
 int display_interfaces(char *ifname);
 #if ENABLE_FEATURE_HWIB
 int in_ib(const char *bufp, struct sockaddr *sap);
+#else
+#define in_ib(a, b) 1 /* fail */
 #endif
 const struct aftype *get_aftype(const char *name);
 const struct hwtype *get_hwtype(const char *name);

Modified: trunk/busybox/networking/ifconfig.c
===================================================================
--- trunk/busybox/networking/ifconfig.c	2008-06-03 23:28:43 UTC (rev 22207)
+++ trunk/busybox/networking/ifconfig.c	2008-06-04 07:59:51 UTC (rev 22208)
@@ -252,20 +252,13 @@
 /*
  * A couple of prototypes.
  */
-
 #if ENABLE_FEATURE_IFCONFIG_HW
 static int in_ether(const char *bufp, struct sockaddr *sap);
-# if ENABLE_FEATURE_HWIB
-extern int in_ib(const char *bufp, struct sockaddr *sap);
-# else
-#  define in_ib(a, b) 1 /* fail */
-# endif
 #endif
 
 /*
  * Our main function.
  */
-
 int ifconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int ifconfig_main(int argc, char **argv)
 {
@@ -436,8 +429,7 @@
 							bb_show_usage();
 						/*safe_strncpy(host, *argv, sizeof(host));*/
 						host = *argv;
-						if (hw_class == 1 ? in_ether(host, &sa)
-							: in_ib(host, &sa))
+						if (hw_class == 1 ? in_ether(host, &sa) : in_ib(host, &sa))
 							bb_error_msg_and_die("invalid hw-addr %s", host);
 						p = (char *) &sa;
 					}

Modified: trunk/busybox/networking/interface.c
===================================================================
--- trunk/busybox/networking/interface.c	2008-06-03 23:28:43 UTC (rev 22207)
+++ trunk/busybox/networking/interface.c	2008-06-04 07:59:51 UTC (rev 22208)
@@ -680,7 +680,6 @@
 	return 0;
 }
 
-
 static int do_if_fetch(struct interface *ife)
 {
 	if (if_fetch(ife) < 0) {
@@ -1217,63 +1216,62 @@
 /* Input an Infiniband address and convert to binary. */
 int in_ib(const char *bufp, struct sockaddr *sap)
 {
-    unsigned char *ptr;
-    char c;
-    const char *orig;
-    int i;
-    unsigned val;
+	unsigned char *ptr;
+	char c;
+	const char *orig;
+	int i;
+	unsigned val;
 
-    sap->sa_family = ib_hwtype.type;
-    ptr = (unsigned char *) sap->sa_data;
+	sap->sa_family = ib_hwtype.type;
+	ptr = (unsigned char *) sap->sa_data;
 
-    i = 0;
-    orig = bufp;
-    while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) {
-	val = 0;
-	c = *bufp++;
-	if (isdigit(c))
-	    val = c - '0';
-	else if (c >= 'a' && c <= 'f')
-	    val = c - 'a' + 10;
-	else if (c >= 'A' && c <= 'F')
-	    val = c - 'A' + 10;
-	else {
-	    errno = EINVAL;
-	    return (-1);
-	}
-	val <<= 4;
-	c = *bufp;
-	if (isdigit(c))
-	    val |= c - '0';
-	else if (c >= 'a' && c <= 'f')
-	    val |= c - 'a' + 10;
-	else if (c >= 'A' && c <= 'F')
-	    val |= c - 'A' + 10;
-	else if (c == ':' || c == 0)
-	    val >>= 4;
-	else {
-	    errno = EINVAL;
-	    return (-1);
-	}
-	if (c != 0)
-	    bufp++;
-	*ptr++ = (unsigned char) (val & 0377);
-	i++;
+	i = 0;
+	orig = bufp;
+	while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) {
+		val = 0;
+		c = *bufp++;
+		if (isdigit(c))
+			val = c - '0';
+		else if (c >= 'a' && c <= 'f')
+			val = c - 'a' + 10;
+		else if (c >= 'A' && c <= 'F')
+			val = c - 'A' + 10;
+		else {
+			errno = EINVAL;
+			return -1;
+		}
+		val <<= 4;
+		c = *bufp;
+		if (isdigit(c))
+			val |= c - '0';
+		else if (c >= 'a' && c <= 'f')
+			val |= c - 'a' + 10;
+		else if (c >= 'A' && c <= 'F')
+			val |= c - 'A' + 10;
+		else if (c == ':' || c == 0)
+			val >>= 4;
+		else {
+			errno = EINVAL;
+			return -1;
+		}
+		if (c != 0)
+			bufp++;
+		*ptr++ = (unsigned char) (val & 0377);
+		i++;
 
-	/* We might get a semicolon here - not required. */
-	if (*bufp == ':') {
-	    bufp++;
+		/* We might get a semicolon here - not required. */
+		if (*bufp == ':') {
+			bufp++;
+		}
 	}
-    }
 #ifdef DEBUG
-fprintf(stderr, "in_ib(%s): %s\n", orig, UNSPEC_print(sap->sa_data));
+	fprintf(stderr, "in_ib(%s): %s\n", orig, UNSPEC_print(sap->sa_data));
 #endif
-    return (0);
+	return 0;
 }
 #endif
 
 
-
 int display_interfaces(char *ifname)
 {
 	int status;




More information about the busybox-cvs mailing list