Index: uspace/app/nettest1/nettest1.c
===================================================================
--- uspace/app/nettest1/nettest1.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
+++ uspace/app/nettest1/nettest1.c	(revision b5cf742a59181f253244bd8f695f588d137834ed)
@@ -54,8 +54,8 @@
 
 /** Echo module name. */
-#define NAME	"Nettest1"
+#define NAME  "nettest1"
 
 /** Packet data pattern. */
-#define NETTEST1_TEXT	"Networking test 1 - sockets"
+#define NETTEST1_TEXT  "Networking test 1 - sockets"
 
 static int family = PF_INET;
@@ -114,5 +114,5 @@
 	int value;
 	int rc;
-
+	
 	switch (argv[*index][1]) {
 	/*
@@ -120,7 +120,10 @@
 	 */
 	case 'f':
-		rc = arg_parse_name_int(argc, argv, index, &family, 0, socket_parse_protocol_family);
-		if (rc != EOK)
-			return rc;
+		rc = arg_parse_name_int(argc, argv, index, &value, 0,
+		    socket_parse_protocol_family);
+		if (rc != EOK)
+			return rc;
+		
+		family = (uint16_t) value;
 		break;
 	case 'h':
@@ -131,4 +134,5 @@
 		if (rc != EOK)
 			return rc;
+		
 		break;
 	case 'n':
@@ -136,4 +140,5 @@
 		if (rc != EOK)
 			return rc;
+		
 		break;
 	case 'p':
@@ -141,4 +146,5 @@
 		if (rc != EOK)
 			return rc;
+		
 		port = (uint16_t) value;
 		break;
@@ -147,10 +153,13 @@
 		if (rc != EOK)
 			return rc;
+		
 		size = (value >= 0) ? (size_t) value : 0;
 		break;
 	case 't':
-		rc = arg_parse_name_int(argc, argv, index, &value, 0, socket_parse_socket_type);
-		if (rc != EOK)
-			return rc;
+		rc = arg_parse_name_int(argc, argv, index, &value, 0,
+		    socket_parse_socket_type);
+		if (rc != EOK)
+			return rc;
+		
 		type = (sock_type_t) value;
 		break;
@@ -158,4 +167,5 @@
 		verbose = 1;
 		break;
+	
 	/*
 	 * Long options with double dash ('-')
@@ -163,8 +173,10 @@
 	case '-':
 		if (str_lcmp(argv[*index] + 2, "family=", 7) == 0) {
-			rc = arg_parse_name_int(argc, argv, index, &family, 9,
+			rc = arg_parse_name_int(argc, argv, index, &value, 9,
 			    socket_parse_protocol_family);
 			if (rc != EOK)
 				return rc;
+			
+			family = (uint16_t) value;
 		} else if (str_lcmp(argv[*index] + 2, "help", 5) == 0) {
 			nettest1_print_help();
@@ -182,4 +194,5 @@
 			if (rc != EOK)
 				return rc;
+			
 			port = (uint16_t) value;
 		} else if (str_lcmp(argv[*index] + 2, "type=", 5) == 0) {
@@ -188,4 +201,5 @@
 			if (rc != EOK)
 				return rc;
+			
 			type = (sock_type_t) value;
 		} else if (str_lcmp(argv[*index] + 2, "verbose", 8) == 0) {
@@ -200,5 +214,5 @@
 		return EINVAL;
 	}
-
+	
 	return EOK;
 }
@@ -211,7 +225,5 @@
 static void nettest1_fill_buffer(char *buffer, size_t size)
 {
-	size_t length;
-
-	length = 0;
+	size_t length = 0;
 	while (size > length + sizeof(NETTEST1_TEXT) - 1) {
 		memcpy(buffer + length, NETTEST1_TEXT,
@@ -219,5 +231,5 @@
 		length += sizeof(NETTEST1_TEXT) - 1;
 	}
-
+	
 	memcpy(buffer + length, NETTEST1_TEXT, size - length);
 	buffer[size] = '\0';
@@ -226,13 +238,11 @@
 static int nettest1_test(int *socket_ids, int nsockets, int nmessages)
 {
-	int rc;
-
 	if (verbose)
 		printf("%d sockets, %d messages\n", nsockets, nmessages);
-
-	rc = sockets_create(verbose, socket_ids, nsockets, family, type);
-	if (rc != EOK)
-		return rc;
-
+	
+	int rc = sockets_create(verbose, socket_ids, nsockets, family, type);
+	if (rc != EOK)
+		return rc;
+	
 	if (type == SOCK_STREAM) {
 		rc = sockets_connect(verbose, socket_ids, nsockets, address,
@@ -241,23 +251,23 @@
 			return rc;
 	}
-
+	
 	rc = sockets_sendto_recvfrom(verbose, socket_ids, nsockets, address,
 	    &addrlen, data, size, nmessages);
 	if (rc != EOK)
 		return rc;
-
+	
 	rc = sockets_close(verbose, socket_ids, nsockets);
 	if (rc != EOK)
 		return rc;
-
+	
 	if (verbose)
 		printf("\tOK\n");
-
+	
 	/****/
-
+	
 	rc = sockets_create(verbose, socket_ids, nsockets, family, type);
 	if (rc != EOK)
 		return rc;
-
+	
 	if (type == SOCK_STREAM) {
 		rc = sockets_connect(verbose, socket_ids, nsockets, address,
@@ -266,22 +276,22 @@
 			return rc;
 	}
-
+	
 	rc = sockets_sendto(verbose, socket_ids, nsockets, address, addrlen,
 	    data, size, nmessages);
 	if (rc != EOK)
 		return rc;
-
+	
 	rc = sockets_recvfrom(verbose, socket_ids, nsockets, address, &addrlen,
 	    data, size, nmessages);
 	if (rc != EOK)
 		return rc;
-
+	
 	rc = sockets_close(verbose, socket_ids, nsockets);
 	if (rc != EOK)
 		return rc;
-
+	
 	if (verbose)
 		printf("\tOK\n");
-
+	
 	return EOK;
 }
@@ -320,5 +330,5 @@
 		}
 	}
