socket-connect.c: w style (no code changes)
@@ -90,9 +90,10 @@ void sockaddr_set_port (struct sockaddr * saddr, int port)
// ====================================================================
-static struct addrinfo *
-lookup_host (gftp_request *request, char *service,
- char *proxy_hostname, int proxy_port)
+static struct addrinfo * lookup_host (gftp_request *request,
+ char *service,
+ char *proxy_hostname,
+ int proxy_port)
{
DEBUG_PRINT_FUNC
struct addrinfo hints, *hostp;
@@ -100,13 +101,10 @@ lookup_host (gftp_request *request, char *service,
char serv[8], *connect_host;
int ret, connect_port;
- if (request->use_proxy)
- {
+ if (request->use_proxy) {
connect_host = proxy_hostname;
connect_port = proxy_port;
- }
- else
- {
+ } else {
connect_host = request->hostname;
connect_port = request->port;
}
@@ -119,18 +117,17 @@ lookup_host (gftp_request *request, char *service,
hints.ai_family = enable_ipv6 ? PF_UNSPEC : AF_INET;
hints.ai_socktype = SOCK_STREAM;
- if (connect_port == 0)
+ if (connect_port == 0) {
strcpy (serv, service);
- else
+ } else {
snprintf (serv, sizeof (serv), "%d", connect_port);
+ }
+ request->logging_function (gftp_logging_misc, request, _("Looking up %s\n"), connect_host);
- request->logging_function (gftp_logging_misc, request,
- _("Looking up %s\n"), connect_host);
- if ((ret = getaddrinfo (connect_host, serv, &hints,
- &hostp)) != 0)
+ ret = getaddrinfo (connect_host, serv, &hints, &hostp);
+ if (ret != 0)
{
- request->logging_function (gftp_logging_error, request,
- _("Unknown host. Maybe you misspelled it?\n"));
+ request->logging_function (gftp_logging_error, request, _("Unknown host. Maybe you misspelled it?\n"));
return (NULL);
}
@@ -138,8 +135,8 @@ lookup_host (gftp_request *request, char *service,
}
-static int
-gftp_do_connect_server (gftp_request * request, char *service,
+static int gftp_do_connect_server (gftp_request * request,
+ char *service,
char *proxy_hostname,
unsigned int proxy_port)
{
@@ -168,9 +165,9 @@ gftp_do_connect_server (gftp_request * request, char *service,
hostp = lookup_host (request, service, proxy_hostname, proxy_port);
- if (hostp == NULL)
+ if (hostp == NULL) {
return (GFTP_EFATAL);
-
+ }
for (res = hostp; res != NULL; res = res->ai_next)
{
saddr = res->ai_addr;
@@ -251,17 +248,16 @@ gftp_do_connect_server (gftp_request * request, char *service,
// ========================================================================
-int
-gftp_connect_server (gftp_request * request, char *service,
+int gftp_connect_server (gftp_request * request, char *service,
char *proxy_hostname, unsigned int proxy_port)
{
DEBUG_PRINT_FUNC
int sock;
sock = gftp_do_connect_server (request, service, proxy_hostname, proxy_port);
- if (sock < 0)
+ if (sock < 0) {
return (sock);
-
+ }
if (fcntl (sock, F_SETFD, 1) == -1)
{
request->logging_function (gftp_logging_error, request,
