Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 21:54:47 +0400
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 21:54:47 +0400
commit7039a66b58706457c7423de60556e04545432943 (patch)
treea512daebc3674c819766664c8ea17d41ef7fef02 /networking
parent1385899416a4396385ad421ae1f532be7103738a (diff)
correct largefile support, add comments about it.
Diffstat (limited to 'networking')
-rw-r--r--networking/ftpgetput.c20
-rw-r--r--networking/httpd.c4
-rw-r--r--networking/wget.c24
3 files changed, 25 insertions, 23 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 902528f93..5d13e289b 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -104,9 +104,11 @@ static FILE *ftp_login(ftp_host_info_t *server)
}
#if !ENABLE_FTPGET
-#define ftp_receive 0
+int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
+ const char *local_path, char *server_path);
#else
-static int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
+static
+int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
const char *local_path, char *server_path)
{
char buf[512];
@@ -122,10 +124,8 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
fd_data = xconnect_ftpdata(server, buf);
if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
- unsigned long value=filesize;
- if (safe_strtoul(buf + 4, &value))
+ if (SAFE_STRTOOFF(buf + 4, &filesize))
bb_error_msg_and_die("SIZE error: %s", buf + 4);
- filesize = value;
} else {
filesize = -1;
do_continue = 0;
@@ -139,7 +139,7 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
if (do_continue) {
struct stat sbuf;
if (lstat(local_path, &sbuf) < 0) {
- bb_perror_msg_and_die("fstat()");
+ bb_perror_msg_and_die("lstat");
}
if (sbuf.st_size > 0) {
beg_range = sbuf.st_size;
@@ -149,7 +149,7 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
}
if (do_continue) {
- sprintf(buf, "REST %ld", (long)beg_range);
+ sprintf(buf, "REST "OFF_FMT, beg_range);
if (ftpcmd(buf, NULL, control_stream, buf) != 350) {
do_continue = 0;
} else {
@@ -191,9 +191,11 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
#endif
#if !ENABLE_FTPPUT
-#define ftp_send 0
+int ftp_send(ftp_host_info_t *server, FILE *control_stream,
+ const char *server_path, char *local_path);
#else
-static int ftp_send(ftp_host_info_t *server, FILE *control_stream,
+static
+int ftp_send(ftp_host_info_t *server, FILE *control_stream,
const char *server_path, char *local_path)
{
struct stat sbuf;
diff --git a/networking/httpd.c b/networking/httpd.c
index f3fe49cae..bbb2dfe7f 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -919,8 +919,8 @@ static int sendHeaders(HttpResponseNum responseNum)
if (config->ContentLength != -1) { /* file */
strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime(&config->last_mod));
- len += sprintf(buf+len, "Last-Modified: %s\r\n%s "FILEOFF_FMT"\r\n",
- timeStr, Content_length, (FILEOFF_TYPE) config->ContentLength);
+ len += sprintf(buf+len, "Last-Modified: %s\r\n%s "OFF_FMT"\r\n",
+ timeStr, Content_length, (off_t) config->ContentLength);
}
strcat(buf, "\r\n");
len += 2;
diff --git a/networking/wget.c b/networking/wget.c
index e7b19f2ef..74feccc36 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -29,9 +29,9 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
/* Globals (can be accessed from signal handlers */
-static FILEOFF_TYPE content_len; /* Content-length of the file */
-static FILEOFF_TYPE beg_range; /* Range at which continue begins */
-static FILEOFF_TYPE transferred; /* Number of bytes transferred so far */
+static off_t content_len; /* Content-length of the file */
+static off_t beg_range; /* Range at which continue begins */
+static off_t transferred; /* Number of bytes transferred so far */
static int chunked; /* chunked transfer encoding */
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
static void progressmeter(int flag);
@@ -215,10 +215,10 @@ int wget_main(int argc, char **argv)
opt |= WGET_OPT_QUIET;
opt &= ~WGET_OPT_CONTINUE;
} else if (opt & WGET_OPT_CONTINUE) {
- output_fd = open(fname_out, O_WRONLY|O_LARGEFILE);
+ output_fd = open(fname_out, O_WRONLY);
if (output_fd >= 0) {
- beg_range = LSEEK(output_fd, 0, SEEK_END);
- if (beg_range == (FILEOFF_TYPE)-1)
+ beg_range = lseek(output_fd, 0, SEEK_END);
+ if (beg_range == (off_t)-1)
bb_perror_msg_and_die("lseek");
}
/* File doesn't exist. We do not create file here yet.
@@ -282,7 +282,7 @@ int wget_main(int argc, char **argv)
#endif
if (beg_range)
- fprintf(sfp, "Range: bytes="FILEOFF_FMT"-\r\n", beg_range);
+ fprintf(sfp, "Range: bytes="OFF_FMT"-\r\n", beg_range);
if(extra_headers_left < sizeof(extra_headers))
fputs(extra_headers,sfp);
fprintf(sfp,"Connection: close\r\n\r\n");
@@ -413,7 +413,7 @@ read_response:
dfp = open_socket(&s_in);
if (beg_range) {
- sprintf(buf, "REST "FILEOFF_FMT, beg_range);
+ sprintf(buf, "REST "OFF_FMT, beg_range);
if (ftpcmd(buf, NULL, sfp, buf) == 350)
content_len -= beg_range;
}
@@ -435,7 +435,7 @@ read_response:
/* Do it before progressmeter (want to have nice error message) */
if (output_fd < 0)
output_fd = xopen3(fname_out,
- O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE, 0666);
+ O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0666);
if (!(opt & WGET_OPT_QUIET))
progressmeter(-1);
@@ -685,10 +685,10 @@ static void
progressmeter(int flag)
{
static struct timeval lastupdate;
- static FILEOFF_TYPE lastsize, totalsize;
+ static off_t lastsize, totalsize;
struct timeval now, td, tvwait;
- FILEOFF_TYPE abbrevsize;
+ off_t abbrevsize;
int elapsed, ratio, barlength, i;
char buf[256];
@@ -739,7 +739,7 @@ progressmeter(int flag)
if (tvwait.tv_sec >= STALLTIME) {
fprintf(stderr, " - stalled -");
} else {
- FILEOFF_TYPE to_download = totalsize - beg_range;
+ off_t to_download = totalsize - beg_range;
if (transferred <= 0 || elapsed <= 0 || transferred > to_download || chunked) {
fprintf(stderr, "--:--:-- ETA");
} else {