while ((c = getopt_long(argc, argv, "46hlnp:q:s:t:uvx",
while ((c = getopt_long(argc, argv, "46hlnp:q:s:uvw:x",
int parse_arguments(int argc, char **argv, connection_attributes *attrs){	int c, verbosity_level = 0;	bool listen_mode = FALSE;	bool file_transfer = FALSE;	int option_index = 0;	static struct option long_options[] = {		{"help",           FALSE, 0, 'h'},		{"listen",         FALSE, 0, 'l'},		{"port",           TRUE,  0, 'p'},		{"hold-timeouts",  TRUE,  0, 'q'},		{"address",        TRUE,  0, 's'},		{"udp",            FALSE, 0, 'u'},		{"timeout",        TRUE,  0, 'w'},		{"transfer",       FALSE, 0, 'x'},		{0, 0, 0, 0}	};	/* set socket types to default values */	attrs->proto = PROTO_UNSPECIFIED;	attrs->type  = TCP_SOCKET;	/* option recognition loop */	while ((c = getopt_long(argc, argv, "46hlnp:q:s:t:uvx",	                        long_options, &option_index)) >= 0)	{ 		switch(c) {		case '4':			if (attrs->proto != PROTO_UNSPECIFIED) 			    fatal("cannot specify the address family twice");			attrs->proto = PROTO_IPv4;			break;		case '6':				if (attrs->proto != PROTO_UNSPECIFIED) 			    fatal("cannot specify the address family twice");			attrs->proto = PROTO_IPv6;			set_flag(STRICT_IPV6);			break;		case 'd':				set_flag(DONT_REUSE_ADDR);			break;		case 'h':				print_usage(stdout);			exit(EXIT_SUCCESS);		case 'l':			listen_mode = TRUE;			break;		case 'n':				set_flag(NUMERIC_MODE);			break;		case 'p':				if (optarg == NULL) {				warn("you must specify a port with the -p switch");				print_usage(stderr);				exit(EXIT_FAILURE);			}			attrs->local_address.service = xstrdup(optarg);			break;			case 'q':			parse_and_set_timeouts(optarg, attrs);			break;			case 's':				attrs->local_address.address = xstrdup(optarg);			break;			case 'u':				attrs->type = UDP_SOCKET;			break;		case 'v':				if (++verbosity_level > 1) 				set_flag(VERY_VERBOSE_MODE); 			set_flag(VERBOSE_MODE); 			break;		case 'w':			attrs->connect_timeout = safe_atoi(optarg);			break;		case 'x':				file_transfer = TRUE;			break;		case '?':			print_usage(stderr);			exit(EXIT_FAILURE);		default:				fatal("getopt returned unexpected character 0%o\n", c);		}	}		argv += optind;	argc -= optind;	/* set mode flags */	set_flag((listen_mode)? LISTEN_MODE : CONNECT_MODE);	/* setup file transfer depending on the mode */	if (file_transfer == TRUE)		set_flag((listen_mode)? RECV_DATA_ONLY : SEND_DATA_ONLY);	/* additional arguments are the remote address/service */	switch(argc) {	case 0:		attrs->remote_address.address = NULL;		attrs->remote_address.service = NULL;		break;	case 1:		attrs->remote_address.address = argv[0];		attrs->remote_address.service = NULL;		break;	case 2:		attrs->remote_address.address = argv[0];		attrs->remote_address.service = argv[1];		break;	default:		print_usage(stderr);		exit(EXIT_FAILURE);	}	/* sanity check */	if (attrs->remote_address.address != NULL &&		strlen(attrs->remote_address.address) == 0) {		attrs->remote_address.address = NULL;	}	if (attrs->remote_address.service != NULL &&		strlen(attrs->remote_address.service) == 0) {		attrs->remote_address.service = NULL;	}	if (listen_mode) {			if (attrs->local_address.service == NULL) {			warn("in listen mode you must specify a port with the -p switch");			print_usage(stderr);			exit(EXIT_FAILURE);		}		return LISTEN_MODE;	} else {		if (is_flag_set(DONT_REUSE_ADDR)) {			warn("-d option can be used only in listen mode");			print_usage(stderr);			exit(EXIT_FAILURE);		}				if (attrs->remote_address.address == NULL ||		    attrs->remote_address.service == NULL) {			warn("you must specify the address/port couple of the remote endpoint");			print_usage(stderr);			exit(EXIT_FAILURE);		}		return CONNECT_MODE;	}}