-
+	
 	/* If not before the last argument containing the host */
 	if (index >= argc) {
@@ -366,5 +376,5 @@
 		}
 	}
-
+	
 	/* Check data buffer size */
 	if (size <= 0) {
@@ -373,5 +383,5 @@
 		size = 1024;
 	}
-
+	
 	/*
 	 * Prepare data buffer. Allocate size bytes plus one for the
@@ -384,5 +394,5 @@
 	}
 	nettest1_fill_buffer(data, size);
-
+	
 	/* Check socket count */
 	if (sockets <= 0) {
@@ -391,5 +401,5 @@
 		sockets = 2;
 	}
-
+	
 	/*
 	 * Prepare socket buffer. Allocate count fields plus the terminating
@@ -401,9 +411,10 @@
 		return ENOMEM;
 	}
+	
 	socket_ids[sockets] = 0;
-
+	
 	if (verbose)
 		printf("Starting tests\n");
-
+	
 	rc = gettimeofday(&time_before, NULL);
 	if (rc != EOK) {
@@ -411,10 +422,10 @@
 		return rc;
 	}
-
+	
 	nettest1_test(socket_ids,       1,        1);
 	nettest1_test(socket_ids,       1, messages);
 	nettest1_test(socket_ids, sockets,        1);
 	nettest1_test(socket_ids, sockets, messages);
-
+	
 	rc = gettimeofday(&time_after, NULL);
 	if (rc != EOK) {
@@ -422,15 +433,14 @@
 		return rc;
 	}
-
+	
 	printf("Tested in %ld microseconds\n", tv_sub(&time_after,
 	    &time_before));
-
+	
 	if (verbose)
 		printf("Exiting\n");
-
+	
 	return EOK;
 }
 
-
 /** @}
  */
