Deleted Added
full compact
fetch.c (83307) fetch.c (83863)
1/*-
2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/usr.bin/fetch/fetch.c 83307 2001-09-10 17:23:57Z mike $
28 * $FreeBSD: head/usr.bin/fetch/fetch.c 83863 2001-09-23 22:03:39Z des $
29 */
30
31#include <sys/param.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
29 */
30
31#include <sys/param.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
34#include <sys/ioctl.h>
34
35#include <ctype.h>
36#include <err.h>
37#include <errno.h>
38#include <signal.h>
39#include <stdio.h>
40#include <stdlib.h>
41#include <string.h>

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

70int r_flag; /* -r: restart previously interrupted transfer */
71off_t S_size; /* -S: require size to match */
72int s_flag; /* -s: show size, don't fetch */
73u_int T_secs = 120; /* -T: transfer timeout in seconds */
74int t_flag; /*! -t: workaround TCP bug */
75int U_flag; /* -U: do not use high ports */
76int v_level = 1; /* -v: verbosity level */
77int v_tty; /* stdout is a tty */
35
36#include <ctype.h>
37#include <err.h>
38#include <errno.h>
39#include <signal.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <string.h>

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

71int r_flag; /* -r: restart previously interrupted transfer */
72off_t S_size; /* -S: require size to match */
73int s_flag; /* -s: show size, don't fetch */
74u_int T_secs = 120; /* -T: transfer timeout in seconds */
75int t_flag; /*! -t: workaround TCP bug */
76int U_flag; /* -U: do not use high ports */
77int v_level = 1; /* -v: verbosity level */
78int v_tty; /* stdout is a tty */
79pid_t pgrp; /* our process group */
78u_int w_secs; /* -w: retry delay */
79int family = PF_UNSPEC; /* -[46]: address family to use */
80
81int sigalrm; /* SIGALRM received */
82int siginfo; /* SIGINFO received */
83int sigint; /* SIGINT received */
84
85u_int ftp_timeout; /* default timeout for FTP transfers */

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

118
119/*
120 * Update the stats display
121 */
122static void
123stat_display(struct xferstat *xs, int force)
124{
125 struct timeval now;
80u_int w_secs; /* -w: retry delay */
81int family = PF_UNSPEC; /* -[46]: address family to use */
82
83int sigalrm; /* SIGALRM received */
84int siginfo; /* SIGINFO received */
85int sigint; /* SIGINT received */
86
87u_int ftp_timeout; /* default timeout for FTP transfers */

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

120
121/*
122 * Update the stats display
123 */
124static void
125stat_display(struct xferstat *xs, int force)
126{
127 struct timeval now;
128 int ctty_pgrp;
126
127 if (!v_tty || !v_level)
128 return;
129
129
130 if (!v_tty || !v_level)
131 return;
132
133 /* check if we're the foreground process */
134 if (ioctl(STDERR_FILENO, TIOCGPGRP, &ctty_pgrp) == -1 ||
135 (pid_t)ctty_pgrp != pgrp)
136 return;
137
130 gettimeofday(&now, NULL);
131 if (!force && now.tv_sec <= xs->last.tv_sec)
132 return;
133 xs->last = now;
134
135 fprintf(stderr, "\rReceiving %s", xs->name);
136 if (xs->size <= 0)
137 fprintf(stderr, ": %lld bytes", (long long)xs->rcvd);

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

822 } else {
823 if (sb.st_mode & S_IFDIR)
824 o_directory = 1;
825 }
826 }
827
828 /* check if output is to a tty (for progress report) */
829 v_tty = isatty(STDERR_FILENO);
138 gettimeofday(&now, NULL);
139 if (!force && now.tv_sec <= xs->last.tv_sec)
140 return;
141 xs->last = now;
142
143 fprintf(stderr, "\rReceiving %s", xs->name);
144 if (xs->size <= 0)
145 fprintf(stderr, ": %lld bytes", (long long)xs->rcvd);

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

830 } else {
831 if (sb.st_mode & S_IFDIR)
832 o_directory = 1;
833 }
834 }
835
836 /* check if output is to a tty (for progress report) */
837 v_tty = isatty(STDERR_FILENO);
838 if (v_tty)
839 pgrp = getpgrp();
840
830 r = 0;
831
832 /* authentication */
833 if (v_tty)
834 fetchAuthMethod = query_auth;
835
836 while (argc) {
837 if ((p = strrchr(*argv, '/')) == NULL)

--- 52 unchanged lines hidden ---
841 r = 0;
842
843 /* authentication */
844 if (v_tty)
845 fetchAuthMethod = query_auth;
846
847 while (argc) {
848 if ((p = strrchr(*argv, '/')) == NULL)

--- 52 unchanged lines hidden ---