Deleted Added
full compact
fetch.c (261233) fetch.c (261234)
1/*-
2 * Copyright (c) 2000-2014 Dag-Erling Sm��rgrav
3 * Copyright (c) 2013 Michael Gmelin <freebsd@grem.de>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 14 unchanged lines hidden (view full) ---

23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000-2014 Dag-Erling Sm��rgrav
3 * Copyright (c) 2013 Michael Gmelin <freebsd@grem.de>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 14 unchanged lines hidden (view full) ---

23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/usr.bin/fetch/fetch.c 261233 2014-01-28 14:29:24Z des $");
31__FBSDID("$FreeBSD: head/usr.bin/fetch/fetch.c 261234 2014-01-28 14:32:04Z des $");
32
33#include <sys/param.h>
34#include <sys/socket.h>
35#include <sys/stat.h>
36#include <sys/time.h>
37
38#include <ctype.h>
39#include <err.h>

--- 4 unchanged lines hidden (view full) ---

44#include <stdio.h>
45#include <stdlib.h>
46#include <string.h>
47#include <termios.h>
48#include <unistd.h>
49
50#include <fetch.h>
51
32
33#include <sys/param.h>
34#include <sys/socket.h>
35#include <sys/stat.h>
36#include <sys/time.h>
37
38#include <ctype.h>
39#include <err.h>

--- 4 unchanged lines hidden (view full) ---

44#include <stdio.h>
45#include <stdlib.h>
46#include <string.h>
47#include <termios.h>
48#include <unistd.h>
49
50#include <fetch.h>
51
52#define MINBUFSIZE 4096
52#define MINBUFSIZE 16384
53#define TIMEOUT 120
54
55/* Option flags */
56static int A_flag; /* -A: do not follow 302 redirects */
57static int a_flag; /* -a: auto retry */
58static off_t B_size; /* -B: buffer size */
59static int b_flag; /*! -b: workaround TCP bug */
60static char *c_dirname; /* -c: remote directory */

--- 650 unchanged lines hidden (view full) ---

711 count = url->offset;
712
713 /* start the counter */
714 stat_start(&xs, path, us.size, count);
715
716 sigalrm = siginfo = sigint = 0;
717
718 /* suck in the data */
53#define TIMEOUT 120
54
55/* Option flags */
56static int A_flag; /* -A: do not follow 302 redirects */
57static int a_flag; /* -a: auto retry */
58static off_t B_size; /* -B: buffer size */
59static int b_flag; /*! -b: workaround TCP bug */
60static char *c_dirname; /* -c: remote directory */

--- 650 unchanged lines hidden (view full) ---

711 count = url->offset;
712
713 /* start the counter */
714 stat_start(&xs, path, us.size, count);
715
716 sigalrm = siginfo = sigint = 0;
717
718 /* suck in the data */
719 setvbuf(f, NULL, _IOFBF, B_size);
719 signal(SIGINFO, sig_handler);
720 while (!sigint) {
721 if (us.size != -1 && us.size - count < B_size &&
722 us.size - count >= 0)
723 size = us.size - count;
724 else
725 size = B_size;
726 if (siginfo) {

--- 453 unchanged lines hidden ---
720 signal(SIGINFO, sig_handler);
721 while (!sigint) {
722 if (us.size != -1 && us.size - count < B_size &&
723 us.size - count >= 0)
724 size = us.size - count;
725 else
726 size = B_size;
727 if (siginfo) {

--- 453 unchanged lines hidden ---