1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Adjust some typos from vms merge, and remove some elements we don't want to include without further consideration first.

This commit is contained in:
Micah Cowan 2009-07-04 18:42:59 -07:00
parent ae042e99cf
commit 5daac18e96
5 changed files with 7 additions and 111 deletions

View File

@ -444,9 +444,9 @@ write_backup_file (const char *file, downloaded_file_t downloaded_file_return)
else /* downloaded_file_return == FILE_DOWNLOADED_NORMALLY */
{
/* Append ".orig" to the name. */
filename_plus_orig_suffix = alloca (filename_len + sizeof ("ORIG_SFX"));
filename_plus_orig_suffix = alloca (filename_len + sizeof (ORIG_SFX));
strcpy (filename_plus_orig_suffix, file);
strcpy (filename_plus_orig_suffix + filename_len, "ORIG_SFX");
strcpy (filename_plus_orig_suffix + filename_len, ORIG_SFX);
}
if (!converted_files)

View File

@ -889,42 +889,6 @@ ftp_cwd (int csock, const char *dir)
return FTPOK;
}
/* Sends DELE command to the FTP server. */
uerr_t
ftp_dele (int csock, const char *file)
{
char *request, *respline;
int nwritten;
uerr_t err;
/* Send DELE request. */
request = ftp_request ("DELE", file);
nwritten = fd_write (csock, request, strlen (request), -1.0);
if (nwritten < 0)
{
xfree (request);
return WRITEFAILED;
}
xfree (request);
/* Get appropriate response. */
err = ftp_response (csock, &respline);
if (err != FTPOK)
return err; /* Return with early bad status. */
/* All OK, so far. */
if (*respline == '5')
{
err = FTPNSFOD; /* Permanent Negative Completion. */
}
else if (*respline != '2') /* Success might be 226 or 250 (or ???). */
{
err = FTPRERR; /* Not Positive Completion. */
}
xfree (respline); /* Free "respline" storage. */
return err; /* Return response-based status code. */
}
/* Sends REST command to the FTP server. */
uerr_t
ftp_rest (int csock, wgint offset)

View File

@ -58,7 +58,6 @@ uerr_t ftp_epsv (int, ip_address *, int *);
#endif
uerr_t ftp_type (int, int);
uerr_t ftp_cwd (int, const char *);
uerr_t ftp_dele (int, const char *);
uerr_t ftp_retr (int, const char *);
uerr_t ftp_rest (int, wgint);
uerr_t ftp_list (int, const char *, enum stype);

View File

@ -143,10 +143,8 @@ limit_bandwidth (wgint bytes, struct ptimer *timer)
static int
write_data (FILE *out, const char *buf, int bufsize, wgint *skip,
wgint *written, int flags)
wgint *written)
{
static int cr_pending = 0; /* Found CR in ASCII FTP data. */
if (!out)
return 1;
if (*skip > bufsize)
@ -163,72 +161,8 @@ write_data (FILE *out, const char *buf, int bufsize, wgint *skip,
return 1;
}
/* Note: This code assumes that "\n" is the universal line ending
character, as on UNIX and VMS. If this is not true, then here's
where to change it.
*/
#if 1
# define EOL_STRING "\n"
#else /* 1 */
# define EOL_STRING "\r\n"
#endif /* 1 [else] */
#define EOL_STRING_LEN (sizeof( EOL_STRING)- 1)
if (flags & rb_ftp_ascii)
{
const char *bufend;
/* ASCII transfer. Put out lines delimited by CRLF. */
bufend = buf+ bufsize;
while (buf < bufend)
{
/* If CR, put out any pending CR, then set CR-pending flag. */
if (*buf == '\r')
{
if (cr_pending)
{
fwrite ("\r", 1, 1, out);
*written += 1;
}
cr_pending = 1;
buf++;
continue;
}
if (cr_pending)
{
if (*buf == '\n')
{
/* Found FTP EOL (CRLF). Put out local EOL. */
fwrite (EOL_STRING, 1, EOL_STRING_LEN, out);
*written += EOL_STRING_LEN;
}
else
{
/* Normal character. Put out pending CR and it. */
fwrite ("\r", 1, 1, out);
fwrite (buf, 1, 1, out);
*written += 2;
}
buf++;
cr_pending = 0;
}
else
{
/* Normal character. Put it out. */
fwrite (buf, 1, 1, out);
*written += 1;
buf++;
}
}
}
else
{
/* Image transfer. Put out buffer. */
fwrite (buf, 1, bufsize, out);
*written += bufsize;
}
fwrite (buf, 1, bufsize, out);
*written += bufsize;
/* Immediately flush the downloaded data. This should not hinder
performance: fast downloads will arrive in large 16K chunks
@ -376,7 +310,7 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos,
if (ret > 0)
{
sum_read += ret;
if (!write_data (out, dlbuf, ret, &skip, &sum_written, flags))
if (!write_data (out, dlbuf, ret, &skip, &sum_written))
{
ret = -2;
goto out;

View File

@ -43,8 +43,7 @@ extern bool output_stream_regular;
/* Flags for fd_read_body. */
enum {
rb_read_exactly = 1,
rb_skip_startpos = 2,
rb_ftp_ascii = 4
rb_skip_startpos = 2
};
int fd_read_body (int, FILE *, wgint, wgint, wgint *, wgint *, double *, int);