summaryrefslogtreecommitdiff
path: root/libftpconn/open.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-10-20 08:38:41 +0000
committerRoland McGrath <roland@gnu.org>1998-10-20 08:38:41 +0000
commitfc40a731d23f893be2cb7699d7e078568d4c210c (patch)
tree9f1c90570e03a7c4082bee3fca2ced1755ac98a0 /libftpconn/open.c
parent6b0d5d23a26adea266903f285f7424a2f93863cb (diff)
Add braces to silence gcc warnings.
Diffstat (limited to 'libftpconn/open.c')
-rw-r--r--libftpconn/open.c93
1 files changed, 50 insertions, 43 deletions
diff --git a/libftpconn/open.c b/libftpconn/open.c
index b3615b17..dc8421b7 100644
--- a/libftpconn/open.c
+++ b/libftpconn/open.c
@@ -1,6 +1,6 @@
/* Connection initiation
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -35,7 +35,7 @@ ftp_conn_login (struct ftp_conn *conn)
int reply;
error_t err = 0;
const struct ftp_conn_params *p = conn->params;
-
+
err = ftp_conn_cmd (conn, "user", p->user ?: "anonymous", &reply, 0);
if (!err && reply == REPLY_NEED_ACCT)
@@ -59,40 +59,44 @@ ftp_conn_login (struct ftp_conn *conn)
FTP_CONN_GET_LOGIN_PARAM_PASS,
&pass);
if (! err)
- if (pass)
- err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
- else
- {
- pass = getenv ("USER");
- if (! pass)
- pass = getenv ("LOGNAME");
- if (! pass)
- {
- struct passwd *pe = getpwuid (getuid ());
- pass = pe ? pe->pw_name : "?";
- }
-
- /* Append a '@' */
- pass = strdup (pass);
- if (pass)
- pass = realloc (pass, strlen (pass) + 1);
- if (pass)
- {
- strcat (pass, "@");
- err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
- }
- else
- err = ENOMEM;
- }
+ {
+ if (pass)
+ err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
+ else
+ {
+ pass = getenv ("USER");
+ if (! pass)
+ pass = getenv ("LOGNAME");
+ if (! pass)
+ {
+ struct passwd *pe = getpwuid (getuid ());
+ pass = pe ? pe->pw_name : "?";
+ }
+
+ /* Append a '@' */
+ pass = strdup (pass);
+ if (pass)
+ pass = realloc (pass, strlen (pass) + 1);
+ if (pass)
+ {
+ strcat (pass, "@");
+ err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
+ }
+ else
+ err = ENOMEM;
+ }
+ }
if (pass && !p->pass)
free (pass);
}
if (!err && reply != REPLY_LOGIN_OK)
- if (REPLY_IS_FAILURE (reply))
- err = EACCES;
- else
- err = unexpected_reply (conn, reply, 0, 0);
+ {
+ if (REPLY_IS_FAILURE (reply))
+ err = EACCES;
+ else
+ err = unexpected_reply (conn, reply, 0, 0);
+ }
return err;
}
@@ -141,18 +145,21 @@ ftp_conn_sysify (struct ftp_conn *conn)
error_t err = ftp_conn_cmd (conn, "syst", 0, &reply, &txt);
if (! err)
- if (reply == REPLY_SYSTYPE || reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
- {
- if (reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
- txt = 0;
- if (conn->hooks && conn->hooks->choose_syshooks)
- (*conn->hooks->choose_syshooks) (conn, txt);
- else
- ftp_conn_choose_syshooks (conn, txt);
- conn->syshooks_valid = 1;
- }
- else
- err = unexpected_reply (conn, reply, txt, 0);
+ {
+ if (reply == REPLY_SYSTYPE ||
+ reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
+ {
+ if (reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
+ txt = 0;
+ if (conn->hooks && conn->hooks->choose_syshooks)
+ (*conn->hooks->choose_syshooks) (conn, txt);
+ else
+ ftp_conn_choose_syshooks (conn, txt);
+ conn->syshooks_valid = 1;
+ }
+ else
+ err = unexpected_reply (conn, reply, txt, 0);
+ }
return err;
}