Index: uspace/srv/net/app/ping/ping.c
===================================================================
--- uspace/srv/net/app/ping/ping.c	(revision 4be390bb5b72a4e67b761fbf2beda61791c43f0e)
+++ uspace/srv/net/app/ping/ping.c	(revision aadf01ebd2c032bc8dd43a6e06ae5715e6c2710f)
@@ -63,9 +63,9 @@
  *  @returns EOK on success.
  */
-int		main( int argc, char * argv[] );
+int main(int argc, char * argv[]);
 
 /** Prints the application help.
  */
-void	print_help( void );
+void print_help(void);
 
 /** Translates the character string to the address family number.
@@ -74,7 +74,7 @@
  *  @returns EAFNOSUPPORTED if the address family is not supported.
  */
-int		parse_address_family( const char * name );
-
-void print_help( void ){
+int parse_address_family(const char * name);
+
+void print_help(void){
 	printf(
 		"Network Ping aplication\n" \
@@ -111,8 +111,8 @@
 }
 
-int parse_address_family( const char * name ){
-	if( str_lcmp( name, "AF_INET", 7 ) == 0 ){
+int parse_address_family(const char * name){
+	if(str_lcmp(name, "AF_INET", 7) == 0){
 		return AF_INET;
-	}else if( str_lcmp( name, "AF_INET6", 8 ) == 0 ){
+	}else if(str_lcmp(name, "AF_INET6", 8) == 0){
 		return AF_INET6;
 	}
@@ -120,93 +120,100 @@
 }
 
-int main( int argc, char * argv[] ){
+int main(int argc, char * argv[]){
 	ERROR_DECLARE;
 
-	size_t				size			= 38;
-	int					verbose			= 0;
-	int					dont_fragment	= 0;
-	ip_ttl_t			ttl				= 0;
-	ip_tos_t			tos				= 0;
-	int					count			= 3;
-	suseconds_t			timeout			= 3000;
-	int					family			= AF_INET;
-
-	socklen_t			max_length		= sizeof( struct sockaddr_in6 );
-	uint8_t				address_data[ max_length ];
-	struct sockaddr *		address		= ( struct sockaddr * ) address_data;
-	struct sockaddr_in *	address_in		= ( struct sockaddr_in * ) address;
-	struct sockaddr_in6 *	address_in6	= ( struct sockaddr_in6 * ) address;
-	socklen_t			addrlen;
-	char				address_string[ INET6_ADDRSTRLEN ];
-	uint8_t *			address_start;
-	int					icmp_phone;
-	struct timeval		time_before;
-	struct timeval		time_after;
-	int					result;
-	int					value;
-	int					index;
-
-	printf( "Task %d - ", task_get_id());
-	printf( "%s\n", NAME );
-
-	if( argc <= 1 ){
+	size_t size			= 38;
+	int verbose			= 0;
+	int dont_fragment	= 0;
+	ip_ttl_t ttl				= 0;
+	ip_tos_t tos				= 0;
+	int count			= 3;
+	suseconds_t timeout			= 3000;
+	int family			= AF_INET;
+
+	socklen_t max_length		= sizeof(struct sockaddr_in6);
+	uint8_t address_data[max_length];
+	struct sockaddr * address		= (struct sockaddr *) address_data;
+	struct sockaddr_in * address_in		= (struct sockaddr_in *) address;
+	struct sockaddr_in6 * address_in6	= (struct sockaddr_in6 *) address;
+	socklen_t addrlen;
+	char address_string[INET6_ADDRSTRLEN];
+	uint8_t * address_start;
+	int icmp_phone;
+	struct timeval time_before;
+	struct timeval time_after;
+	int result;
+	int value;
+	int index;
+
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
+
+	if(argc <= 1){
 		print_help();
 		return EINVAL;
 	}
 
-	for( index = 1; ( index < argc - 1 ) || (( index == argc ) && ( argv[ index ][ 0 ] == '-' )); ++ index ){
-		if( argv[ index ][ 0 ] == '-' ){
-			switch( argv[ index ][ 1 ] ){
-				case 'c':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & count, "count", 0 ));
-							break;
-				case 'f':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "address family", 0, parse_address_family ));
-							break;
-				case 'h':	print_help();
-							return EOK;
-							break;
-				case 's':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "packet size", 0 ));
-							size = (value >= 0 ) ? ( size_t ) value : 0;
-							break;
-				case 't':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "timeout", 0 ));
-							timeout = (value >= 0 ) ? ( suseconds_t ) value : 0;
-							break;
-				case 'v':	verbose = 1;
-							break;
-				case '-':	if( str_lcmp( argv[ index ] + 2, "count=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & count, "received count", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "dont_fragment", 13 ) == 0 ){
-								dont_fragment = 1;
-							}else if( str_lcmp( argv[ index ] + 2, "family=", 7 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "address family", 9, parse_address_family ));
-							}else if( str_lcmp( argv[ index ] + 2, "help", 5 ) == 0 ){
-								print_help();
-								return EOK;
-							}else if( str_lcmp( argv[ index ] + 2, "size=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "packet size", 7 ));
-								size = (value >= 0 ) ? ( size_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "timeout=", 8 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "timeout", 7 ));
-								timeout = (value >= 0 ) ? ( suseconds_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "tos=", 4 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "type of service", 7 ));
-								tos = (value >= 0 ) ? ( ip_tos_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "ttl=", 4 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "time to live", 7 ));
-								ttl = (value >= 0 ) ? ( ip_ttl_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "verbose", 8 ) == 0 ){
-								verbose = 1;
-							}else{
-								print_unrecognized( index, argv[ index ] + 2 );
-								print_help();
-								return EINVAL;
-							}
-							break;
+	for(index = 1; (index < argc - 1) || ((index == argc) && (argv[index][0] == '-')); ++ index){
+		if(argv[index][0] == '-'){
+			switch(argv[index][1]){
+				case 'c':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "count", 0));
+					break;
+				case 'f':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "address family", 0, parse_address_family));
+					break;
+				case 'h':
+					print_help();
+					return EOK;
+					break;
+				case 's':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 0));
+					size = (value >= 0) ? (size_t) value : 0;
+					break;
+				case 't':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "timeout", 0));
+					timeout = (value >= 0) ? (suseconds_t) value : 0;
+					break;
+				case 'v':
+					verbose = 1;
+					break;
+				case '-':
+					if(str_lcmp(argv[index] + 2, "count=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "received count", 8));
+					}else if(str_lcmp(argv[index] + 2, "dont_fragment", 13) == 0){
+						dont_fragment = 1;
+					}else if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "address family", 9, parse_address_family));
+					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
+						print_help();
+						return EOK;
+					}else if(str_lcmp(argv[index] + 2, "size=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 7));
+						size = (value >= 0) ? (size_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "timeout=", 8) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "timeout", 7));
+						timeout = (value >= 0) ? (suseconds_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "tos=", 4) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "type of service", 7));
+						tos = (value >= 0) ? (ip_tos_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "ttl=", 4) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "time to live", 7));
+						ttl = (value >= 0) ? (ip_ttl_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
+						verbose = 1;
+					}else{
+						print_unrecognized(index, argv[index] + 2);
+						print_help();
+						return EINVAL;
+					}
+					break;
 				default:
-					print_unrecognized( index, argv[ index ] + 1 );
+					print_unrecognized(index, argv[index] + 1);
 					print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized( index, argv[ index ] );
+			print_unrecognized(index, argv[index]);
 			print_help();
 			return EINVAL;
@@ -214,63 +221,65 @@
 	}
 
-	bzero( address_data, max_length );
-	switch( family ){
+	bzero(address_data, max_length);
+	switch(family){
 		case AF_INET:
 			address_in->sin_family = AF_INET;
-			address_start = ( uint8_t * ) & address_in->sin_addr.s_addr;
-			addrlen = sizeof( struct sockaddr_in );
+			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
+			addrlen = sizeof(struct sockaddr_in);
 			break;
 		case AF_INET6:
 			address_in6->sin6_family = AF_INET6;
-			address_start = ( uint8_t * ) & address_in6->sin6_addr.s6_addr;
-			addrlen = sizeof( struct sockaddr_in6 );
+			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
+			addrlen = sizeof(struct sockaddr_in6);
 			break;
 		default:
-			fprintf( stderr, "Address family is not supported\n" );
+			fprintf(stderr, "Address family is not supported\n");
 			return EAFNOSUPPORT;
 	}
 
-	if( ERROR_OCCURRED( inet_pton( family, argv[ argc - 1 ], address_start ))){
-		fprintf( stderr, "Address parse error %d\n", ERROR_CODE );
+	if(ERROR_OCCURRED(inet_pton(family, argv[argc - 1], address_start))){
+		fprintf(stderr, "Address parse error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	icmp_phone = icmp_connect_module( SERVICE_ICMP, ICMP_CONNECT_TIMEOUT );
-	if( icmp_phone < 0 ){
-		fprintf( stderr, "ICMP connect error %d\n", icmp_phone );
+	icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
+	if(icmp_phone < 0){
+		fprintf(stderr, "ICMP connect error %d\n", icmp_phone);
 		return icmp_phone;
 	}
 
-	printf( "PING %d bytes of data\n", size );
-	if( ERROR_OCCURRED( inet_ntop( address->sa_family, address_start, address_string, sizeof( address_string )))){
-		fprintf( stderr, "Address error %d\n", ERROR_CODE );
+	printf("PING %d bytes of data\n", size);
+	if(ERROR_OCCURRED(inet_ntop(address->sa_family, address_start, address_string, sizeof(address_string)))){
+		fprintf(stderr, "Address error %d\n", ERROR_CODE);
 	}else{
-		printf( "Address %s:\n", address_string );
-	}
-
-	while( count > 0 ){
-		if( ERROR_OCCURRED( gettimeofday( & time_before, NULL ))){
-			fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+		printf("Address %s:\n", address_string);
+	}
+
+	while(count > 0){
+		if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+			fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 			return ERROR_CODE;
 		}
-		result = icmp_echo_msg( icmp_phone, size, timeout, ttl, tos, dont_fragment, address, addrlen );
-		if( ERROR_OCCURRED( gettimeofday( & time_after, NULL ))){
-			fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+		result = icmp_echo_msg(icmp_phone, size, timeout, ttl, tos, dont_fragment, address, addrlen);
+		if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+			fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 			return ERROR_CODE;
 		}
-		switch( result ){
+		switch(result){
 			case ICMP_ECHO:
-				printf( "Ping round trip time %d miliseconds\n", tv_sub( & time_after, & time_before ) / 1000 );
+				printf("Ping round trip time %d miliseconds\n", tv_sub(&time_after, &time_before) / 1000);
 				break;
 			case ETIMEOUT:
-				printf( "Timed out.\n" );
+				printf("Timed out.\n");
 				break;
 			default:
-				print_error( stdout, result, NULL, "\n" );
+				print_error(stdout, result, NULL, "\n");
 		}
 		-- count;
 	}
 
-	if( verbose ) printf( "Exiting\n" );
+	if(verbose){
+		printf("Exiting\n");
+	}
 
 	return EOK;
