View | Details | Raw Unified | Return to bug 131427
Collapse All | Expand All

(-)fetch/fetch.1 (+6 lines)
Lines 45-50 Link Here
45
.Op Fl S Ar bytes
45
.Op Fl S Ar bytes
46
.Op Fl T Ar seconds
46
.Op Fl T Ar seconds
47
.Op Fl w Ar seconds
47
.Op Fl w Ar seconds
48
.Op Fl e Ar number
48
.Ar URL ...
49
.Ar URL ...
49
.Nm
50
.Nm
50
.Op Fl 146AadFlMmnPpqRrsUv
51
.Op Fl 146AadFlMmnPpqRrsUv
Lines 55-60 Link Here
55
.Op Fl S Ar bytes
56
.Op Fl S Ar bytes
56
.Op Fl T Ar seconds
57
.Op Fl T Ar seconds
57
.Op Fl w Ar seconds
58
.Op Fl w Ar seconds
59
.Op Fl e Ar number
58
.Fl h Ar host Fl f Ar file Oo Fl c Ar dir Oc
60
.Fl h Ar host Fl f Ar file Oo Fl c Ar dir Oc
59
.Sh DESCRIPTION
61
.Sh DESCRIPTION
60
The
62
The
Lines 83-88 Link Here
83
error when the requested object does not exist.
85
error when the requested object does not exist.
84
.It Fl a
86
.It Fl a
85
Automatically retry the transfer upon soft failures.
87
Automatically retry the transfer upon soft failures.
88
.It Fl e Ar number
89
Set number of auto-retries, -1 for infinite retrying (the
90
default). Implies
91
.Fl a .
86
.It Fl B Ar bytes
92
.It Fl B Ar bytes
87
Specify the read buffer size in bytes.
93
Specify the read buffer size in bytes.
88
The default is 4096 bytes.
94
The default is 4096 bytes.
(-)fetch/fetch.c (-4 / +19 lines)
Lines 53-58 Link Here
53
/* Option flags */
53
/* Option flags */
54
int	 A_flag;	/*    -A: do not follow 302 redirects */
54
int	 A_flag;	/*    -A: do not follow 302 redirects */
55
int	 a_flag;	/*    -a: auto retry */
55
int	 a_flag;	/*    -a: auto retry */
56
int	 a_flag_tries = -1;	/*    -e: number of retries, -1 for infinite */
56
off_t	 B_size;	/*    -B: buffer size */
57
off_t	 B_size;	/*    -B: buffer size */
57
int	 b_flag;	/*!   -b: workaround TCP bug */
58
int	 b_flag;	/*!   -b: workaround TCP bug */
58
char    *c_dirname;	/*    -c: remote directory */
59
char    *c_dirname;	/*    -c: remote directory */
Lines 730-738 Link Here
730
{
731
{
731
	fprintf(stderr, "%s\n%s\n%s\n%s\n",
732
	fprintf(stderr, "%s\n%s\n%s\n%s\n",
732
"usage: fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [-N file] [-o file] [-S bytes]",
733
"usage: fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [-N file] [-o file] [-S bytes]",
733
"       [-T seconds] [-w seconds] [-i file] URL ...",
734
"       [-T seconds] [-w seconds] [-e number] [-i file] URL ...",
734
"       fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [-N file] [-o file] [-S bytes]",
735
"       fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [-N file] [-o file] [-S bytes]",
735
"       [-T seconds] [-w seconds] [-i file] -h host -f file [-c dir]");
736
"       [-T seconds] [-w seconds] [-e number] [-i file] -h host -f file [-c dir]");
736
}
737
}
737
738
738
739
Lines 749-755 Link Here
749
	int c, e, r;
750
	int c, e, r;
750
751
751
	while ((c = getopt(argc, argv,
752
	while ((c = getopt(argc, argv,
752
	    "146AaB:bc:dFf:Hh:i:lMmN:nPpo:qRrS:sT:tUvw:")) != -1)
753
	    "146AaB:bc:dFf:Hh:i:lMmN:nPpo:qRrS:sT:tUvw:e:")) != -1)
753
		switch (c) {
754
		switch (c) {
754
		case '1':
755
		case '1':
755
			once_flag = 1;
756
			once_flag = 1;
Lines 766-771 Link Here
766
		case 'a':
767
		case 'a':
767
			a_flag = 1;
768
			a_flag = 1;
768
			break;
769
			break;
770
		case 'e':
771
			a_flag = 1;
772
			a_flag_tries = strtol(optarg, &end, 10);
773
			if (*optarg == '\0' || *end != '\0')
774
				errx(1, "invalid number (%s)", optarg);
775
			break;
769
		case 'B':
776
		case 'B':
770
			B_size = (off_t)strtol(optarg, &end, 10);
777
			B_size = (off_t)strtol(optarg, &end, 10);
771
			if (*optarg == '\0' || *end != '\0')
778
			if (*optarg == '\0' || *end != '\0')
Lines 996-1003 Link Here
996
					    "before retrying\n", w_secs);
1003
					    "before retrying\n", w_secs);
997
				if (w_secs)
1004
				if (w_secs)
998
					sleep(w_secs);
1005
					sleep(w_secs);
999
				if (a_flag)
1006
1007
				if (a_flag && a_flag_tries > 0) {
1008
					if (v_level >= 2)
1009
						warnx("retries left: %d", a_flag_tries);
1010
					--a_flag_tries;
1000
					continue;
1011
					continue;
1012
				}
1013
1014
				/* user wants to retry forever */
1015
				if (a_flag && a_flag_tries < 0) continue;
1001
			}
1016
			}
1002
		}
1017
		}
1003
1018

Return to bug 131427