return err;
/* Get the address of this side of the connection. */
if (!(in_addr = conaddr (RBUF_FD (rbuf))))
- return HOSTERR;
+ return BINDERR;
/* Construct the argument of PORT (of the form a,b,c,d,e,f). */
bytes = (char *)alloca (6 * 4 + 1);
sprintf (bytes, "%d,%d,%d,%d,%d,%d", in_addr[0], in_addr[1],
char *request, *respline;
int nwritten;
uerr_t err;
- static char numbuf[20]; /* Buffer for the number */
+ static char numbuf[24]; /* Buffer for the number */
- long_to_string (numbuf, offset);
+ number_to_string (numbuf, offset);
request = ftp_request ("REST", numbuf);
nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
if (nwritten < 0)
return WRITEFAILED;
}
xfree (request);
+
/* Get appropriate response. */
err = ftp_response (rbuf, &respline);
if (err != FTPOK)
if (!strcasecmp (request, "VMS"))
*server_type = ST_VMS;
+ else if (!strcasecmp (request, "UNIX"))
+ *server_type = ST_UNIX;
+ else if (!strcasecmp (request, "WINDOWS_NT"))
+ *server_type = ST_WINNT;
+ else if (!strcasecmp (request, "MACOS"))
+ *server_type = ST_MACOS;
else
- if (!strcasecmp (request, "UNIX"))
- *server_type = ST_UNIX;
- else
- if (!strcasecmp (request, "WINDOWS_NT"))
- *server_type = ST_WINNT;
- else
- if (!strcasecmp (request, "MACOS"))
- *server_type = ST_MACOS;
- else
- *server_type = ST_OTHER;
+ *server_type = ST_OTHER;
xfree (respline);
/* All OK. */
/* All OK. */
return FTPOK;
}
+
/* Sends the SIZE command to the server, and returns the value in 'size'.
* If an error occurs, size is set to zero. */
uerr_t
/* All OK. */
return FTPOK;
}
+
+/* If URL's params are of the form "type=X", return character X.
+ Otherwise, return 'I' (the default type). */
+char
+ftp_process_type (const char *params)
+{
+ if (params
+ && 0 == strncasecmp (params, "type=", 5)
+ && params[5] != '\0')
+ return TOUPPER (params[5]);
+ else
+ return 'I';
+}